mocha 3.0.0-1 → 3.0.2
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 +124 -0
- package/README.md +84 -0
- package/bin/_mocha +2 -3
- package/bin/mocha +1 -0
- package/bower.json +38 -0
- package/lib/interfaces/bdd.js +16 -14
- package/lib/interfaces/common.js +50 -10
- package/lib/interfaces/qunit.js +14 -9
- package/lib/interfaces/tdd.js +16 -14
- package/lib/reporters/base.js +1 -1
- package/lib/reporters/spec.js +0 -4
- package/lib/runnable.js +1 -1
- package/lib/runner.js +32 -9
- package/lib/suite.js +2 -0
- package/lib/to-iso-string/LICENSE +19 -0
- package/lib/to-iso-string/index.js +37 -0
- package/lib/utils.js +18 -1
- package/mocha.css +23 -11
- package/mocha.js +261 -176
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,127 @@
|
|
|
1
|
+
# 3.0.2 / 2016-08-08
|
|
2
|
+
|
|
3
|
+
## :bug: Bug Fix
|
|
4
|
+
|
|
5
|
+
- [#2424]: Fix error loading Mocha via Require.js ([@boneskull])
|
|
6
|
+
- [#2417]: Fix execution of *deeply* nested `describe.only()` suites ([@not-an-aardvark])
|
|
7
|
+
- Remove references to `json-cov` and `html-cov` reporters in CLI ([@boneskull])
|
|
8
|
+
|
|
9
|
+
[#2417]: https://github.com/mochajs/mocha/issues/2417
|
|
10
|
+
[#2424]: https://github.com/mochajs/mocha/issues/2424
|
|
11
|
+
|
|
12
|
+
# 3.0.1 / 2016-08-03
|
|
13
|
+
|
|
14
|
+
## :bug: Bug Fix
|
|
15
|
+
|
|
16
|
+
- [#2406]: Restore execution of nested `describe.only()` suites ([@not-an-aardvark])
|
|
17
|
+
|
|
18
|
+
[#2406]: https://github.com/mochajs/mocha/issues/2406
|
|
19
|
+
[@not-an-aardvark]: https://github.com/not-an-aardvark
|
|
20
|
+
|
|
21
|
+
# 3.0.0 / 2016-07-31
|
|
22
|
+
|
|
23
|
+
## :boom: Breaking Changes
|
|
24
|
+
|
|
25
|
+
- :warning: Due to the increasing difficulty of applying security patches made within its dependency tree, as well as looming incompatibilities with Node.js v7.0, **Mocha no longer supports Node.js v0.8**.
|
|
26
|
+
- :warning: **Mocha may no longer be installed by versions of `npm` less than `1.4.0`.** Previously, this requirement only affected Mocha's development dependencies. In short, this allows Mocha to depend on packages which have dependencies fixed to major versions (`^`).
|
|
27
|
+
- `.only()` is no longer "fuzzy", can be used multiple times, and generally just works like you think it should. :joy:
|
|
28
|
+
- To avoid common bugs, when a test injects a callback function (suggesting asynchronous execution), calls it, *and* returns a `Promise`, Mocha will now throw an exception:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
const assert = require('assert');
|
|
32
|
+
|
|
33
|
+
it('should complete this test', function (done) {
|
|
34
|
+
return new Promise(function (resolve) {
|
|
35
|
+
assert.ok(true);
|
|
36
|
+
resolve();
|
|
37
|
+
})
|
|
38
|
+
.then(done);
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The above test will fail with `Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both.`.
|
|
43
|
+
- When a test timeout value *greater than* `2147483648` is specified in any context (`--timeout`, `mocha.setup()`, per-suite, per-test, etc.), the timeout will be *disabled* and the test(s) will be allowed to run indefinitely. This is equivalent to specifying a timeout value of `0`. See [MDN](https://developer.mozilla.org/docs/Web/API/WindowTimers/setTimeout#Maximum_delay_value) for reasoning.
|
|
44
|
+
- The `dot` reporter now uses more visually distinctive characters when indicating "pending" and "failed" tests.
|
|
45
|
+
- Mocha no longer supports [component](https://www.npmjs.com/package/component).
|
|
46
|
+
- The long-forsaken `HTMLCov` and `JSONCov` reporters--and any relationship to the "node-jscoverage" project--have been removed.
|
|
47
|
+
- `spec` reporter now omits leading carriage returns (`\r`) in non-TTY environment.
|
|
48
|
+
|
|
49
|
+
## :tada: Enhancements
|
|
50
|
+
|
|
51
|
+
- [#808]: Allow regular-expression-like strings in `--grep` and browser's `grep` querystring; enables flags such as `i` for case-insensitive matches and `u` for unicode. ([@a8m])
|
|
52
|
+
- [#2000]: Use distinctive characters in `dot` reporter; `,` will denote a "pending" test and `!` will denote a "failing" test. ([@elliottcable])
|
|
53
|
+
- [#1632]: Throw a useful exception when a suite or test lacks a title. ([@a8m])
|
|
54
|
+
- [#1481]: Better `.only()` behavior. ([@a8m])
|
|
55
|
+
- [#2334]: Allow `this.skip()` in async tests and hooks. ([@boneskull])
|
|
56
|
+
- [#1320]: Throw a useful exception when test resolution method is overspecified. ([@jugglinmike])
|
|
57
|
+
- [#2364]: Support `--preserve-symlinks`. ([@rosswarren])
|
|
58
|
+
|
|
59
|
+
## :bug: Bug Fixes
|
|
60
|
+
|
|
61
|
+
- [#2259]: Restore ES3 compatibility. Specifically, support an environment lacking `Date.prototype.toISOString()`, `JSON`, or has a non-standard implementation of `JSON`. ([@ndhoule], [@boneskull])
|
|
62
|
+
- [#2286]: Fix `after()` failing to execute if test skipped using `this.skip()` in `beforeEach()`; no longer marks the entire suite as "pending". ([@dasilvacontin], [@boneskull])
|
|
63
|
+
- [#2208]: Fix function name display in `markdown` and `html` (browser) reporters. ([@ScottFreeCode])
|
|
64
|
+
- [#2299]: Fix progress bar in `html` (browser) reporter. ([@AviVahl])
|
|
65
|
+
- [#2307]: Fix `doc` reporter crashing when test fails. ([@jleyba])
|
|
66
|
+
- [#2323]: Ensure browser entry point (`browser-entry.js`) is published to npm (for use with bundlers). ([@boneskull])
|
|
67
|
+
- [#2310]: Ensure custom reporter with an absolute path works in Windows. ([@silentcloud])
|
|
68
|
+
- [#2311]: Fix problem wherein calling `this.slow()` without a value would blast any previously set value. ([@boneskull])
|
|
69
|
+
- [#1813]: Ensure Mocha's own test suite will run in Windows. ([@tswaters], [@TimothyGu], [@boneskull])
|
|
70
|
+
- [#2317]: Ensure all interfaces are displayed in `--help` on CLI. ([@ScottFreeCode])
|
|
71
|
+
- [#1644]: Don't exhibit undefined behavior when calling `this.timeout()` with very large values ([@callumacrae], [@boneskull])
|
|
72
|
+
- [#2361]: Don't truncate name of thrown anonymous exception. ([@boneskull])
|
|
73
|
+
- [#2367]: Fix invalid CSS. ([@bensontrent])
|
|
74
|
+
- [#2401]: Remove carriage return before each test line in spec reporter. ([@Munter])
|
|
75
|
+
|
|
76
|
+
## :nut_and_bolt: Other
|
|
77
|
+
|
|
78
|
+
- Upgrade production dependencies to address security advisories (and because now we can): `glob`, `commander`, `escape-string-regexp`,
|
|
79
|
+
and `supports-color`. ([@boneskull], [@RobLoach])
|
|
80
|
+
- Add Windows to CI. ([@boneskull], [@TimothyGu])
|
|
81
|
+
- Ensure appropriate `engines` field in `package.json`. ([@shinnn], [@boneskull])
|
|
82
|
+
- [#2348]: Upgrade ESLint to v2 ([@anthony-redfox])
|
|
83
|
+
|
|
84
|
+
We :heart: our [backers and sponsors](https://opencollective.com/mochajs)!
|
|
85
|
+
|
|
86
|
+
:shipit:
|
|
87
|
+
|
|
88
|
+
[#2401]: https://github.com/mochajs/mocha/pull/2401
|
|
89
|
+
[#2348]: https://github.com/mochajs/mocha/issues/2348
|
|
90
|
+
[#808]: https://github.com/mochajs/mocha/issues/808
|
|
91
|
+
[#2361]: https://github.com/mochajs/mocha/pull/2361
|
|
92
|
+
[#2367]: https://github.com/mochajs/mocha/pull/2367
|
|
93
|
+
[#2364]: https://github.com/mochajs/mocha/pull/2364
|
|
94
|
+
[#1320]: https://github.com/mochajs/mocha/pull/1320
|
|
95
|
+
[#2307]: https://github.com/mochajs/mocha/pull/2307
|
|
96
|
+
[#2259]: https://github.com/mochajs/mocha/pull/2259
|
|
97
|
+
[#2208]: https://github.com/mochajs/mocha/pull/2208
|
|
98
|
+
[#2299]: https://github.com/mochajs/mocha/pull/2299
|
|
99
|
+
[#2286]: https://github.com/mochajs/mocha/issues/2286
|
|
100
|
+
[#1644]: https://github.com/mochajs/mocha/issues/1644
|
|
101
|
+
[#2310]: https://github.com/mochajs/mocha/issues/2310
|
|
102
|
+
[#2311]: https://github.com/mochajs/mocha/issues/2311
|
|
103
|
+
[#2323]: https://github.com/mochajs/mocha/issues/2323
|
|
104
|
+
[#2000]: https://github.com/mochajs/mocha/pull/2000
|
|
105
|
+
[#1632]: https://github.com/mochajs/mocha/issues/1632
|
|
106
|
+
[#1813]: https://github.com/mochajs/mocha/issues/1813
|
|
107
|
+
[#2334]: https://github.com/mochajs/mocha/issues/2334
|
|
108
|
+
[#2317]: https://github.com/mochajs/mocha/issues/2317
|
|
109
|
+
[#1481]: https://github.com/mochajs/mocha/issues/1481
|
|
110
|
+
[@elliottcable]: https://github.com/elliottcable
|
|
111
|
+
[@RobLoach]: https://github.com/robloach
|
|
112
|
+
[@AviVahl]: https://github.com/avivahl
|
|
113
|
+
[@silentcloud]: https://github.com/silentcloud
|
|
114
|
+
[@tswaters]: https://github.com/tswaters
|
|
115
|
+
[@jleyba]: https://github.com/jleyba
|
|
116
|
+
[@TimothyGu]: https://github.com/timothygu
|
|
117
|
+
[@callumacrae]: https://github.com/callumacrae
|
|
118
|
+
[@shinnn]: https://github.com/shinnn
|
|
119
|
+
[@bensontrent]: https://github.com/bensontrent
|
|
120
|
+
[@jugglinmike]: https://github.com/jugglinmike
|
|
121
|
+
[@rosswarren]: https://github.com/rosswarren
|
|
122
|
+
[@anthony-redfox]: https://github.com/anthony-redfox
|
|
123
|
+
[@Munter]: https://github.com/munter
|
|
124
|
+
|
|
1
125
|
# 2.5.3 / 2016-05-25
|
|
2
126
|
|
|
3
127
|
- [#2112] - Fix HTML reporter regression causing duplicate error output ([@danielstjules] via 6d24063)
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<br><br>
|
|
2
|
+
<p align="center">
|
|
3
|
+
<img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework"/>
|
|
4
|
+
</p>
|
|
5
|
+
<br><br>
|
|
6
|
+
|
|
7
|
+
[](http://travis-ci.org/mochajs/mocha) [](https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
8
|
+
[](#backers)
|
|
9
|
+
[](#sponsors)
|
|
10
|
+
|
|
11
|
+
Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://mochajs.org).
|
|
12
|
+
|
|
13
|
+
## Links
|
|
14
|
+
|
|
15
|
+
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
|
|
16
|
+
- [Google Group](http://groups.google.com/group/mochajs)
|
|
17
|
+
- [Wiki](https://github.com/mochajs/mocha/wiki)
|
|
18
|
+
- Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Backers
|
|
22
|
+
|
|
23
|
+
[Become a backer]((https://opencollective.com/mochajs#backer)) and show your support to our open source project.
|
|
24
|
+
|
|
25
|
+
<a href="https://opencollective.com/mochajs/backer/0/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/0/avatar"></a>
|
|
26
|
+
<a href="https://opencollective.com/mochajs/backer/1/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/1/avatar"></a>
|
|
27
|
+
<a href="https://opencollective.com/mochajs/backer/2/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/2/avatar"></a>
|
|
28
|
+
<a href="https://opencollective.com/mochajs/backer/3/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/3/avatar"></a>
|
|
29
|
+
<a href="https://opencollective.com/mochajs/backer/4/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/4/avatar"></a>
|
|
30
|
+
<a href="https://opencollective.com/mochajs/backer/5/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/5/avatar"></a>
|
|
31
|
+
<a href="https://opencollective.com/mochajs/backer/6/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/6/avatar"></a>
|
|
32
|
+
<a href="https://opencollective.com/mochajs/backer/7/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/7/avatar"></a>
|
|
33
|
+
<a href="https://opencollective.com/mochajs/backer/8/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/8/avatar"></a>
|
|
34
|
+
<a href="https://opencollective.com/mochajs/backer/9/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/9/avatar"></a>
|
|
35
|
+
<a href="https://opencollective.com/mochajs/backer/10/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/10/avatar"></a>
|
|
36
|
+
<a href="https://opencollective.com/mochajs/backer/11/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/11/avatar"></a>
|
|
37
|
+
<a href="https://opencollective.com/mochajs/backer/12/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/12/avatar"></a>
|
|
38
|
+
<a href="https://opencollective.com/mochajs/backer/13/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/13/avatar"></a>
|
|
39
|
+
<a href="https://opencollective.com/mochajs/backer/14/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/14/avatar"></a>
|
|
40
|
+
<a href="https://opencollective.com/mochajs/backer/15/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/15/avatar"></a>
|
|
41
|
+
<a href="https://opencollective.com/mochajs/backer/16/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/16/avatar"></a>
|
|
42
|
+
<a href="https://opencollective.com/mochajs/backer/17/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/17/avatar"></a>
|
|
43
|
+
<a href="https://opencollective.com/mochajs/backer/18/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/18/avatar"></a>
|
|
44
|
+
<a href="https://opencollective.com/mochajs/backer/19/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/19/avatar"></a>
|
|
45
|
+
<a href="https://opencollective.com/mochajs/backer/20/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/20/avatar"></a>
|
|
46
|
+
<a href="https://opencollective.com/mochajs/backer/21/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/21/avatar"></a>
|
|
47
|
+
<a href="https://opencollective.com/mochajs/backer/22/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/22/avatar"></a>
|
|
48
|
+
<a href="https://opencollective.com/mochajs/backer/23/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/23/avatar"></a>
|
|
49
|
+
<a href="https://opencollective.com/mochajs/backer/24/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/24/avatar"></a>
|
|
50
|
+
<a href="https://opencollective.com/mochajs/backer/25/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/25/avatar"></a>
|
|
51
|
+
<a href="https://opencollective.com/mochajs/backer/26/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/26/avatar"></a>
|
|
52
|
+
<a href="https://opencollective.com/mochajs/backer/27/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/27/avatar"></a>
|
|
53
|
+
<a href="https://opencollective.com/mochajs/backer/28/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/28/avatar"></a>
|
|
54
|
+
<a href="https://opencollective.com/mochajs/backer/29/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/29/avatar"></a>
|
|
55
|
+
|
|
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
|
+
<a href="https://opencollective.com/mochajs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/0/avatar"></a>
|
|
62
|
+
<a href="https://opencollective.com/mochajs/sponsor/1/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/1/avatar"></a>
|
|
63
|
+
<a href="https://opencollective.com/mochajs/sponsor/2/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/2/avatar"></a>
|
|
64
|
+
<a href="https://opencollective.com/mochajs/sponsor/3/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/3/avatar"></a>
|
|
65
|
+
<a href="https://opencollective.com/mochajs/sponsor/4/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/4/avatar"></a>
|
|
66
|
+
<a href="https://opencollective.com/mochajs/sponsor/5/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/5/avatar"></a>
|
|
67
|
+
<a href="https://opencollective.com/mochajs/sponsor/6/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/6/avatar"></a>
|
|
68
|
+
<a href="https://opencollective.com/mochajs/sponsor/7/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/7/avatar"></a>
|
|
69
|
+
<a href="https://opencollective.com/mochajs/sponsor/8/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/8/avatar"></a>
|
|
70
|
+
<a href="https://opencollective.com/mochajs/sponsor/9/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/9/avatar"></a>
|
|
71
|
+
<a href="https://opencollective.com/mochajs/sponsor/10/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/10/avatar"></a>
|
|
72
|
+
<a href="https://opencollective.com/mochajs/sponsor/11/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/11/avatar"></a>
|
|
73
|
+
<a href="https://opencollective.com/mochajs/sponsor/12/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/12/avatar"></a>
|
|
74
|
+
<a href="https://opencollective.com/mochajs/sponsor/13/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/13/avatar"></a>
|
|
75
|
+
<a href="https://opencollective.com/mochajs/sponsor/14/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/14/avatar"></a>
|
|
76
|
+
<a href="https://opencollective.com/mochajs/sponsor/15/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/15/avatar"></a>
|
|
77
|
+
<a href="https://opencollective.com/mochajs/sponsor/16/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/16/avatar"></a>
|
|
78
|
+
<a href="https://opencollective.com/mochajs/sponsor/17/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/17/avatar"></a>
|
|
79
|
+
<a href="https://opencollective.com/mochajs/sponsor/18/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/18/avatar"></a>
|
|
80
|
+
<a href="https://opencollective.com/mochajs/sponsor/19/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/19/avatar"></a>
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
package/bin/_mocha
CHANGED
|
@@ -84,6 +84,7 @@ program
|
|
|
84
84
|
.option('--globals <names>', 'allow the given comma-delimited global [names]', list, [])
|
|
85
85
|
.option('--es_staging', 'enable all staged features')
|
|
86
86
|
.option('--harmony<_classes,_generators,...>', 'all node --harmony* flags are available')
|
|
87
|
+
.option('--preserve-symlinks', 'Instructs the module loader to preserve symbolic links when resolving and caching modules')
|
|
87
88
|
.option('--icu-data-dir', 'include ICU data')
|
|
88
89
|
.option('--inline-diffs', 'display actual/expected differences inline within each string')
|
|
89
90
|
.option('--interfaces', 'display available interfaces')
|
|
@@ -104,7 +105,7 @@ program
|
|
|
104
105
|
.option('--watch-extensions <ext>,...', 'additional extensions to monitor with --watch', list, [])
|
|
105
106
|
.option('--delay', 'wait for async suite definition')
|
|
106
107
|
|
|
107
|
-
program.
|
|
108
|
+
program._name = 'mocha';
|
|
108
109
|
|
|
109
110
|
// init command
|
|
110
111
|
|
|
@@ -143,8 +144,6 @@ program.on('reporters', function(){
|
|
|
143
144
|
console.log(' tap - test-anything-protocol');
|
|
144
145
|
console.log(' landing - unicode landing strip');
|
|
145
146
|
console.log(' xunit - xunit reporter');
|
|
146
|
-
console.log(' html-cov - HTML test coverage');
|
|
147
|
-
console.log(' json-cov - JSON test coverage');
|
|
148
147
|
console.log(' min - minimal reporter (great with --watch)');
|
|
149
148
|
console.log(' json-stream - newline delimited json events');
|
|
150
149
|
console.log(' markdown - markdown documentation (github flavour)');
|
package/bin/mocha
CHANGED
|
@@ -50,6 +50,7 @@ process.argv.slice(2).forEach(function(arg){
|
|
|
50
50
|
else if (0 == arg.indexOf('--trace')) args.unshift(arg);
|
|
51
51
|
else if (0 == arg.indexOf('--icu-data-dir')) args.unshift(arg);
|
|
52
52
|
else if (0 == arg.indexOf('--max-old-space-size')) args.unshift(arg);
|
|
53
|
+
else if (0 == arg.indexOf('--preserve-symlinks')) args.unshift(arg);
|
|
53
54
|
else args.push(arg);
|
|
54
55
|
break;
|
|
55
56
|
}
|
package/bower.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mocha",
|
|
3
|
+
"homepage": "https://mochajs.org",
|
|
4
|
+
"description": "simple, flexible, fun test framework",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git://github.com/mochajs/mocha.git"
|
|
8
|
+
},
|
|
9
|
+
"main": [
|
|
10
|
+
"mocha.js",
|
|
11
|
+
"mocha.css"
|
|
12
|
+
],
|
|
13
|
+
"ignore": [
|
|
14
|
+
"bin",
|
|
15
|
+
"editors",
|
|
16
|
+
"images",
|
|
17
|
+
"lib",
|
|
18
|
+
"scripts",
|
|
19
|
+
"test",
|
|
20
|
+
"assets",
|
|
21
|
+
"media",
|
|
22
|
+
".*",
|
|
23
|
+
"index.js",
|
|
24
|
+
"karma.conf.js",
|
|
25
|
+
"browser-entry.js",
|
|
26
|
+
"Makefile",
|
|
27
|
+
"package.json",
|
|
28
|
+
"appveyor.yml"
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"mocha",
|
|
32
|
+
"test",
|
|
33
|
+
"bdd",
|
|
34
|
+
"tdd",
|
|
35
|
+
"tap"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT"
|
|
38
|
+
}
|
package/lib/interfaces/bdd.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Module dependencies.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
var Suite = require('../suite');
|
|
6
5
|
var Test = require('../test');
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -26,7 +25,7 @@ module.exports = function(suite) {
|
|
|
26
25
|
var suites = [suite];
|
|
27
26
|
|
|
28
27
|
suite.on('pre-require', function(context, file, mocha) {
|
|
29
|
-
var common = require('./common')(suites, context);
|
|
28
|
+
var common = require('./common')(suites, context, mocha);
|
|
30
29
|
|
|
31
30
|
context.before = common.before;
|
|
32
31
|
context.after = common.after;
|
|
@@ -40,12 +39,11 @@ module.exports = function(suite) {
|
|
|
40
39
|
*/
|
|
41
40
|
|
|
42
41
|
context.describe = context.context = function(title, fn) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return suite;
|
|
42
|
+
return common.suite.create({
|
|
43
|
+
title: title,
|
|
44
|
+
file: file,
|
|
45
|
+
fn: fn
|
|
46
|
+
});
|
|
49
47
|
};
|
|
50
48
|
|
|
51
49
|
/**
|
|
@@ -53,11 +51,11 @@ module.exports = function(suite) {
|
|
|
53
51
|
*/
|
|
54
52
|
|
|
55
53
|
context.xdescribe = context.xcontext = context.describe.skip = function(title, fn) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
return common.suite.skip({
|
|
55
|
+
title: title,
|
|
56
|
+
file: file,
|
|
57
|
+
fn: fn
|
|
58
|
+
});
|
|
61
59
|
};
|
|
62
60
|
|
|
63
61
|
/**
|
|
@@ -65,7 +63,11 @@ module.exports = function(suite) {
|
|
|
65
63
|
*/
|
|
66
64
|
|
|
67
65
|
context.describe.only = function(title, fn) {
|
|
68
|
-
return common.suite.only(
|
|
66
|
+
return common.suite.only({
|
|
67
|
+
title: title,
|
|
68
|
+
file: file,
|
|
69
|
+
fn: fn
|
|
70
|
+
});
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
/**
|
package/lib/interfaces/common.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var Suite = require('../suite');
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Functions common to more than one interface.
|
|
5
7
|
*
|
|
6
8
|
* @param {Suite[]} suites
|
|
7
9
|
* @param {Context} context
|
|
10
|
+
* @param {Mocha} mocha
|
|
8
11
|
* @return {Object} An object containing common functions.
|
|
9
12
|
*/
|
|
10
|
-
module.exports = function(suites, context) {
|
|
13
|
+
module.exports = function(suites, context, mocha) {
|
|
11
14
|
return {
|
|
12
15
|
/**
|
|
13
16
|
* This is only present if flag --delay is passed into Mocha. It triggers
|
|
@@ -64,15 +67,54 @@ module.exports = function(suites, context) {
|
|
|
64
67
|
|
|
65
68
|
suite: {
|
|
66
69
|
/**
|
|
67
|
-
*
|
|
70
|
+
* Create an exclusive Suite; convenience function
|
|
71
|
+
* See docstring for create() below.
|
|
68
72
|
*
|
|
69
|
-
* @param {Object}
|
|
70
|
-
* @
|
|
73
|
+
* @param {Object} opts
|
|
74
|
+
* @returns {Suite}
|
|
71
75
|
*/
|
|
72
|
-
|
|
73
|
-
only: function(mocha, suite) {
|
|
74
|
-
suite.isOnly = true;
|
|
76
|
+
only: function only(opts) {
|
|
75
77
|
mocha.options.hasOnly = true;
|
|
78
|
+
opts.isOnly = true;
|
|
79
|
+
return this.create(opts);
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Create a Suite, but skip it; convenience function
|
|
84
|
+
* See docstring for create() below.
|
|
85
|
+
*
|
|
86
|
+
* @param {Object} opts
|
|
87
|
+
* @returns {Suite}
|
|
88
|
+
*/
|
|
89
|
+
skip: function skip(opts) {
|
|
90
|
+
opts.pending = true;
|
|
91
|
+
return this.create(opts);
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Creates a suite.
|
|
96
|
+
* @param {Object} opts Options
|
|
97
|
+
* @param {string} opts.title Title of Suite
|
|
98
|
+
* @param {Function} [opts.fn] Suite Function (not always applicable)
|
|
99
|
+
* @param {boolean} [opts.pending] Is Suite pending?
|
|
100
|
+
* @param {string} [opts.file] Filepath where this Suite resides
|
|
101
|
+
* @param {boolean} [opts.isOnly] Is Suite exclusive?
|
|
102
|
+
* @returns {Suite}
|
|
103
|
+
*/
|
|
104
|
+
create: function create(opts) {
|
|
105
|
+
var suite = Suite.create(suites[0], opts.title);
|
|
106
|
+
suite.pending = Boolean(opts.pending);
|
|
107
|
+
suite.file = opts.file;
|
|
108
|
+
suites.unshift(suite);
|
|
109
|
+
if (opts.isOnly) {
|
|
110
|
+
suite.parent._onlySuites = suite.parent._onlySuites.concat(suite);
|
|
111
|
+
mocha.options.hasOnly = true;
|
|
112
|
+
}
|
|
113
|
+
if (typeof opts.fn === 'function') {
|
|
114
|
+
opts.fn.call(suite);
|
|
115
|
+
suites.shift();
|
|
116
|
+
}
|
|
117
|
+
|
|
76
118
|
return suite;
|
|
77
119
|
}
|
|
78
120
|
},
|
|
@@ -87,9 +129,7 @@ module.exports = function(suites, context) {
|
|
|
87
129
|
* @returns {*}
|
|
88
130
|
*/
|
|
89
131
|
only: function(mocha, test) {
|
|
90
|
-
|
|
91
|
-
suite.isOnly = true;
|
|
92
|
-
suite.onlyTests = (suite.onlyTests || []).concat(test);
|
|
132
|
+
test.parent._onlyTests = test.parent._onlyTests.concat(test);
|
|
93
133
|
mocha.options.hasOnly = true;
|
|
94
134
|
return test;
|
|
95
135
|
},
|
package/lib/interfaces/qunit.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Module dependencies.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
var Suite = require('../suite');
|
|
6
5
|
var Test = require('../test');
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -34,7 +33,7 @@ module.exports = function(suite) {
|
|
|
34
33
|
var suites = [suite];
|
|
35
34
|
|
|
36
35
|
suite.on('pre-require', function(context, file, mocha) {
|
|
37
|
-
var common = require('./common')(suites, context);
|
|
36
|
+
var common = require('./common')(suites, context, mocha);
|
|
38
37
|
|
|
39
38
|
context.before = common.before;
|
|
40
39
|
context.after = common.after;
|
|
@@ -49,18 +48,24 @@ module.exports = function(suite) {
|
|
|
49
48
|
if (suites.length > 1) {
|
|
50
49
|
suites.shift();
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
return common.suite.create({
|
|
52
|
+
title: title,
|
|
53
|
+
file: file
|
|
54
|
+
});
|
|
56
55
|
};
|
|
57
56
|
|
|
58
57
|
/**
|
|
59
|
-
* Exclusive
|
|
58
|
+
* Exclusive Suite.
|
|
60
59
|
*/
|
|
61
60
|
|
|
62
|
-
context.suite.only = function(title
|
|
63
|
-
|
|
61
|
+
context.suite.only = function(title) {
|
|
62
|
+
if (suites.length > 1) {
|
|
63
|
+
suites.shift();
|
|
64
|
+
}
|
|
65
|
+
return common.suite.only({
|
|
66
|
+
title: title,
|
|
67
|
+
file: file
|
|
68
|
+
});
|
|
64
69
|
};
|
|
65
70
|
|
|
66
71
|
/**
|
package/lib/interfaces/tdd.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Module dependencies.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
var Suite = require('../suite');
|
|
6
5
|
var Test = require('../test');
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -34,7 +33,7 @@ module.exports = function(suite) {
|
|
|
34
33
|
var suites = [suite];
|
|
35
34
|
|
|
36
35
|
suite.on('pre-require', function(context, file, mocha) {
|
|
37
|
-
var common = require('./common')(suites, context);
|
|
36
|
+
var common = require('./common')(suites, context, mocha);
|
|
38
37
|
|
|
39
38
|
context.setup = common.beforeEach;
|
|
40
39
|
context.teardown = common.afterEach;
|
|
@@ -47,30 +46,33 @@ module.exports = function(suite) {
|
|
|
47
46
|
* nested suites and/or tests.
|
|
48
47
|
*/
|
|
49
48
|
context.suite = function(title, fn) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return suite;
|
|
49
|
+
return common.suite.create({
|
|
50
|
+
title: title,
|
|
51
|
+
file: file,
|
|
52
|
+
fn: fn
|
|
53
|
+
});
|
|
56
54
|
};
|
|
57
55
|
|
|
58
56
|
/**
|
|
59
57
|
* Pending suite.
|
|
60
58
|
*/
|
|
61
59
|
context.suite.skip = function(title, fn) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
return common.suite.skip({
|
|
61
|
+
title: title,
|
|
62
|
+
file: file,
|
|
63
|
+
fn: fn
|
|
64
|
+
});
|
|
67
65
|
};
|
|
68
66
|
|
|
69
67
|
/**
|
|
70
68
|
* Exclusive test-case.
|
|
71
69
|
*/
|
|
72
70
|
context.suite.only = function(title, fn) {
|
|
73
|
-
return common.suite.only(
|
|
71
|
+
return common.suite.only({
|
|
72
|
+
title: title,
|
|
73
|
+
file: file,
|
|
74
|
+
fn: fn
|
|
75
|
+
});
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
/**
|
package/lib/reporters/base.js
CHANGED
|
@@ -180,7 +180,7 @@ exports.list = function(failures) {
|
|
|
180
180
|
message = '';
|
|
181
181
|
}
|
|
182
182
|
var stack = err.stack || message;
|
|
183
|
-
var index = stack.indexOf(message);
|
|
183
|
+
var index = message ? stack.indexOf(message) : -1;
|
|
184
184
|
var actual = err.actual;
|
|
185
185
|
var expected = err.expected;
|
|
186
186
|
var escape = true;
|
package/lib/reporters/spec.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
var Base = require('./base');
|
|
6
6
|
var inherits = require('../utils').inherits;
|
|
7
7
|
var color = Base.color;
|
|
8
|
-
var cursor = Base.cursor;
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Expose `Spec`.
|
|
@@ -57,20 +56,17 @@ function Spec(runner) {
|
|
|
57
56
|
fmt = indent()
|
|
58
57
|
+ color('checkmark', ' ' + Base.symbols.ok)
|
|
59
58
|
+ color('pass', ' %s');
|
|
60
|
-
cursor.CR();
|
|
61
59
|
console.log(fmt, test.title);
|
|
62
60
|
} else {
|
|
63
61
|
fmt = indent()
|
|
64
62
|
+ color('checkmark', ' ' + Base.symbols.ok)
|
|
65
63
|
+ color('pass', ' %s')
|
|
66
64
|
+ color(test.speed, ' (%dms)');
|
|
67
|
-
cursor.CR();
|
|
68
65
|
console.log(fmt, test.title, test.duration);
|
|
69
66
|
}
|
|
70
67
|
});
|
|
71
68
|
|
|
72
69
|
runner.on('fail', function(test) {
|
|
73
|
-
cursor.CR();
|
|
74
70
|
console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
|
|
75
71
|
});
|
|
76
72
|
|
package/lib/runnable.js
CHANGED
|
@@ -366,7 +366,7 @@ Runnable.prototype.run = function(fn) {
|
|
|
366
366
|
return done(new Error('done() invoked with non-Error: ' + err));
|
|
367
367
|
}
|
|
368
368
|
if (result && utils.isPromise(result)) {
|
|
369
|
-
return done(new Error('
|
|
369
|
+
return done(new Error('Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'));
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
done();
|