mocha 5.1.1 → 6.0.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 +686 -984
- package/README.md +2 -1
- package/{images → assets/growl}/error.png +0 -0
- package/{images → assets/growl}/ok.png +0 -0
- package/bin/_mocha +4 -595
- package/bin/mocha +121 -61
- package/bin/options.js +6 -39
- package/browser-entry.js +21 -17
- package/lib/browser/growl.js +165 -2
- package/lib/browser/progress.js +11 -11
- package/lib/{template.html → browser/template.html} +0 -0
- package/lib/browser/tty.js +2 -2
- package/lib/cli/cli.js +68 -0
- package/lib/cli/commands.js +13 -0
- package/lib/cli/config.js +79 -0
- package/lib/cli/index.js +9 -0
- package/lib/cli/init.js +37 -0
- package/lib/cli/node-flags.js +69 -0
- package/lib/cli/one-and-dones.js +70 -0
- package/lib/cli/options.js +330 -0
- package/lib/cli/run-helpers.js +337 -0
- package/lib/cli/run-option-metadata.js +76 -0
- package/lib/cli/run.js +297 -0
- package/lib/context.js +14 -14
- package/lib/errors.js +141 -0
- package/lib/growl.js +136 -0
- package/lib/hook.js +5 -16
- package/lib/interfaces/bdd.js +16 -13
- package/lib/interfaces/common.js +62 -18
- package/lib/interfaces/exports.js +5 -8
- package/lib/interfaces/qunit.js +10 -10
- package/lib/interfaces/tdd.js +12 -11
- package/lib/mocha.js +477 -256
- package/lib/mocharc.json +10 -0
- package/lib/pending.js +1 -5
- package/lib/reporters/base.js +95 -117
- package/lib/reporters/doc.js +23 -9
- package/lib/reporters/dot.js +19 -13
- package/lib/reporters/html.js +82 -47
- package/lib/reporters/json-stream.js +43 -23
- package/lib/reporters/json.js +32 -23
- package/lib/reporters/landing.js +16 -9
- package/lib/reporters/list.js +19 -11
- package/lib/reporters/markdown.js +18 -12
- package/lib/reporters/min.js +8 -4
- package/lib/reporters/nyan.js +42 -35
- package/lib/reporters/progress.js +12 -7
- package/lib/reporters/spec.js +23 -12
- package/lib/reporters/tap.js +250 -32
- package/lib/reporters/xunit.js +61 -35
- package/lib/runnable.js +152 -95
- package/lib/runner.js +296 -248
- package/lib/stats-collector.js +83 -0
- package/lib/suite.js +294 -75
- package/lib/test.js +16 -15
- package/lib/utils.js +419 -146
- package/mocha.js +4589 -2228
- package/package.json +137 -38
- package/lib/ms.js +0 -94
- package/lib/reporters/base.js.orig +0 -498
- package/lib/reporters/json.js.orig +0 -128
package/lib/test.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Module dependencies.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
2
|
var Runnable = require('./runnable');
|
|
8
3
|
var utils = require('./utils');
|
|
4
|
+
var errors = require('./errors');
|
|
5
|
+
var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
|
|
9
6
|
var isString = utils.isString;
|
|
10
7
|
|
|
11
|
-
/**
|
|
12
|
-
* Expose `Test`.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
8
|
module.exports = Test;
|
|
16
9
|
|
|
17
10
|
/**
|
|
18
11
|
* Initialize a new `Test` with the given `title` and callback `fn`.
|
|
19
12
|
*
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
13
|
+
* @public
|
|
14
|
+
* @class
|
|
15
|
+
* @extends Runnable
|
|
16
|
+
* @param {String} title - Test title (required)
|
|
17
|
+
* @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
|
|
23
18
|
*/
|
|
24
|
-
function Test
|
|
19
|
+
function Test(title, fn) {
|
|
25
20
|
if (!isString(title)) {
|
|
26
|
-
throw
|
|
21
|
+
throw createInvalidArgumentTypeError(
|
|
22
|
+
'Test argument "title" should be a string. Received type "' +
|
|
23
|
+
typeof title +
|
|
24
|
+
'"',
|
|
25
|
+
'title',
|
|
26
|
+
'string'
|
|
27
|
+
);
|
|
27
28
|
}
|
|
28
29
|
Runnable.call(this, title, fn);
|
|
29
30
|
this.pending = !fn;
|
|
@@ -35,7 +36,7 @@ function Test (title, fn) {
|
|
|
35
36
|
*/
|
|
36
37
|
utils.inherits(Test, Runnable);
|
|
37
38
|
|
|
38
|
-
Test.prototype.clone = function
|
|
39
|
+
Test.prototype.clone = function() {
|
|
39
40
|
var test = new Test(this.title, this.fn);
|
|
40
41
|
test.timeout(this.timeout());
|
|
41
42
|
test.slow(this.slow());
|