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

@ -5,6 +5,7 @@ const fs = require('fs')
const { remote } = require('electron')
const { BrowserWindow } = remote
const { closeWindow } = require('./window-helpers')
const features = process.atomBinding('features')
const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled')
@ -17,7 +18,12 @@ describe('modules support', () => {
require('runas')
})
it('can be required in node binary', (done) => {
it('can be required in node binary', function (done) {
if (!features.isRunAsNodeEnabled()) {
this.skip()
done()
}
const runas = path.join(fixtures, 'module', 'runas.js')
const child = require('child_process').fork(runas)
child.on('message', (msg) => {