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

Disable requiring mocha directly in browser environments #42

Merged
merged 1 commit into from
Feb 6, 2018

Conversation

wwilsman
Copy link
Contributor

@wwilsman wwilsman commented Feb 5, 2018

Purpose

The mocha entrypoint has not yet been optimized to work with browser bundles without first disabling certain node modules.

mochajs/mocha#2448

Approach

In a browser environment, mocha is usually included before the tests and has defined it's functions within the global context. Requiring mocha directly is now disabled in browser environments via the browser field in this package's package.json file.

Added a mocha.js file which imports all of mocha's exports, and defaults the relevant ones with the defined globals. Since mocha is now disabled for browsers, this will effectively export the globally defined mocha functions as named exports.

@wwilsman wwilsman requested a review from cowboyd February 5, 2018 01:17
@wwilsman wwilsman merged commit e284065 into master Feb 6, 2018
@wwilsman wwilsman deleted the ww/mocha-shim branch February 6, 2018 00:03
@cowboyd cowboyd mentioned this pull request Feb 21, 2020
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants