mocha 6.1.0 → 6.1.4
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 +1776 -1751
- package/LICENSE +22 -22
- package/README.md +105 -105
- package/bin/_mocha +10 -10
- package/bin/mocha +149 -149
- package/bin/options.js +10 -10
- package/browser-entry.js +191 -191
- package/index.js +3 -3
- package/lib/browser/growl.js +168 -168
- package/lib/browser/progress.js +119 -119
- package/lib/browser/template.html +18 -18
- package/lib/browser/tty.js +13 -13
- package/lib/cli/cli.js +69 -69
- package/lib/cli/commands.js +13 -13
- package/lib/cli/config.js +101 -101
- package/lib/cli/index.js +9 -9
- package/lib/cli/init.js +37 -37
- package/lib/cli/node-flags.js +86 -86
- package/lib/cli/one-and-dones.js +70 -70
- package/lib/cli/options.js +347 -347
- package/lib/cli/run-helpers.js +337 -337
- package/lib/cli/run-option-metadata.js +76 -76
- package/lib/cli/run.js +297 -297
- package/lib/context.js +101 -101
- package/lib/errors.js +141 -141
- package/lib/growl.js +136 -136
- package/lib/hook.js +46 -46
- package/lib/interfaces/bdd.js +118 -118
- package/lib/interfaces/common.js +191 -191
- package/lib/interfaces/exports.js +60 -60
- package/lib/interfaces/index.js +6 -6
- package/lib/interfaces/qunit.js +99 -99
- package/lib/interfaces/tdd.js +107 -107
- package/lib/mocha.js +843 -843
- package/lib/mocharc.json +10 -10
- package/lib/pending.js +12 -12
- package/lib/reporters/base.js +491 -491
- package/lib/reporters/doc.js +85 -85
- package/lib/reporters/dot.js +81 -81
- package/lib/reporters/html.js +390 -390
- package/lib/reporters/index.js +19 -19
- package/lib/reporters/json-stream.js +90 -90
- package/lib/reporters/json.js +135 -135
- package/lib/reporters/landing.js +108 -108
- package/lib/reporters/list.js +78 -78
- package/lib/reporters/markdown.js +112 -112
- package/lib/reporters/min.js +52 -52
- package/lib/reporters/nyan.js +276 -276
- package/lib/reporters/progress.js +104 -104
- package/lib/reporters/spec.js +99 -99
- package/lib/reporters/tap.js +294 -294
- package/lib/reporters/xunit.js +216 -216
- package/lib/runnable.js +496 -496
- package/lib/runner.js +1049 -1049
- package/lib/stats-collector.js +83 -83
- package/lib/suite.js +642 -642
- package/lib/test.js +51 -51
- package/lib/utils.js +897 -897
- package/mocha.css +326 -326
- package/mocha.js +8170 -8476
- package/package.json +630 -628
package/LICENSE
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2011-2018 JS Foundation and contributors, https://js.foundation
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
'Software'), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011-2018 JS Foundation and contributors, https://js.foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework"/>
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<p align="center">:coffee: Simple, flexible, fun JavaScript test framework for Node.js & The Browser :coffee:</p>
|
|
6
|
-
|
|
7
|
-
<p align="center"><a href="http://travis-ci.org/mochajs/mocha"><img src="https://api.travis-ci.org/mochajs/mocha.svg?branch=master" alt="Build Status"></a> <a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a> <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> <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> <a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/backers/badge.svg" alt="OpenCollective"></a> <a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/sponsors/badge.svg" alt="OpenCollective"></a>
|
|
8
|
-
</p>
|
|
9
|
-
|
|
10
|
-
<p align="center"><br><img alt="Mocha Browser Support h/t SauceLabs" src="https://saucelabs.com/browser-matrix/mochajs.svg" width="354"></p>
|
|
11
|
-
|
|
12
|
-
## Links
|
|
13
|
-
|
|
14
|
-
- **[Documentation](https://mochajs.org/)**
|
|
15
|
-
- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)**
|
|
16
|
-
- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md)
|
|
17
|
-
- [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md)
|
|
18
|
-
- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!)
|
|
19
|
-
- [Google Group](https://groups.google.com/group/mochajs)
|
|
20
|
-
- [Issue Tracker](https://github.com/mochajs/mocha/issues)
|
|
21
|
-
|
|
22
|
-
## Backers
|
|
23
|
-
|
|
24
|
-
[Become a backer](https://opencollective.com/mochajs#backer) and show your support to our open source project.
|
|
25
|
-
|
|
26
|
-
[](https://opencollective.com/mochajs/backer/0/website)
|
|
27
|
-
[](https://opencollective.com/mochajs/backer/1/website)
|
|
28
|
-
[](https://opencollective.com/mochajs/backer/2/website)
|
|
29
|
-
[](https://opencollective.com/mochajs/backer/3/website)
|
|
30
|
-
[](https://opencollective.com/mochajs/backer/4/website)
|
|
31
|
-
[](https://opencollective.com/mochajs/backer/5/website)
|
|
32
|
-
[](https://opencollective.com/mochajs/backer/6/website)
|
|
33
|
-
[](https://opencollective.com/mochajs/backer/7/website)
|
|
34
|
-
[](https://opencollective.com/mochajs/backer/8/website)
|
|
35
|
-
[](https://opencollective.com/mochajs/backer/9/website)
|
|
36
|
-
[](https://opencollective.com/mochajs/backer/10/website)
|
|
37
|
-
[](https://opencollective.com/mochajs/backer/11/website)
|
|
38
|
-
[](https://opencollective.com/mochajs/backer/12/website)
|
|
39
|
-
[](https://opencollective.com/mochajs/backer/13/website)
|
|
40
|
-
[](https://opencollective.com/mochajs/backer/14/website)
|
|
41
|
-
[](https://opencollective.com/mochajs/backer/15/website)
|
|
42
|
-
[](https://opencollective.com/mochajs/backer/16/website)
|
|
43
|
-
[](https://opencollective.com/mochajs/backer/17/website)
|
|
44
|
-
[](https://opencollective.com/mochajs/backer/18/website)
|
|
45
|
-
[](https://opencollective.com/mochajs/backer/19/website)
|
|
46
|
-
[](https://opencollective.com/mochajs/backer/20/website)
|
|
47
|
-
[](https://opencollective.com/mochajs/backer/21/website)
|
|
48
|
-
[](https://opencollective.com/mochajs/backer/22/website)
|
|
49
|
-
[](https://opencollective.com/mochajs/backer/23/website)
|
|
50
|
-
[](https://opencollective.com/mochajs/backer/24/website)
|
|
51
|
-
[](https://opencollective.com/mochajs/backer/25/website)
|
|
52
|
-
[](https://opencollective.com/mochajs/backer/26/website)
|
|
53
|
-
[](https://opencollective.com/mochajs/backer/27/website)
|
|
54
|
-
[](https://opencollective.com/mochajs/backer/28/website)
|
|
55
|
-
[](https://opencollective.com/mochajs/backer/29/website)
|
|
56
|
-
|
|
57
|
-
## Sponsors
|
|
58
|
-
|
|
59
|
-
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#sponsor).
|
|
60
|
-
|
|
61
|
-
[](https://opencollective.com/mochajs/sponsor/0/website)
|
|
62
|
-
[](https://opencollective.com/mochajs/sponsor/1/website)
|
|
63
|
-
[](https://opencollective.com/mochajs/sponsor/2/website)
|
|
64
|
-
[](https://opencollective.com/mochajs/sponsor/3/website)
|
|
65
|
-
[](https://opencollective.com/mochajs/sponsor/4/website)
|
|
66
|
-
[](https://opencollective.com/mochajs/sponsor/5/website)
|
|
67
|
-
[](https://opencollective.com/mochajs/sponsor/6/website)
|
|
68
|
-
[](https://opencollective.com/mochajs/sponsor/7/website)
|
|
69
|
-
[](https://opencollective.com/mochajs/sponsor/8/website)
|
|
70
|
-
[](https://opencollective.com/mochajs/sponsor/9/website)
|
|
71
|
-
[](https://opencollective.com/mochajs/sponsor/10/website)
|
|
72
|
-
[](https://opencollective.com/mochajs/sponsor/11/website)
|
|
73
|
-
[](https://opencollective.com/mochajs/sponsor/12/website)
|
|
74
|
-
[](https://opencollective.com/mochajs/sponsor/13/website)
|
|
75
|
-
[](https://opencollective.com/mochajs/sponsor/14/website)
|
|
76
|
-
[](https://opencollective.com/mochajs/sponsor/15/website)
|
|
77
|
-
[](https://opencollective.com/mochajs/sponsor/16/website)
|
|
78
|
-
[](https://opencollective.com/mochajs/sponsor/17/website)
|
|
79
|
-
[](https://opencollective.com/mochajs/sponsor/18/website)
|
|
80
|
-
[](https://opencollective.com/mochajs/sponsor/19/website)
|
|
81
|
-
|
|
82
|
-
## Development
|
|
83
|
-
|
|
84
|
-
You might want to know that:
|
|
85
|
-
|
|
86
|
-
- Mocha is the *most-depended-upon* module on npm (source: [libraries.io](https://libraries.io/search?order=desc&platforms=NPM&sort=dependents_count)), and
|
|
87
|
-
- Mocha is an *independent* open-source project, maintained exclusively by volunteers.
|
|
88
|
-
|
|
89
|
-
You might want to help:
|
|
90
|
-
|
|
91
|
-
- New to contributing to Mocha? Check out this list of [good first issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3Agood-first-issue)
|
|
92
|
-
- Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
|
93
|
-
- The [maintainer's handbook](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) explains how things get done
|
|
94
|
-
|
|
95
|
-
Finally, come [chat with the maintainers](https://gitter.im/mochajs/contributors) on Gitter if you want to help with:
|
|
96
|
-
|
|
97
|
-
- Triaging issues, answering questions
|
|
98
|
-
- Review, merging, and closing pull requests
|
|
99
|
-
- Other project-maintenance-y things
|
|
100
|
-
|
|
101
|
-
## License
|
|
102
|
-
|
|
103
|
-
[MIT](LICENSE)
|
|
104
|
-
|
|
105
|
-
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large)
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework"/>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">:coffee: Simple, flexible, fun JavaScript test framework for Node.js & The Browser :coffee:</p>
|
|
6
|
+
|
|
7
|
+
<p align="center"><a href="http://travis-ci.org/mochajs/mocha"><img src="https://api.travis-ci.org/mochajs/mocha.svg?branch=master" alt="Build Status"></a> <a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a> <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> <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> <a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/backers/badge.svg" alt="OpenCollective"></a> <a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/sponsors/badge.svg" alt="OpenCollective"></a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center"><br><img alt="Mocha Browser Support h/t SauceLabs" src="https://saucelabs.com/browser-matrix/mochajs.svg" width="354"></p>
|
|
11
|
+
|
|
12
|
+
## Links
|
|
13
|
+
|
|
14
|
+
- **[Documentation](https://mochajs.org/)**
|
|
15
|
+
- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)**
|
|
16
|
+
- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md)
|
|
17
|
+
- [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md)
|
|
18
|
+
- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!)
|
|
19
|
+
- [Google Group](https://groups.google.com/group/mochajs)
|
|
20
|
+
- [Issue Tracker](https://github.com/mochajs/mocha/issues)
|
|
21
|
+
|
|
22
|
+
## Backers
|
|
23
|
+
|
|
24
|
+
[Become a backer](https://opencollective.com/mochajs#backer) and show your support to our open source project.
|
|
25
|
+
|
|
26
|
+
[](https://opencollective.com/mochajs/backer/0/website)
|
|
27
|
+
[](https://opencollective.com/mochajs/backer/1/website)
|
|
28
|
+
[](https://opencollective.com/mochajs/backer/2/website)
|
|
29
|
+
[](https://opencollective.com/mochajs/backer/3/website)
|
|
30
|
+
[](https://opencollective.com/mochajs/backer/4/website)
|
|
31
|
+
[](https://opencollective.com/mochajs/backer/5/website)
|
|
32
|
+
[](https://opencollective.com/mochajs/backer/6/website)
|
|
33
|
+
[](https://opencollective.com/mochajs/backer/7/website)
|
|
34
|
+
[](https://opencollective.com/mochajs/backer/8/website)
|
|
35
|
+
[](https://opencollective.com/mochajs/backer/9/website)
|
|
36
|
+
[](https://opencollective.com/mochajs/backer/10/website)
|
|
37
|
+
[](https://opencollective.com/mochajs/backer/11/website)
|
|
38
|
+
[](https://opencollective.com/mochajs/backer/12/website)
|
|
39
|
+
[](https://opencollective.com/mochajs/backer/13/website)
|
|
40
|
+
[](https://opencollective.com/mochajs/backer/14/website)
|
|
41
|
+
[](https://opencollective.com/mochajs/backer/15/website)
|
|
42
|
+
[](https://opencollective.com/mochajs/backer/16/website)
|
|
43
|
+
[](https://opencollective.com/mochajs/backer/17/website)
|
|
44
|
+
[](https://opencollective.com/mochajs/backer/18/website)
|
|
45
|
+
[](https://opencollective.com/mochajs/backer/19/website)
|
|
46
|
+
[](https://opencollective.com/mochajs/backer/20/website)
|
|
47
|
+
[](https://opencollective.com/mochajs/backer/21/website)
|
|
48
|
+
[](https://opencollective.com/mochajs/backer/22/website)
|
|
49
|
+
[](https://opencollective.com/mochajs/backer/23/website)
|
|
50
|
+
[](https://opencollective.com/mochajs/backer/24/website)
|
|
51
|
+
[](https://opencollective.com/mochajs/backer/25/website)
|
|
52
|
+
[](https://opencollective.com/mochajs/backer/26/website)
|
|
53
|
+
[](https://opencollective.com/mochajs/backer/27/website)
|
|
54
|
+
[](https://opencollective.com/mochajs/backer/28/website)
|
|
55
|
+
[](https://opencollective.com/mochajs/backer/29/website)
|
|
56
|
+
|
|
57
|
+
## Sponsors
|
|
58
|
+
|
|
59
|
+
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#sponsor).
|
|
60
|
+
|
|
61
|
+
[](https://opencollective.com/mochajs/sponsor/0/website)
|
|
62
|
+
[](https://opencollective.com/mochajs/sponsor/1/website)
|
|
63
|
+
[](https://opencollective.com/mochajs/sponsor/2/website)
|
|
64
|
+
[](https://opencollective.com/mochajs/sponsor/3/website)
|
|
65
|
+
[](https://opencollective.com/mochajs/sponsor/4/website)
|
|
66
|
+
[](https://opencollective.com/mochajs/sponsor/5/website)
|
|
67
|
+
[](https://opencollective.com/mochajs/sponsor/6/website)
|
|
68
|
+
[](https://opencollective.com/mochajs/sponsor/7/website)
|
|
69
|
+
[](https://opencollective.com/mochajs/sponsor/8/website)
|
|
70
|
+
[](https://opencollective.com/mochajs/sponsor/9/website)
|
|
71
|
+
[](https://opencollective.com/mochajs/sponsor/10/website)
|
|
72
|
+
[](https://opencollective.com/mochajs/sponsor/11/website)
|
|
73
|
+
[](https://opencollective.com/mochajs/sponsor/12/website)
|
|
74
|
+
[](https://opencollective.com/mochajs/sponsor/13/website)
|
|
75
|
+
[](https://opencollective.com/mochajs/sponsor/14/website)
|
|
76
|
+
[](https://opencollective.com/mochajs/sponsor/15/website)
|
|
77
|
+
[](https://opencollective.com/mochajs/sponsor/16/website)
|
|
78
|
+
[](https://opencollective.com/mochajs/sponsor/17/website)
|
|
79
|
+
[](https://opencollective.com/mochajs/sponsor/18/website)
|
|
80
|
+
[](https://opencollective.com/mochajs/sponsor/19/website)
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
You might want to know that:
|
|
85
|
+
|
|
86
|
+
- Mocha is the *most-depended-upon* module on npm (source: [libraries.io](https://libraries.io/search?order=desc&platforms=NPM&sort=dependents_count)), and
|
|
87
|
+
- Mocha is an *independent* open-source project, maintained exclusively by volunteers.
|
|
88
|
+
|
|
89
|
+
You might want to help:
|
|
90
|
+
|
|
91
|
+
- New to contributing to Mocha? Check out this list of [good first issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3Agood-first-issue)
|
|
92
|
+
- Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
|
93
|
+
- The [maintainer's handbook](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) explains how things get done
|
|
94
|
+
|
|
95
|
+
Finally, come [chat with the maintainers](https://gitter.im/mochajs/contributors) on Gitter if you want to help with:
|
|
96
|
+
|
|
97
|
+
- Triaging issues, answering questions
|
|
98
|
+
- Review, merging, and closing pull requests
|
|
99
|
+
- Other project-maintenance-y things
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
[MIT](LICENSE)
|
|
104
|
+
|
|
105
|
+
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large)
|
package/bin/_mocha
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This file remains for backwards compatibility only.
|
|
6
|
-
* Don't put stuff in this file.
|
|
7
|
-
* @see module:lib/cli
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
require('../lib/cli').main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This file remains for backwards compatibility only.
|
|
6
|
+
* Don't put stuff in this file.
|
|
7
|
+
* @see module:lib/cli
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
require('../lib/cli').main();
|
package/bin/mocha
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This wrapper executable checks for known node flags and appends them when found, before invoking the "real" _mocha(1) executable.
|
|
7
|
-
*
|
|
8
|
-
* @module bin/mocha
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const {deprecate, warn} = require('../lib/utils');
|
|
13
|
-
const {spawn} = require('child_process');
|
|
14
|
-
const {loadOptions} = require('../lib/cli/options');
|
|
15
|
-
const {
|
|
16
|
-
unparseNodeFlags,
|
|
17
|
-
isNodeFlag,
|
|
18
|
-
impliesNoTimeouts
|
|
19
|
-
} = require('../lib/cli/node-flags');
|
|
20
|
-
const unparse = require('yargs-unparser');
|
|
21
|
-
const debug = require('debug')('mocha:cli:mocha');
|
|
22
|
-
const {aliases} = require('../lib/cli/run-option-metadata');
|
|
23
|
-
const nodeEnv = require('node-environment-flags');
|
|
24
|
-
|
|
25
|
-
const mochaPath = require.resolve('./_mocha');
|
|
26
|
-
const mochaArgs = {};
|
|
27
|
-
const nodeArgs = {};
|
|
28
|
-
|
|
29
|
-
const opts = loadOptions(process.argv.slice(2));
|
|
30
|
-
debug('loaded opts', opts);
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Given option/command `value`, disable timeouts if applicable
|
|
34
|
-
* @param {string} [value] - Value to check
|
|
35
|
-
* @ignore
|
|
36
|
-
*/
|
|
37
|
-
const disableTimeouts = value => {
|
|
38
|
-
if (impliesNoTimeouts(value)) {
|
|
39
|
-
debug(`option "${value}" disabled timeouts`);
|
|
40
|
-
mochaArgs.timeout = 0;
|
|
41
|
-
delete mochaArgs.timeouts;
|
|
42
|
-
delete mochaArgs.t;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* If `value` begins with `v8-` and is not explicitly `v8-options`, remove prefix
|
|
48
|
-
* @param {string} [value] - Value to check
|
|
49
|
-
* @returns {string} `value` with prefix (maybe) removed
|
|
50
|
-
* @ignore
|
|
51
|
-
*/
|
|
52
|
-
const trimV8Option = value =>
|
|
53
|
-
value !== 'v8-options' && /^v8-/.test(value) ? value.slice(3) : value;
|
|
54
|
-
|
|
55
|
-
// sort options into "node" and "mocha" buckets
|
|
56
|
-
Object.keys(opts).forEach(opt => {
|
|
57
|
-
if (isNodeFlag(opt)) {
|
|
58
|
-
nodeArgs[trimV8Option(opt)] = opts[opt];
|
|
59
|
-
disableTimeouts(opt);
|
|
60
|
-
} else {
|
|
61
|
-
mochaArgs[opt] = opts[opt];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// Native debugger handling
|
|
66
|
-
// see https://nodejs.org/api/debugger.html#debugger_debugger
|
|
67
|
-
// look for 'debug' or 'inspect' that would launch this debugger,
|
|
68
|
-
// remove it from Mocha's opts and prepend it to Node's opts.
|
|
69
|
-
// also coerce depending on Node.js version.
|
|
70
|
-
// A deprecation warning will be printed by node, if applicable.
|
|
71
|
-
// (mochaArgs._ are "positional" arguments, not prefixed with - or --)
|
|
72
|
-
if (/^(debug|inspect)$/.test(mochaArgs._[0])) {
|
|
73
|
-
const command = mochaArgs._.shift();
|
|
74
|
-
disableTimeouts(command);
|
|
75
|
-
// don't conflict with inspector
|
|
76
|
-
['debug', 'inspect', 'debug-brk', 'inspect-brk']
|
|
77
|
-
.filter(opt => opt in nodeArgs || opt in mochaArgs)
|
|
78
|
-
.forEach(opt => {
|
|
79
|
-
warn(`command "${command}" provided; --${opt} ignored`);
|
|
80
|
-
delete nodeArgs[opt];
|
|
81
|
-
delete mochaArgs[opt];
|
|
82
|
-
});
|
|
83
|
-
nodeArgs._ = [
|
|
84
|
-
parseInt(
|
|
85
|
-
process.version
|
|
86
|
-
.slice(1)
|
|
87
|
-
.split('.')
|
|
88
|
-
.shift(),
|
|
89
|
-
10
|
|
90
|
-
) >= 8
|
|
91
|
-
? 'inspect'
|
|
92
|
-
: 'debug'
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// allow --debug to invoke --inspect on Node.js v8 or newer.
|
|
97
|
-
['debug', 'debug-brk']
|
|
98
|
-
.filter(opt => opt in nodeArgs && !nodeEnv.has(opt))
|
|
99
|
-
.forEach(opt => {
|
|
100
|
-
const newOpt = opt === 'debug' ? 'inspect' : 'inspect-brk';
|
|
101
|
-
warn(
|
|
102
|
-
`"--${opt}" is not available in Node.js ${
|
|
103
|
-
process.version
|
|
104
|
-
}; use "--${newOpt}" instead.`
|
|
105
|
-
);
|
|
106
|
-
nodeArgs[newOpt] = nodeArgs[opt];
|
|
107
|
-
mochaArgs.timeout = false;
|
|
108
|
-
debug(`--${opt} -> ${newOpt}`);
|
|
109
|
-
delete nodeArgs[opt];
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// historical
|
|
113
|
-
if (nodeArgs.gc) {
|
|
114
|
-
deprecate(
|
|
115
|
-
'"-gc" is deprecated and will be removed from a future version of Mocha. Use "--gc-global" instead.'
|
|
116
|
-
);
|
|
117
|
-
nodeArgs['gc-global'] = nodeArgs.gc;
|
|
118
|
-
delete nodeArgs.gc;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
debug('final node args', nodeArgs);
|
|
122
|
-
|
|
123
|
-
const args = [].concat(
|
|
124
|
-
unparseNodeFlags(nodeArgs),
|
|
125
|
-
mochaPath,
|
|
126
|
-
unparse(mochaArgs, {alias: aliases})
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
debug(`exec ${process.execPath} w/ args:`, args);
|
|
130
|
-
|
|
131
|
-
const proc = spawn(process.execPath, args, {
|
|
132
|
-
stdio: 'inherit'
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
proc.on('exit', (code, signal) => {
|
|
136
|
-
process.on('exit', () => {
|
|
137
|
-
if (signal) {
|
|
138
|
-
process.kill(process.pid, signal);
|
|
139
|
-
} else {
|
|
140
|
-
process.exit(code);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// terminate children.
|
|
146
|
-
process.on('SIGINT', () => {
|
|
147
|
-
proc.kill('SIGINT'); // calls runner.abort()
|
|
148
|
-
proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
|
|
149
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This wrapper executable checks for known node flags and appends them when found, before invoking the "real" _mocha(1) executable.
|
|
7
|
+
*
|
|
8
|
+
* @module bin/mocha
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const {deprecate, warn} = require('../lib/utils');
|
|
13
|
+
const {spawn} = require('child_process');
|
|
14
|
+
const {loadOptions} = require('../lib/cli/options');
|
|
15
|
+
const {
|
|
16
|
+
unparseNodeFlags,
|
|
17
|
+
isNodeFlag,
|
|
18
|
+
impliesNoTimeouts
|
|
19
|
+
} = require('../lib/cli/node-flags');
|
|
20
|
+
const unparse = require('yargs-unparser');
|
|
21
|
+
const debug = require('debug')('mocha:cli:mocha');
|
|
22
|
+
const {aliases} = require('../lib/cli/run-option-metadata');
|
|
23
|
+
const nodeEnv = require('node-environment-flags');
|
|
24
|
+
|
|
25
|
+
const mochaPath = require.resolve('./_mocha');
|
|
26
|
+
const mochaArgs = {};
|
|
27
|
+
const nodeArgs = {};
|
|
28
|
+
|
|
29
|
+
const opts = loadOptions(process.argv.slice(2));
|
|
30
|
+
debug('loaded opts', opts);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Given option/command `value`, disable timeouts if applicable
|
|
34
|
+
* @param {string} [value] - Value to check
|
|
35
|
+
* @ignore
|
|
36
|
+
*/
|
|
37
|
+
const disableTimeouts = value => {
|
|
38
|
+
if (impliesNoTimeouts(value)) {
|
|
39
|
+
debug(`option "${value}" disabled timeouts`);
|
|
40
|
+
mochaArgs.timeout = 0;
|
|
41
|
+
delete mochaArgs.timeouts;
|
|
42
|
+
delete mochaArgs.t;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* If `value` begins with `v8-` and is not explicitly `v8-options`, remove prefix
|
|
48
|
+
* @param {string} [value] - Value to check
|
|
49
|
+
* @returns {string} `value` with prefix (maybe) removed
|
|
50
|
+
* @ignore
|
|
51
|
+
*/
|
|
52
|
+
const trimV8Option = value =>
|
|
53
|
+
value !== 'v8-options' && /^v8-/.test(value) ? value.slice(3) : value;
|
|
54
|
+
|
|
55
|
+
// sort options into "node" and "mocha" buckets
|
|
56
|
+
Object.keys(opts).forEach(opt => {
|
|
57
|
+
if (isNodeFlag(opt)) {
|
|
58
|
+
nodeArgs[trimV8Option(opt)] = opts[opt];
|
|
59
|
+
disableTimeouts(opt);
|
|
60
|
+
} else {
|
|
61
|
+
mochaArgs[opt] = opts[opt];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Native debugger handling
|
|
66
|
+
// see https://nodejs.org/api/debugger.html#debugger_debugger
|
|
67
|
+
// look for 'debug' or 'inspect' that would launch this debugger,
|
|
68
|
+
// remove it from Mocha's opts and prepend it to Node's opts.
|
|
69
|
+
// also coerce depending on Node.js version.
|
|
70
|
+
// A deprecation warning will be printed by node, if applicable.
|
|
71
|
+
// (mochaArgs._ are "positional" arguments, not prefixed with - or --)
|
|
72
|
+
if (/^(debug|inspect)$/.test(mochaArgs._[0])) {
|
|
73
|
+
const command = mochaArgs._.shift();
|
|
74
|
+
disableTimeouts(command);
|
|
75
|
+
// don't conflict with inspector
|
|
76
|
+
['debug', 'inspect', 'debug-brk', 'inspect-brk']
|
|
77
|
+
.filter(opt => opt in nodeArgs || opt in mochaArgs)
|
|
78
|
+
.forEach(opt => {
|
|
79
|
+
warn(`command "${command}" provided; --${opt} ignored`);
|
|
80
|
+
delete nodeArgs[opt];
|
|
81
|
+
delete mochaArgs[opt];
|
|
82
|
+
});
|
|
83
|
+
nodeArgs._ = [
|
|
84
|
+
parseInt(
|
|
85
|
+
process.version
|
|
86
|
+
.slice(1)
|
|
87
|
+
.split('.')
|
|
88
|
+
.shift(),
|
|
89
|
+
10
|
|
90
|
+
) >= 8
|
|
91
|
+
? 'inspect'
|
|
92
|
+
: 'debug'
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// allow --debug to invoke --inspect on Node.js v8 or newer.
|
|
97
|
+
['debug', 'debug-brk']
|
|
98
|
+
.filter(opt => opt in nodeArgs && !nodeEnv.has(opt))
|
|
99
|
+
.forEach(opt => {
|
|
100
|
+
const newOpt = opt === 'debug' ? 'inspect' : 'inspect-brk';
|
|
101
|
+
warn(
|
|
102
|
+
`"--${opt}" is not available in Node.js ${
|
|
103
|
+
process.version
|
|
104
|
+
}; use "--${newOpt}" instead.`
|
|
105
|
+
);
|
|
106
|
+
nodeArgs[newOpt] = nodeArgs[opt];
|
|
107
|
+
mochaArgs.timeout = false;
|
|
108
|
+
debug(`--${opt} -> ${newOpt}`);
|
|
109
|
+
delete nodeArgs[opt];
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// historical
|
|
113
|
+
if (nodeArgs.gc) {
|
|
114
|
+
deprecate(
|
|
115
|
+
'"-gc" is deprecated and will be removed from a future version of Mocha. Use "--gc-global" instead.'
|
|
116
|
+
);
|
|
117
|
+
nodeArgs['gc-global'] = nodeArgs.gc;
|
|
118
|
+
delete nodeArgs.gc;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
debug('final node args', nodeArgs);
|
|
122
|
+
|
|
123
|
+
const args = [].concat(
|
|
124
|
+
unparseNodeFlags(nodeArgs),
|
|
125
|
+
mochaPath,
|
|
126
|
+
unparse(mochaArgs, {alias: aliases})
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
debug(`exec ${process.execPath} w/ args:`, args);
|
|
130
|
+
|
|
131
|
+
const proc = spawn(process.execPath, args, {
|
|
132
|
+
stdio: 'inherit'
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
proc.on('exit', (code, signal) => {
|
|
136
|
+
process.on('exit', () => {
|
|
137
|
+
if (signal) {
|
|
138
|
+
process.kill(process.pid, signal);
|
|
139
|
+
} else {
|
|
140
|
+
process.exit(code);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// terminate children.
|
|
146
|
+
process.on('SIGINT', () => {
|
|
147
|
+
proc.kill('SIGINT'); // calls runner.abort()
|
|
148
|
+
proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
|
|
149
|
+
});
|
package/bin/options.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* This module is deprecated and will be removed in a future version of Mocha.
|
|
5
|
-
* @deprecated Deprecated in v6.0.0; source moved into {@link module:lib/cli/options lib/cli/options module}.
|
|
6
|
-
* @module
|
|
7
|
-
* @exports module:lib/cli/options
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
module.exports = require('../lib/cli/options');
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* This module is deprecated and will be removed in a future version of Mocha.
|
|
5
|
+
* @deprecated Deprecated in v6.0.0; source moved into {@link module:lib/cli/options lib/cli/options module}.
|
|
6
|
+
* @module
|
|
7
|
+
* @exports module:lib/cli/options
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
module.exports = require('../lib/cli/options');
|