Add initial spec for ELECTRON_RUN_AS_NODE with --inspect-brk

This commit is contained in:
Kevin Sawicki 2017-06-12 14:04:57 -07:00
parent 538b97582a
commit fc00bf0cc3

View file

@ -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()}`))
})
})
})
})