mocha 8.0.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 8.0.1 / 2020-06-10
2
+
3
+ The obligatory patch after a major.
4
+
5
+ ## :bug: Fixes
6
+
7
+ - [#4328]: Fix `--parallel` when combined with `--watch` ([**@boneskull**](https://github.com/boneskull))
8
+
1
9
  # 8.0.0 / 2020-06-10
2
10
 
3
11
  In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below.
@@ -36,11 +36,33 @@ exports.watchParallelRun = (
36
36
  watchFiles,
37
37
  watchIgnore,
38
38
  beforeRun({mocha}) {
39
- mocha.files = collectFiles(fileCollectParams);
39
+ // I don't know why we're cloning the root suite.
40
+ const rootSuite = mocha.suite.clone();
41
+
42
+ // this `require` is needed because the require cache has been cleared. the dynamic
43
+ // exports set via the below call to `mocha.ui()` won't work properly if a
44
+ // test depends on this module (see `required-tokens.spec.js`).
45
+ const Mocha = require('../mocha');
46
+
47
+ // ... and now that we've gotten a new module, we need to use it again due
48
+ // to `mocha.ui()` call
49
+ const newMocha = new Mocha(mocha.options);
50
+ // don't know why this is needed
51
+ newMocha.suite = rootSuite;
52
+ // nor this
53
+ newMocha.suite.ctx = new Context();
54
+
55
+ // reset the list of files
56
+ newMocha.files = collectFiles(fileCollectParams);
57
+
58
+ // because we've swapped out the root suite (see the `run` inner function
59
+ // in `createRerunner`), we need to call `mocha.ui()` again to set up the context/globals.
60
+ newMocha.ui(newMocha.options.ui);
61
+
40
62
  // in parallel mode, the main Mocha process doesn't actually load the
41
63
  // files. this flag prevents `mocha.run()` from autoloading.
42
- mocha.lazyLoadFiles(true);
43
- return mocha;
64
+ newMocha.lazyLoadFiles(true);
65
+ return newMocha;
44
66
  },
45
67
  afterRun({watcher}) {
46
68
  blastCache(watcher);
package/mocha.js CHANGED
@@ -18390,7 +18390,7 @@ function hasOwnProperty(obj, prop) {
18390
18390
  },{"./support/isBuffer":88,"_process":67,"inherits":87}],90:[function(require,module,exports){
18391
18391
  module.exports={
18392
18392
  "name": "mocha",
18393
- "version": "8.0.0",
18393
+ "version": "8.0.1",
18394
18394
  "homepage": "https://mochajs.org/",
18395
18395
  "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
18396
18396
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "simple, flexible, fun test framework",
5
5
  "keywords": [
6
6
  "mocha",
@@ -81,7 +81,7 @@
81
81
  "@11ty/eleventy": "^0.10.0",
82
82
  "@11ty/eleventy-plugin-inclusive-language": "^1.0.0",
83
83
  "@mocha/docdash": "^2.1.3",
84
- "assetgraph-builder": "^8.0.0",
84
+ "assetgraph-builder": "^8.0.1",
85
85
  "autoprefixer": "^9.7.4",
86
86
  "babel-eslint": "^10.1.0",
87
87
  "browserify": "^16.5.0",