Skip to content

Commit

Permalink
fix(browser): stop using all global vars when init
Browse files Browse the repository at this point in the history
  • Loading branch information
PaperStrike committed Sep 12, 2021
1 parent 4860738 commit c2290f0
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion browser-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,29 @@ global.mocha = mocha;
// this allows test/acceptance/required-tokens.js to pass; thus,
// you can now do `const describe = require('mocha').describe` in a
// browser context (assuming browserification). should fix #880
module.exports = Object.assign(mocha, global);
[
'Mocha',
'after',
'afterEach',
'before',
'beforeEach',
'context',
'describe',
'it',
'mocha',
'run',
'setup',
'specify',
'suite',
'suiteSetup',
'suiteTeardown',
'teardown',
'test',
'xcontext',
'xdescribe',
'xit',
'xspecify'
].forEach(function(key) {
mocha[key] = global[key];
});
module.exports = mocha;

0 comments on commit c2290f0

Please sign in to comment.