Skip to content

Commit

Permalink
fix(browser): stop using all global vars in 'browser-entry' (#4746)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaperStrike authored Sep 17, 2021
1 parent 27bfc74 commit 8421974
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
5 changes: 1 addition & 4 deletions browser-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,4 @@ Mocha.process = process;
global.Mocha = Mocha;
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);
module.exports = mocha;
4 changes: 2 additions & 2 deletions lib/cli/watch-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exports.watchParallelRun = (

// this `require` is needed because the require cache has been cleared. the dynamic
// exports set via the below call to `mocha.ui()` won't work properly if a
// test depends on this module (see `required-tokens.spec.js`).
// test depends on this module.
const Mocha = require('../mocha');

// ... and now that we've gotten a new module, we need to use it again due
Expand Down Expand Up @@ -108,7 +108,7 @@ exports.watchRun = (mocha, {watchFiles, watchIgnore}, fileCollectParams) => {

// this `require` is needed because the require cache has been cleared. the dynamic
// exports set via the below call to `mocha.ui()` won't work properly if a
// test depends on this module (see `required-tokens.spec.js`).
// test depends on this module.
const Mocha = require('../mocha');

// ... and now that we've gotten a new module, we need to use it again due
Expand Down
2 changes: 2 additions & 0 deletions test/browser-specific/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ global.expect = require('unexpected')
.use(require('unexpected-map'))
.use(require('unexpected-sinon'))
.use(require('unexpected-eventemitter'));

require('../../browser-entry');
12 changes: 0 additions & 12 deletions test/unit/required-tokens.spec.js

This file was deleted.

0 comments on commit 8421974

Please sign in to comment.