Add initial spec for ELECTRON_RUN_AS_NODE with --inspect-brk
This commit is contained in:
parent
538b97582a
commit
fc00bf0cc3
1 changed files with 30 additions and 1 deletions
|
@ -104,8 +104,16 @@ describe('node feature', function () {
|
|||
})
|
||||
|
||||
describe('child_process.spawn', function () {
|
||||
let child
|
||||
|
||||
afterEach(function () {
|
||||
if (child != null) {
|
||||
child.kill()
|
||||
}
|
||||
})
|
||||
|
||||
it('supports spawning Electron as a node process via the ELECTRON_RUN_AS_NODE env var', function (done) {
|
||||
const child = ChildProcess.spawn(process.execPath, [path.join(__dirname, 'fixtures', 'module', 'run-as-node.js')], {
|
||||
child = ChildProcess.spawn(process.execPath, [path.join(__dirname, 'fixtures', 'module', 'run-as-node.js')], {
|
||||
env: {
|
||||
ELECTRON_RUN_AS_NODE: true
|
||||
}
|
||||
|
@ -124,6 +132,27 @@ describe('node feature', function () {
|
|||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('supports starting the v8 inspector with --inspect/--inspect-brk', function (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', function (data) {
|
||||
output += data
|
||||
|
||||
if (output.trim().startsWith('Debugger listening on port')) {
|
||||
done()
|
||||
}
|
||||
})
|
||||
|
||||
child.stdout.on('data', function (data) {
|
||||
done(new Error(`Unexpected output: ${data.toString()}`))
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue