mocha 8.2.1 → 8.4.0
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 +62 -0
- package/LICENSE +1 -1
- package/README.md +22 -59
- package/bin/mocha +0 -3
- package/lib/browser/growl.js +1 -1
- package/lib/cli/collect-files.js +25 -25
- package/lib/cli/config.js +6 -3
- package/lib/cli/options.js +7 -2
- package/lib/cli/watch-run.js +15 -11
- package/lib/errors.js +112 -5
- package/lib/esm-utils.js +23 -1
- package/lib/interfaces/bdd.js +0 -7
- package/lib/interfaces/common.js +0 -9
- package/lib/interfaces/qunit.js +0 -1
- package/lib/interfaces/tdd.js +0 -1
- package/lib/mocha.js +61 -19
- package/lib/runnable.js +7 -8
- package/lib/utils.js +3 -0
- package/mocha.js +1057 -677
- package/mocha.js.map +1 -1
- package/package.json +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
+
# 8.4.0 / 2021-05-07
|
|
2
|
+
|
|
3
|
+
## :tada: Enhancements
|
|
4
|
+
|
|
5
|
+
- [#4502](https://github.com/mochajs/mocha/issues/4502): CLI file parsing errors now have error codes ([**@evaline-ju**](https://github.com/evaline-ju))
|
|
6
|
+
|
|
7
|
+
## :bug: Fixes
|
|
8
|
+
|
|
9
|
+
- [#4614](https://github.com/mochajs/mocha/issues/4614): Watch: fix crash when reloading files ([**@outsideris**](https://github.com/outsideris))
|
|
10
|
+
|
|
11
|
+
## :book: Documentation
|
|
12
|
+
|
|
13
|
+
- [#4630](https://github.com/mochajs/mocha/issues/4630): Add `options.require` to Mocha constructor for `root hook` plugins on parallel runs ([**@juergba**](https://github.com/juergba))
|
|
14
|
+
- [#4617](https://github.com/mochajs/mocha/issues/4617): Dynamically generating tests with `top-level await` and ESM test files ([**@juergba**](https://github.com/juergba))
|
|
15
|
+
- [#4608](https://github.com/mochajs/mocha/issues/4608): Update default file extensions ([**@outsideris**](https://github.com/outsideris))
|
|
16
|
+
|
|
17
|
+
Also thanks to [**@outsideris**](https://github.com/outsideris) for various improvements on our GH actions workflows.
|
|
18
|
+
|
|
19
|
+
# 8.3.2 / 2021-03-12
|
|
20
|
+
|
|
21
|
+
## :bug: Fixes
|
|
22
|
+
|
|
23
|
+
- [#4599](https://github.com/mochajs/mocha/issues/4599): Fix regression in `require` interface ([**@alexander-fenster**](https://github.com/alexander-fenster))
|
|
24
|
+
|
|
25
|
+
## :book: Documentation
|
|
26
|
+
|
|
27
|
+
- [#4601](https://github.com/mochajs/mocha/issues/4601): Add build to GH actions run ([**@christian-bromann**](https://github.com/christian-bromann))
|
|
28
|
+
- [#4596](https://github.com/mochajs/mocha/issues/4596): Filter active sponsors/backers ([**@juergba**](https://github.com/juergba))
|
|
29
|
+
- [#4225](https://github.com/mochajs/mocha/issues/4225): Update config file examples ([**@pkuczynski**](https://github.com/pkuczynski))
|
|
30
|
+
|
|
31
|
+
# 8.3.1 / 2021-03-06
|
|
32
|
+
|
|
33
|
+
## :bug: Fixes
|
|
34
|
+
|
|
35
|
+
- [#4577](https://github.com/mochajs/mocha/issues/4577): Browser: fix `EvalError` caused by regenerator-runtime ([**@snoack**](https://github.com/snoack))
|
|
36
|
+
- [#4574](https://github.com/mochajs/mocha/issues/4574): ESM: allow `import` from mocha in parallel mode ([**@nicojs**](https://github.com/nicojs))
|
|
37
|
+
|
|
38
|
+
# 8.3.0 / 2021-02-11
|
|
39
|
+
|
|
40
|
+
## :tada: Enhancements
|
|
41
|
+
|
|
42
|
+
- [#4506](https://github.com/mochajs/mocha/issues/4506): Add error code for test timeout errors ([**@boneskull**](https://github.com/boneskull))
|
|
43
|
+
- [#4112](https://github.com/mochajs/mocha/issues/4112): Add BigInt support to stringify util function ([**@JosejeSinohui**](https://github.com/JosejeSinohui))
|
|
44
|
+
|
|
45
|
+
## :bug: Fixes
|
|
46
|
+
|
|
47
|
+
- [#4557](https://github.com/mochajs/mocha/issues/4557): Add file location when SyntaxError happens in ESM ([**@giltayar**](https://github.com/giltayar))
|
|
48
|
+
- [#4521](https://github.com/mochajs/mocha/issues/4521): Fix `require` error when bundling Mocha with Webpack ([**@devhazem**](https://github.com/devhazem))
|
|
49
|
+
|
|
50
|
+
## :book: Documentation
|
|
51
|
+
|
|
52
|
+
- [#4507](https://github.com/mochajs/mocha/issues/4507): Add support for typescript-style docstrings ([**@boneskull**](https://github.com/boneskull))
|
|
53
|
+
- [#4503](https://github.com/mochajs/mocha/issues/4503): Add GH Actions workflow status badge ([**@outsideris**](https://github.com/outsideris))
|
|
54
|
+
- [#4494](https://github.com/mochajs/mocha/issues/4494): Add example of generating tests dynamically with a closure ([**@maxwellgerber**](https://github.com/maxwellgerber))
|
|
55
|
+
|
|
56
|
+
## :nut_and_bolt: Other
|
|
57
|
+
|
|
58
|
+
- [#4556](https://github.com/mochajs/mocha/issues/4556): Upgrade all dependencies to latest stable ([**@AviVahl**](https://github.com/AviVahl))
|
|
59
|
+
- [#4543](https://github.com/mochajs/mocha/issues/4543): Update dependencies yargs and yargs-parser ([**@juergba**](https://github.com/juergba))
|
|
60
|
+
|
|
61
|
+
Also thanks to [**@outsideris**](https://github.com/outsideris) and [**@HyunSangHan**](https://github.com/HyunSangHan) for various fixes to our website and documentation.
|
|
62
|
+
|
|
1
63
|
# 8.2.1 / 2020-11-02
|
|
2
64
|
|
|
3
65
|
Fixed stuff.
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(The MIT License)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2011-
|
|
3
|
+
Copyright (c) 2011-2021 OpenJS Foundation and contributors, https://openjsf.org
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -4,10 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
<p align="center">☕️ Simple, flexible, fun JavaScript test framework for Node.js & The Browser ☕️</p>
|
|
6
6
|
|
|
7
|
-
<p align="center"
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/mochajs/mocha/actions?query=workflow%3ATests+branch%3Amaster"><img src="https://github.com/mochajs/mocha/workflows/Tests/badge.svg?branch=master" alt="GitHub Actions Build Status"></a>
|
|
9
|
+
<a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a>
|
|
10
|
+
<a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_shield"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=shield" alt="FOSSA Status"></a>
|
|
11
|
+
<a href="https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter"></a>
|
|
12
|
+
<a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/tiers/sponsors/badge.svg" alt="OpenCollective"></a>
|
|
13
|
+
<a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/tiers/backers/badge.svg" alt="OpenCollective"></a>
|
|
8
14
|
</p>
|
|
9
15
|
|
|
10
|
-
<p align="center"
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://www.npmjs.com/package/mocha"><img src="https://img.shields.io/npm/v/mocha.svg" alt="NPM Version"></a>
|
|
18
|
+
<a href="https://github.com/mochajs/mocha"><img src="https://img.shields.io/node/v/mocha.svg" alt="Node Version"></a>
|
|
19
|
+
</p>
|
|
11
20
|
|
|
12
21
|
<p align="center"><br><img alt="Mocha Browser Support h/t SauceLabs" src="https://saucelabs.com/browser-matrix/mochajs.svg" width="354"></p>
|
|
13
22
|
|
|
@@ -18,74 +27,28 @@
|
|
|
18
27
|
- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md)
|
|
19
28
|
- [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md)
|
|
20
29
|
- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!)
|
|
21
|
-
- [Google Group](https://groups.google.com/group/mochajs)
|
|
22
30
|
- [Issue Tracker](https://github.com/mochajs/mocha/issues)
|
|
23
31
|
|
|
24
32
|
## Backers
|
|
25
33
|
|
|
26
|
-
[Become a backer](https://opencollective.com/mochajs
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
[](https://opencollective.com/mochajs/backer/1/website)
|
|
30
|
-
[](https://opencollective.com/mochajs/backer/2/website)
|
|
31
|
-
[](https://opencollective.com/mochajs/backer/3/website)
|
|
32
|
-
[](https://opencollective.com/mochajs/backer/4/website)
|
|
33
|
-
[](https://opencollective.com/mochajs/backer/5/website)
|
|
34
|
-
[](https://opencollective.com/mochajs/backer/6/website)
|
|
35
|
-
[](https://opencollective.com/mochajs/backer/7/website)
|
|
36
|
-
[](https://opencollective.com/mochajs/backer/8/website)
|
|
37
|
-
[](https://opencollective.com/mochajs/backer/9/website)
|
|
38
|
-
[](https://opencollective.com/mochajs/backer/10/website)
|
|
39
|
-
[](https://opencollective.com/mochajs/backer/11/website)
|
|
40
|
-
[](https://opencollective.com/mochajs/backer/12/website)
|
|
41
|
-
[](https://opencollective.com/mochajs/backer/13/website)
|
|
42
|
-
[](https://opencollective.com/mochajs/backer/14/website)
|
|
43
|
-
[](https://opencollective.com/mochajs/backer/15/website)
|
|
44
|
-
[](https://opencollective.com/mochajs/backer/16/website)
|
|
45
|
-
[](https://opencollective.com/mochajs/backer/17/website)
|
|
46
|
-
[](https://opencollective.com/mochajs/backer/18/website)
|
|
47
|
-
[](https://opencollective.com/mochajs/backer/19/website)
|
|
48
|
-
[](https://opencollective.com/mochajs/backer/20/website)
|
|
49
|
-
[](https://opencollective.com/mochajs/backer/21/website)
|
|
50
|
-
[](https://opencollective.com/mochajs/backer/22/website)
|
|
51
|
-
[](https://opencollective.com/mochajs/backer/23/website)
|
|
52
|
-
[](https://opencollective.com/mochajs/backer/24/website)
|
|
53
|
-
[](https://opencollective.com/mochajs/backer/25/website)
|
|
54
|
-
[](https://opencollective.com/mochajs/backer/26/website)
|
|
55
|
-
[](https://opencollective.com/mochajs/backer/27/website)
|
|
56
|
-
[](https://opencollective.com/mochajs/backer/28/website)
|
|
57
|
-
[](https://opencollective.com/mochajs/backer/29/website)
|
|
34
|
+
[Become a backer](https://opencollective.com/mochajs) and show your support to our open source project on [our site](https://mochajs.org/#backers).
|
|
35
|
+
|
|
36
|
+
<a href="https://opencollective.com/mochajs"><img src="https://opencollective.com/mochajs/tiers/backers.svg?limit=30&button=false&avatarHeight=46&width=750"></a>
|
|
58
37
|
|
|
59
38
|
## Sponsors
|
|
60
39
|
|
|
61
|
-
Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs
|
|
62
|
-
|
|
63
|
-
[](https://opencollective.com/mochajs/sponsor/4/website)
|
|
68
|
-
[](https://opencollective.com/mochajs/sponsor/5/website)
|
|
69
|
-
[](https://opencollective.com/mochajs/sponsor/6/website)
|
|
70
|
-
[](https://opencollective.com/mochajs/sponsor/7/website)
|
|
71
|
-
[](https://opencollective.com/mochajs/sponsor/8/website)
|
|
72
|
-
[](https://opencollective.com/mochajs/sponsor/9/website)
|
|
73
|
-
[](https://opencollective.com/mochajs/sponsor/10/website)
|
|
74
|
-
[](https://opencollective.com/mochajs/sponsor/11/website)
|
|
75
|
-
[](https://opencollective.com/mochajs/sponsor/12/website)
|
|
76
|
-
[](https://opencollective.com/mochajs/sponsor/13/website)
|
|
77
|
-
[](https://opencollective.com/mochajs/sponsor/14/website)
|
|
78
|
-
[](https://opencollective.com/mochajs/sponsor/15/website)
|
|
79
|
-
[](https://opencollective.com/mochajs/sponsor/16/website)
|
|
80
|
-
[](https://opencollective.com/mochajs/sponsor/17/website)
|
|
81
|
-
[](https://opencollective.com/mochajs/sponsor/18/website)
|
|
82
|
-
[](https://opencollective.com/mochajs/sponsor/19/website)
|
|
40
|
+
Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org#sponsors) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs).
|
|
41
|
+
|
|
42
|
+
[](https://opencollective.com/mochajs/tiers/sponsors/0/website)
|
|
43
|
+
[](https://opencollective.com/mochajs/tiers/sponsors/1/website)
|
|
44
|
+
[](https://opencollective.com/mochajs/tiers/sponsors/2/website)
|
|
45
|
+
[](https://opencollective.com/mochajs/tiers/sponsors/3/website)
|
|
83
46
|
|
|
84
47
|
## Development
|
|
85
48
|
|
|
86
49
|
You might want to know that:
|
|
87
50
|
|
|
88
|
-
- Mocha is the _most-depended-upon_
|
|
51
|
+
- Mocha is one of the _most-depended-upon_ modules on npm (source: [libraries.io](https://libraries.io/search?order=desc&platforms=NPM&sort=dependents_count)), and
|
|
89
52
|
- Mocha is an _independent_ open-source project, maintained exclusively by volunteers.
|
|
90
53
|
|
|
91
54
|
You might want to help:
|
|
@@ -102,6 +65,6 @@ Finally, come [chat with the maintainers](https://gitter.im/mochajs/contributors
|
|
|
102
65
|
|
|
103
66
|
## License
|
|
104
67
|
|
|
105
|
-
Copyright 2011-
|
|
68
|
+
Copyright 2011-2021 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE).
|
|
106
69
|
|
|
107
70
|
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large)
|
package/bin/mocha
CHANGED
|
@@ -36,8 +36,6 @@ const disableTimeouts = value => {
|
|
|
36
36
|
if (impliesNoTimeouts(value)) {
|
|
37
37
|
debug('option %s disabled timeouts', value);
|
|
38
38
|
mochaArgs.timeout = 0;
|
|
39
|
-
delete mochaArgs.timeouts;
|
|
40
|
-
delete mochaArgs.t;
|
|
41
39
|
}
|
|
42
40
|
};
|
|
43
41
|
|
|
@@ -93,7 +91,6 @@ if (mochaArgs.require && mochaArgs.require.includes('esm')) {
|
|
|
93
91
|
if (!mochaArgs.require.length) {
|
|
94
92
|
delete mochaArgs.require;
|
|
95
93
|
}
|
|
96
|
-
delete mochaArgs.r;
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
if (Object.keys(nodeArgs).length) {
|
package/lib/browser/growl.js
CHANGED
package/lib/cli/collect-files.js
CHANGED
|
@@ -6,6 +6,7 @@ const debug = require('debug')('mocha:cli:run:helpers');
|
|
|
6
6
|
const minimatch = require('minimatch');
|
|
7
7
|
const {NO_FILES_MATCH_PATTERN} = require('../errors').constants;
|
|
8
8
|
const lookupFiles = require('./lookup-files');
|
|
9
|
+
const {castArray} = require('../utils');
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Exports a function that collects test files from CLI parameters.
|
|
@@ -21,45 +22,44 @@ const lookupFiles = require('./lookup-files');
|
|
|
21
22
|
* @returns {string[]} List of files to test
|
|
22
23
|
* @private
|
|
23
24
|
*/
|
|
24
|
-
module.exports = ({
|
|
25
|
-
|
|
25
|
+
module.exports = ({
|
|
26
|
+
ignore,
|
|
27
|
+
extension,
|
|
28
|
+
file: fileArgs,
|
|
29
|
+
recursive,
|
|
30
|
+
sort,
|
|
31
|
+
spec
|
|
32
|
+
} = {}) => {
|
|
26
33
|
const unmatched = [];
|
|
27
|
-
spec.
|
|
28
|
-
let newFiles;
|
|
34
|
+
const specFiles = spec.reduce((specFiles, arg) => {
|
|
29
35
|
try {
|
|
30
|
-
|
|
36
|
+
const moreSpecFiles = castArray(lookupFiles(arg, extension, recursive))
|
|
37
|
+
.filter(filename =>
|
|
38
|
+
ignore.every(pattern => !minimatch(filename, pattern))
|
|
39
|
+
)
|
|
40
|
+
.map(filename => path.resolve(filename));
|
|
41
|
+
return [...specFiles, ...moreSpecFiles];
|
|
31
42
|
} catch (err) {
|
|
32
43
|
if (err.code === NO_FILES_MATCH_PATTERN) {
|
|
33
44
|
unmatched.push({message: err.message, pattern: err.pattern});
|
|
34
|
-
return;
|
|
45
|
+
return specFiles;
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
throw err;
|
|
38
49
|
}
|
|
39
|
-
|
|
40
|
-
if (typeof newFiles !== 'undefined') {
|
|
41
|
-
if (typeof newFiles === 'string') {
|
|
42
|
-
newFiles = [newFiles];
|
|
43
|
-
}
|
|
44
|
-
newFiles = newFiles.filter(fileName =>
|
|
45
|
-
ignore.every(pattern => !minimatch(fileName, pattern))
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
files = files.concat(newFiles);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const fileArgs = file.map(filepath => path.resolve(filepath));
|
|
53
|
-
files = files.map(filepath => path.resolve(filepath));
|
|
50
|
+
}, []);
|
|
54
51
|
|
|
55
52
|
// ensure we don't sort the stuff from fileArgs; order is important!
|
|
56
53
|
if (sort) {
|
|
57
|
-
|
|
54
|
+
specFiles.sort();
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
// add files given through --file to be ran first
|
|
61
|
-
files =
|
|
62
|
-
|
|
58
|
+
const files = [
|
|
59
|
+
...fileArgs.map(filepath => path.resolve(filepath)),
|
|
60
|
+
...specFiles
|
|
61
|
+
];
|
|
62
|
+
debug('test files (in order): ', files);
|
|
63
63
|
|
|
64
64
|
if (!files.length) {
|
|
65
65
|
// give full message details when only 1 file is missing
|
|
@@ -70,7 +70,7 @@ module.exports = ({ignore, extension, file, recursive, sort, spec} = {}) => {
|
|
|
70
70
|
console.error(ansi.red(noneFoundMsg));
|
|
71
71
|
process.exit(1);
|
|
72
72
|
} else {
|
|
73
|
-
// print messages as
|
|
73
|
+
// print messages as a warning
|
|
74
74
|
unmatched.forEach(warning => {
|
|
75
75
|
console.warn(ansi.yellow(`Warning: ${warning.message}`));
|
|
76
76
|
});
|
package/lib/cli/config.js
CHANGED
|
@@ -11,6 +11,7 @@ const fs = require('fs');
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
const debug = require('debug')('mocha:cli:config');
|
|
13
13
|
const findUp = require('find-up');
|
|
14
|
+
const {createUnparsableFileError} = require('../errors');
|
|
14
15
|
const utils = require('../utils');
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -38,8 +39,7 @@ const isModuleNotFoundError = err =>
|
|
|
38
39
|
* returns an object (but could throw)
|
|
39
40
|
*/
|
|
40
41
|
const parsers = (exports.parsers = {
|
|
41
|
-
yaml: filepath =>
|
|
42
|
-
require('js-yaml').safeLoad(fs.readFileSync(filepath, 'utf8')),
|
|
42
|
+
yaml: filepath => require('js-yaml').load(fs.readFileSync(filepath, 'utf8')),
|
|
43
43
|
js: filepath => {
|
|
44
44
|
const cwdFilepath = path.resolve(filepath);
|
|
45
45
|
try {
|
|
@@ -82,7 +82,10 @@ exports.loadConfig = filepath => {
|
|
|
82
82
|
config = parsers.json(filepath);
|
|
83
83
|
}
|
|
84
84
|
} catch (err) {
|
|
85
|
-
throw
|
|
85
|
+
throw createUnparsableFileError(
|
|
86
|
+
`Unable to read/parse ${filepath}: ${err}`,
|
|
87
|
+
filepath
|
|
88
|
+
);
|
|
86
89
|
}
|
|
87
90
|
return config;
|
|
88
91
|
};
|
package/lib/cli/options.js
CHANGED
|
@@ -18,6 +18,7 @@ const {loadConfig, findConfig} = require('./config');
|
|
|
18
18
|
const findUp = require('find-up');
|
|
19
19
|
const debug = require('debug')('mocha:cli:options');
|
|
20
20
|
const {isNodeFlag} = require('./node-flags');
|
|
21
|
+
const {createUnparsableFileError} = require('../errors');
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* The `yargs-parser` namespace
|
|
@@ -38,7 +39,8 @@ const {isNodeFlag} = require('./node-flags');
|
|
|
38
39
|
const YARGS_PARSER_CONFIG = {
|
|
39
40
|
'combine-arrays': true,
|
|
40
41
|
'short-option-groups': false,
|
|
41
|
-
'dot-notation': false
|
|
42
|
+
'dot-notation': false,
|
|
43
|
+
'strip-aliased': true
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
/**
|
|
@@ -189,7 +191,10 @@ const loadPkgRc = (args = {}) => {
|
|
|
189
191
|
}
|
|
190
192
|
} catch (err) {
|
|
191
193
|
if (args.package) {
|
|
192
|
-
throw
|
|
194
|
+
throw createUnparsableFileError(
|
|
195
|
+
`Unable to read/parse ${filepath}: ${err}`,
|
|
196
|
+
filepath
|
|
197
|
+
);
|
|
193
198
|
}
|
|
194
199
|
debug('failed to read default package.json at %s; ignoring', filepath);
|
|
195
200
|
}
|
package/lib/cli/watch-run.js
CHANGED
|
@@ -261,17 +261,21 @@ const createRerunner = (mocha, watcher, {beforeRun} = {}) => {
|
|
|
261
261
|
let rerunScheduled = false;
|
|
262
262
|
|
|
263
263
|
const run = () => {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
264
|
+
try {
|
|
265
|
+
mocha = beforeRun ? beforeRun({mocha, watcher}) || mocha : mocha;
|
|
266
|
+
runner = mocha.run(() => {
|
|
267
|
+
debug('finished watch run');
|
|
268
|
+
runner = null;
|
|
269
|
+
blastCache(watcher);
|
|
270
|
+
if (rerunScheduled) {
|
|
271
|
+
rerun();
|
|
272
|
+
} else {
|
|
273
|
+
console.error(`${logSymbols.info} [mocha] waiting for changes...`);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
} catch (e) {
|
|
277
|
+
console.error(e.stack);
|
|
278
|
+
}
|
|
275
279
|
};
|
|
276
280
|
|
|
277
281
|
const scheduleRun = () => {
|