build: fix the build with enable_run_as_node disabled (#15711)

This commit is contained in:
Alexey Kuzmin 2019-01-11 17:02:06 +01:00 committed by Shelley Vohr
parent ca218b6395
commit 3cb9aadb80
5 changed files with 46 additions and 3 deletions

View file

@ -12,6 +12,8 @@ const remote = require('electron').remote
const { ipcMain, BrowserWindow } = remote
const features = process.atomBinding('features')
describe('asar package', function () {
const fixtures = path.join(__dirname, 'fixtures')
@ -844,6 +846,12 @@ describe('asar package', function () {
})
describe('child_process.fork', function () {
before(function () {
if (!features.isRunAsNodeEnabled()) {
this.skip()
}
})
it('opens a normal js file', function (done) {
const child = ChildProcess.fork(path.join(fixtures, 'asar', 'a.asar', 'ping.js'))
child.on('message', function (msg) {
@ -1040,6 +1048,12 @@ describe('asar package', function () {
})
describe('process.env.ELECTRON_NO_ASAR', function () {
before(function () {
if (!features.isRunAsNodeEnabled()) {
this.skip()
}
})
it('disables asar support in forked processes', function (done) {
const forked = ChildProcess.fork(path.join(__dirname, 'fixtures', 'module', 'no-asar.js'), [], {
env: {
@ -1205,6 +1219,11 @@ describe('asar package', function () {
})
it('is available in forked scripts', function (done) {
if (!features.isRunAsNodeEnabled()) {
this.skip()
done()
}
const child = ChildProcess.fork(path.join(fixtures, 'module', 'original-fs.js'))
child.on('message', function (msg) {
assert.strictEqual(msg, 'object')