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
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Module dependencies.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
2
|
var Suite = require('../suite');
|
|
8
3
|
var Test = require('../test');
|
|
9
4
|
|
|
@@ -24,12 +19,12 @@ var Test = require('../test');
|
|
|
24
19
|
*
|
|
25
20
|
* @param {Suite} suite Root suite.
|
|
26
21
|
*/
|
|
27
|
-
module.exports = function
|
|
22
|
+
module.exports = function(suite) {
|
|
28
23
|
var suites = [suite];
|
|
29
24
|
|
|
30
|
-
suite.on(
|
|
25
|
+
suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
|
|
31
26
|
|
|
32
|
-
function visit
|
|
27
|
+
function visit(obj, file) {
|
|
33
28
|
var suite;
|
|
34
29
|
for (var key in obj) {
|
|
35
30
|
if (typeof obj[key] === 'function') {
|
|
@@ -61,3 +56,5 @@ module.exports = function (suite) {
|
|
|
61
56
|
}
|
|
62
57
|
}
|
|
63
58
|
};
|
|
59
|
+
|
|
60
|
+
module.exports.description = 'Node.js module ("exports") style';
|
package/lib/interfaces/qunit.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Module dependencies.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
3
|
var Test = require('../test');
|
|
4
|
+
var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
|
|
5
|
+
.EVENT_FILE_PRE_REQUIRE;
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* QUnit-style interface:
|
|
@@ -31,10 +29,10 @@ var Test = require('../test');
|
|
|
31
29
|
*
|
|
32
30
|
* @param {Suite} suite Root suite.
|
|
33
31
|
*/
|
|
34
|
-
module.exports = function (suite) {
|
|
32
|
+
module.exports = function qUnitInterface(suite) {
|
|
35
33
|
var suites = [suite];
|
|
36
34
|
|
|
37
|
-
suite.on(
|
|
35
|
+
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
|
38
36
|
var common = require('./common')(suites, context, mocha);
|
|
39
37
|
|
|
40
38
|
context.before = common.before;
|
|
@@ -46,7 +44,7 @@ module.exports = function (suite) {
|
|
|
46
44
|
* Describe a "suite" with the given `title`.
|
|
47
45
|
*/
|
|
48
46
|
|
|
49
|
-
context.suite = function
|
|
47
|
+
context.suite = function(title) {
|
|
50
48
|
if (suites.length > 1) {
|
|
51
49
|
suites.shift();
|
|
52
50
|
}
|
|
@@ -61,7 +59,7 @@ module.exports = function (suite) {
|
|
|
61
59
|
* Exclusive Suite.
|
|
62
60
|
*/
|
|
63
61
|
|
|
64
|
-
context.suite.only = function
|
|
62
|
+
context.suite.only = function(title) {
|
|
65
63
|
if (suites.length > 1) {
|
|
66
64
|
suites.shift();
|
|
67
65
|
}
|
|
@@ -78,7 +76,7 @@ module.exports = function (suite) {
|
|
|
78
76
|
* acting as a thunk.
|
|
79
77
|
*/
|
|
80
78
|
|
|
81
|
-
context.test = function
|
|
79
|
+
context.test = function(title, fn) {
|
|
82
80
|
var test = new Test(title, fn);
|
|
83
81
|
test.file = file;
|
|
84
82
|
suites[0].addTest(test);
|
|
@@ -89,7 +87,7 @@ module.exports = function (suite) {
|
|
|
89
87
|
* Exclusive test-case.
|
|
90
88
|
*/
|
|
91
89
|
|
|
92
|
-
context.test.only = function
|
|
90
|
+
context.test.only = function(title, fn) {
|
|
93
91
|
return common.test.only(mocha, context.test(title, fn));
|
|
94
92
|
};
|
|
95
93
|
|
|
@@ -97,3 +95,5 @@ module.exports = function (suite) {
|
|
|
97
95
|
context.test.retries = common.test.retries;
|
|
98
96
|
});
|
|
99
97
|
};
|
|
98
|
+
|
|
99
|
+
module.exports.description = 'QUnit style';
|
package/lib/interfaces/tdd.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Module dependencies.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
3
|
var Test = require('../test');
|
|
4
|
+
var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
|
|
5
|
+
.EVENT_FILE_PRE_REQUIRE;
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* TDD-style interface:
|
|
@@ -31,10 +29,10 @@ var Test = require('../test');
|
|
|
31
29
|
*
|
|
32
30
|
* @param {Suite} suite Root suite.
|
|
33
31
|
*/
|
|
34
|
-
module.exports = function
|
|
32
|
+
module.exports = function(suite) {
|
|
35
33
|
var suites = [suite];
|
|
36
34
|
|
|
37
|
-
suite.on(
|
|
35
|
+
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
|
38
36
|
var common = require('./common')(suites, context, mocha);
|
|
39
37
|
|
|
40
38
|
context.setup = common.beforeEach;
|
|
@@ -47,7 +45,7 @@ module.exports = function (suite) {
|
|
|
47
45
|
* Describe a "suite" with the given `title` and callback `fn` containing
|
|
48
46
|
* nested suites and/or tests.
|
|
49
47
|
*/
|
|
50
|
-
context.suite = function
|
|
48
|
+
context.suite = function(title, fn) {
|
|
51
49
|
return common.suite.create({
|
|
52
50
|
title: title,
|
|
53
51
|
file: file,
|
|
@@ -58,7 +56,7 @@ module.exports = function (suite) {
|
|
|
58
56
|
/**
|
|
59
57
|
* Pending suite.
|
|
60
58
|
*/
|
|
61
|
-
context.suite.skip = function
|
|
59
|
+
context.suite.skip = function(title, fn) {
|
|
62
60
|
return common.suite.skip({
|
|
63
61
|
title: title,
|
|
64
62
|
file: file,
|
|
@@ -69,7 +67,7 @@ module.exports = function (suite) {
|
|
|
69
67
|
/**
|
|
70
68
|
* Exclusive test-case.
|
|
71
69
|
*/
|
|
72
|
-
context.suite.only = function
|
|
70
|
+
context.suite.only = function(title, fn) {
|
|
73
71
|
return common.suite.only({
|
|
74
72
|
title: title,
|
|
75
73
|
file: file,
|
|
@@ -81,7 +79,7 @@ module.exports = function (suite) {
|
|
|
81
79
|
* Describe a specification or test-case with the given `title` and
|
|
82
80
|
* callback `fn` acting as a thunk.
|
|
83
81
|
*/
|
|
84
|
-
context.test = function
|
|
82
|
+
context.test = function(title, fn) {
|
|
85
83
|
var suite = suites[0];
|
|
86
84
|
if (suite.isPending()) {
|
|
87
85
|
fn = null;
|
|
@@ -96,7 +94,7 @@ module.exports = function (suite) {
|
|
|
96
94
|
* Exclusive test-case.
|
|
97
95
|
*/
|
|
98
96
|
|
|
99
|
-
context.test.only = function
|
|
97
|
+
context.test.only = function(title, fn) {
|
|
100
98
|
return common.test.only(mocha, context.test(title, fn));
|
|
101
99
|
};
|
|
102
100
|
|
|
@@ -104,3 +102,6 @@ module.exports = function (suite) {
|
|
|
104
102
|
context.test.retries = common.test.retries;
|
|
105
103
|
});
|
|
106
104
|
};
|
|
105
|
+
|
|
106
|
+
module.exports.description =
|
|
107
|
+
'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
|