Skip to content

Commit

Permalink
spec: update inspector-binding.js
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Nov 29, 2018
1 parent d842cfd commit 1e7c765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 3 additions & 11 deletions spec/fixtures/module/inspector-binding.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down Expand Up @@ -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': ''
})
Expand All @@ -76,7 +69,6 @@ function testSampleDebugSession () {
process.send({
'cmd': 'assert',
'debuggerEnabled': cbAsSecondArgCalled,
'secondSessionOpened': secondSessionOpened,
'success': (cur === 5) && (failures.length === 0)
})
}
Expand Down
3 changes: 1 addition & 2 deletions spec/node-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 1e7c765

Please sign in to comment.