-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from thefrontside/ww/mocha-shim
Disable requiring mocha directly in browser environments
- Loading branch information
Showing
3 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// This file exports any globally defined mocha functions, otherwise | ||
// it exports them from the mocha module directly. | ||
// | ||
// 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 currently disabled in browser | ||
// environments via the `browser` field in this package's | ||
// `package.json` file. This is because the mocha entrypoint has not | ||
// yet been optimized to work with browser bundles without first | ||
// disabling certain node modules. | ||
// | ||
// @see https://github.com/mochajs/mocha/issues/2448 | ||
|
||
import * as mocha from 'mocha'; | ||
|
||
let { | ||
describe = global.describe, | ||
before = global.before, | ||
beforeEach = global.beforeEach, | ||
after = global.before, | ||
afterEach = global.afterEach, | ||
it = global.it | ||
} = mocha; | ||
|
||
export { | ||
describe, | ||
before, | ||
beforeEach, | ||
after, | ||
afterEach, | ||
it | ||
}; |