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

View file

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