Skip to content

Commit

Permalink
Merge pull request electron#8539 from electron/require-wrapper
Browse files Browse the repository at this point in the history
Update require wrapper to allow redefinition of process and global
  • Loading branch information
kevinsawicki authored Jan 30, 2017
2 parents 6e2f977 + 94cb605 commit 37eebb1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions spec/fixtures/module/declare-global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const global = 'declared global'
module.exports = global
2 changes: 2 additions & 0 deletions spec/fixtures/module/declare-process.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const process = 'declared process'
module.exports = process
14 changes: 14 additions & 0 deletions spec/modules-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ describe('third-party module', function () {
})
})
})

describe('global variables', function () {
describe('process', function () {
it('can be declared in a module', function () {
assert.strictEqual(require('./fixtures/module/declare-process'), 'declared process')
})
})

describe('global', function () {
it('can be declared in a module', function () {
assert.strictEqual(require('./fixtures/module/declare-global'), 'declared global')
})
})
})
})

describe('Module._nodeModulePaths', function () {
Expand Down
2 changes: 1 addition & 1 deletion vendor/node

0 comments on commit 37eebb1

Please sign in to comment.