add basic inspector module test
This commit is contained in:
parent
ed4482d7a0
commit
0b88873e77
2 changed files with 128 additions and 18 deletions
|
@ -130,24 +130,6 @@ describe('node feature', () => {
|
|||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('supports starting the v8 inspector with --inspect/--inspect-brk', (done) => {
|
||||
child = ChildProcess.spawn(process.execPath, ['--inspect-brk', path.join(__dirname, 'fixtures', 'module', 'run-as-node.js')], {
|
||||
env: {
|
||||
ELECTRON_RUN_AS_NODE: true
|
||||
}
|
||||
})
|
||||
|
||||
let output = ''
|
||||
child.stderr.on('data', (data) => {
|
||||
output += data
|
||||
if (output.trim().startsWith('Debugger listening on ws://')) done()
|
||||
})
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
done(new Error(`Unexpected output: ${data.toString()}`))
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -218,6 +200,50 @@ describe('node feature', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('inspector', () => {
|
||||
let child
|
||||
|
||||
afterEach(() => {
|
||||
if (child != null) child.kill()
|
||||
})
|
||||
|
||||
it('supports starting the v8 inspector with --inspect/--inspect-brk', (done) => {
|
||||
child = ChildProcess.spawn(process.execPath, ['--inspect-brk', path.join(__dirname, 'fixtures', 'module', 'run-as-node.js')], {
|
||||
env: {
|
||||
ELECTRON_RUN_AS_NODE: true
|
||||
}
|
||||
})
|
||||
|
||||
let output = ''
|
||||
child.stderr.on('data', (data) => {
|
||||
output += data
|
||||
if (output.trim().startsWith('Debugger listening on ws://')) done()
|
||||
})
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
done(new Error(`Unexpected output: ${data.toString()}`))
|
||||
})
|
||||
})
|
||||
|
||||
it('supports js binding', (done) => {
|
||||
child = ChildProcess.spawn(process.execPath, ['--inspect', path.join(__dirname, 'fixtures', 'module', 'inspector-binding.js')], {
|
||||
env: {
|
||||
ELECTRON_RUN_AS_NODE: true
|
||||
},
|
||||
stdio: ['ipc']
|
||||
})
|
||||
|
||||
child.on('message', ({cmd, debuggerEnabled, secondSessionOpened, success}) => {
|
||||
if (cmd === 'assert') {
|
||||
assert.equal(debuggerEnabled, true)
|
||||
assert.equal(secondSessionOpened, false)
|
||||
assert.equal(success, true)
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('message loop', () => {
|
||||
describe('process.nextTick', () => {
|
||||
it('emits the callback', (done) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue