spec: update inspector-binding.js

* https://github.com/nodejs/node/pull/22251
* https://github.com/nodejs/node/pull/20137
This commit is contained in:
deepak1556 2018-10-30 10:43:33 +05:30
parent d97cf8c438
commit c491fa59df
2 changed files with 4 additions and 13 deletions

View file

@ -1,5 +1,6 @@
const inspector = require('inspector') const inspector = require('inspector')
const path = require('path') const path = require('path')
const { pathToFileURL } = require('url')
// This test case will set a breakpoint 4 lines below // This test case will set a breakpoint 4 lines below
function debuggedFunction () { function debuggedFunction () {
@ -51,21 +52,13 @@ function testSampleDebugSession () {
} }
const session = new inspector.Session() const session = new inspector.Session()
session.connect() session.connect()
let secondSessionOpened = false
const secondSession = new inspector.Session()
try {
secondSession.connect()
secondSessionOpened = true
} catch (error) {
// expected as the session already exists
}
session.on('Debugger.paused', session.on('Debugger.paused',
(notification) => debuggerPausedCallback(session, notification)) (notification) => debuggerPausedCallback(session, notification))
let cbAsSecondArgCalled = false let cbAsSecondArgCalled = false
session.post('Debugger.enable', () => { cbAsSecondArgCalled = true }) session.post('Debugger.enable', () => { cbAsSecondArgCalled = true })
session.post('Debugger.setBreakpointByUrl', { session.post('Debugger.setBreakpointByUrl', {
'lineNumber': 8, 'lineNumber': 9,
'url': path.resolve(__dirname, __filename), 'url': pathToFileURL(path.resolve(__dirname, __filename)).toString(),
'columnNumber': 0, 'columnNumber': 0,
'condition': '' 'condition': ''
}) })
@ -76,7 +69,6 @@ function testSampleDebugSession () {
process.send({ process.send({
'cmd': 'assert', 'cmd': 'assert',
'debuggerEnabled': cbAsSecondArgCalled, 'debuggerEnabled': cbAsSecondArgCalled,
'secondSessionOpened': secondSessionOpened,
'success': (cur === 5) && (failures.length === 0) 'success': (cur === 5) && (failures.length === 0)
}) })
} }

View file

@ -265,10 +265,9 @@ describe('node feature', () => {
stdio: ['ipc'] stdio: ['ipc']
}) })
child.on('message', ({ cmd, debuggerEnabled, secondSessionOpened, success }) => { child.on('message', ({ cmd, debuggerEnabled, success }) => {
if (cmd === 'assert') { if (cmd === 'assert') {
expect(debuggerEnabled).to.be.true() expect(debuggerEnabled).to.be.true()
expect(secondSessionOpened).to.be.true()
expect(success).to.be.true() expect(success).to.be.true()
done() done()
} }