Add basic test of spawned ELECTRON_RUN_AS_NODE process
This commit is contained in:
parent
b01fd9715b
commit
e899050500
2 changed files with 28 additions and 0 deletions
5
spec/fixtures/module/run-as-node.js
vendored
Normal file
5
spec/fixtures/module/run-as-node.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
processLog: typeof process.log,
|
||||||
|
processType: typeof process.type,
|
||||||
|
window: typeof window
|
||||||
|
}))
|
|
@ -92,6 +92,29 @@ describe('node feature', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('child_process.spawn', function () {
|
||||||
|
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')], {
|
||||||
|
env: {
|
||||||
|
ELECTRON_RUN_AS_NODE: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let output = ''
|
||||||
|
child.stdout.on('data', function (data) {
|
||||||
|
output += data
|
||||||
|
})
|
||||||
|
child.stdout.on('close', function () {
|
||||||
|
assert.deepEqual(JSON.parse(output), {
|
||||||
|
processLog: process.platform === 'win32' ? 'function' : 'undefined',
|
||||||
|
processType: 'undefined',
|
||||||
|
window: 'undefined'
|
||||||
|
})
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('contexts', function () {
|
describe('contexts', function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue