Add basic test of spawned ELECTRON_RUN_AS_NODE process
This commit is contained in:
Родитель
b01fd9715b
Коммит
e899050500
|
@ -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 () {
|
||||
|
|
Загрузка…
Ссылка в новой задаче