Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using all global vars in browser entry #4746

Merged
merged 2 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.