Skip to content

Commit ad03d29

Browse files
authored
build UMD bundle and polyfill language features (#4366)
- use rollup's `umd` bundle instead of `iife` - consume Rollup config's `output` prop in `karma-rollup-plugin` - simplify `rollup.config.js` `output` prop - fix invalid `script` tag `src` attrib in `lib/browser/template.html` (& reformat) - use core-js polyfills - remove old ESlint rule to disallow `Object.assign` (it's now allowed... but so is object rest/spread, which works in many cases) - fix travis script - karma-related: - update Symbol test for IE11, as the polyfill is just a polyfill. - add a proper RequireJS integration test - remove the old `bundle/amd.spec.js` test - try to make `karma.conf.js` less intimidating - allow custom externals/globals in karma rollup plugin - `unexpected`, `unexpected-eventemitter`, and `unexpected-sinon` are now external (not bundled) and loaded via their globals - modified `test/browser-specific/setup.js` to use `require()` since we can do that now - bundle now has an inline source map since I couldn't figure out any other way to load it - removed duplication of work in the karma plugin; no call to `bundle.generate()` is needed. furthermore the `code` prop did not include the inline source maps. so we just write the file and read the result. could probably avoid reading the file by manually stitching the `code` and `map` props together, but I'm unsure how - loads `mocha.js.map` for debugging
1 parent 02bdb6b commit ad03d29

16 files changed

+546
-335
lines changed

.eslintrc.yml

-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ rules:
1515
strict:
1616
- error
1717
- safe
18-
# disallow Object.assign
19-
no-restricted-properties:
20-
- error
21-
- object: 'Object'
22-
property: 'assign'
2318
overrides:
2419
- files:
2520
- 'docs/js/**/*.js'

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
node_js: '10'
5050
name: 'Node.js v10'
5151

52-
- script: npm start test.bundle test.browser
52+
- script: npm start test.browser
5353
name: 'Browser'
5454
node_js: 12
5555
install: npm ci # we need the native modules here

browser-entry.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ Mocha.process = process;
210210
* Expose mocha.
211211
*/
212212

213-
global.Mocha = Mocha;
214-
global.mocha = mocha;
213+
mocha.Mocha = Mocha;
214+
mocha.mocha = mocha;
215215

216216
// this allows test/acceptance/required-tokens.js to pass; thus,
217217
// you can now do `const describe = require('mocha').describe` in a
218218
// browser context (assuming browserification). should fix #880
219-
module.exports = global;
219+
module.exports = Object.assign(mocha, global);

0 commit comments

Comments
 (0)