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/lib/reporters/doc.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* @module Doc
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Module dependencies.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var Base = require('./base');
|
|
10
|
-
var utils = require('../utils');
|
|
11
|
-
var constants = require('../runner').constants;
|
|
12
|
-
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
|
13
|
-
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
|
14
|
-
var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
|
|
15
|
-
var EVENT_SUITE_END = constants.EVENT_SUITE_END;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Expose `Doc`.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
exports = module.exports = Doc;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new `Doc` reporter instance.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
* @class
|
|
28
|
-
* @memberof Mocha.reporters
|
|
29
|
-
* @extends Mocha.reporters.Base
|
|
30
|
-
* @param {Runner} runner - Instance triggers reporter actions.
|
|
31
|
-
* @param {Object} [options] - runner options
|
|
32
|
-
*/
|
|
33
|
-
function Doc(runner, options) {
|
|
34
|
-
Base.call(this, runner, options);
|
|
35
|
-
|
|
36
|
-
var indents = 2;
|
|
37
|
-
|
|
38
|
-
function indent() {
|
|
39
|
-
return Array(indents).join(' ');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
43
|
-
if (suite.root) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
++indents;
|
|
47
|
-
console.log('%s<section class="suite">', indent());
|
|
48
|
-
++indents;
|
|
49
|
-
console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
|
|
50
|
-
console.log('%s<dl>', indent());
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
runner.on(EVENT_SUITE_END, function(suite) {
|
|
54
|
-
if (suite.root) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
console.log('%s</dl>', indent());
|
|
58
|
-
--indents;
|
|
59
|
-
console.log('%s</section>', indent());
|
|
60
|
-
--indents;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
64
|
-
console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
|
|
65
|
-
var code = utils.escape(utils.clean(test.body));
|
|
66
|
-
console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
70
|
-
console.log(
|
|
71
|
-
'%s <dt class="error">%s</dt>',
|
|
72
|
-
indent(),
|
|
73
|
-
utils.escape(test.title)
|
|
74
|
-
);
|
|
75
|
-
var code = utils.escape(utils.clean(test.body));
|
|
76
|
-
console.log(
|
|
77
|
-
'%s <dd class="error"><pre><code>%s</code></pre></dd>',
|
|
78
|
-
indent(),
|
|
79
|
-
code
|
|
80
|
-
);
|
|
81
|
-
console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
Doc.description = 'HTML documentation';
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @module Doc
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Module dependencies.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var Base = require('./base');
|
|
10
|
+
var utils = require('../utils');
|
|
11
|
+
var constants = require('../runner').constants;
|
|
12
|
+
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
|
13
|
+
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
|
14
|
+
var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
|
|
15
|
+
var EVENT_SUITE_END = constants.EVENT_SUITE_END;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Expose `Doc`.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
exports = module.exports = Doc;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a new `Doc` reporter instance.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @class
|
|
28
|
+
* @memberof Mocha.reporters
|
|
29
|
+
* @extends Mocha.reporters.Base
|
|
30
|
+
* @param {Runner} runner - Instance triggers reporter actions.
|
|
31
|
+
* @param {Object} [options] - runner options
|
|
32
|
+
*/
|
|
33
|
+
function Doc(runner, options) {
|
|
34
|
+
Base.call(this, runner, options);
|
|
35
|
+
|
|
36
|
+
var indents = 2;
|
|
37
|
+
|
|
38
|
+
function indent() {
|
|
39
|
+
return Array(indents).join(' ');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
43
|
+
if (suite.root) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
++indents;
|
|
47
|
+
console.log('%s<section class="suite">', indent());
|
|
48
|
+
++indents;
|
|
49
|
+
console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
|
|
50
|
+
console.log('%s<dl>', indent());
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
runner.on(EVENT_SUITE_END, function(suite) {
|
|
54
|
+
if (suite.root) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
console.log('%s</dl>', indent());
|
|
58
|
+
--indents;
|
|
59
|
+
console.log('%s</section>', indent());
|
|
60
|
+
--indents;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
runner.on(EVENT_TEST_PASS, function(test) {
|
|
64
|
+
console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
|
|
65
|
+
var code = utils.escape(utils.clean(test.body));
|
|
66
|
+
console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
70
|
+
console.log(
|
|
71
|
+
'%s <dt class="error">%s</dt>',
|
|
72
|
+
indent(),
|
|
73
|
+
utils.escape(test.title)
|
|
74
|
+
);
|
|
75
|
+
var code = utils.escape(utils.clean(test.body));
|
|
76
|
+
console.log(
|
|
77
|
+
'%s <dd class="error"><pre><code>%s</code></pre></dd>',
|
|
78
|
+
indent(),
|
|
79
|
+
code
|
|
80
|
+
);
|
|
81
|
+
console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Doc.description = 'HTML documentation';
|
package/lib/reporters/dot.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* @module Dot
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Module dependencies.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var Base = require('./base');
|
|
10
|
-
var inherits = require('../utils').inherits;
|
|
11
|
-
var constants = require('../runner').constants;
|
|
12
|
-
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
|
13
|
-
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
|
14
|
-
var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
|
15
|
-
var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
|
16
|
-
var EVENT_RUN_END = constants.EVENT_RUN_END;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Expose `Dot`.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
exports = module.exports = Dot;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Constructs a new `Dot` reporter instance.
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
* @class
|
|
29
|
-
* @memberof Mocha.reporters
|
|
30
|
-
* @extends Mocha.reporters.Base
|
|
31
|
-
* @param {Runner} runner - Instance triggers reporter actions.
|
|
32
|
-
* @param {Object} [options] - runner options
|
|
33
|
-
*/
|
|
34
|
-
function Dot(runner, options) {
|
|
35
|
-
Base.call(this, runner, options);
|
|
36
|
-
|
|
37
|
-
var self = this;
|
|
38
|
-
var width = (Base.window.width * 0.75) | 0;
|
|
39
|
-
var n = -1;
|
|
40
|
-
|
|
41
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
42
|
-
process.stdout.write('\n');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
runner.on(EVENT_TEST_PENDING, function() {
|
|
46
|
-
if (++n % width === 0) {
|
|
47
|
-
process.stdout.write('\n ');
|
|
48
|
-
}
|
|
49
|
-
process.stdout.write(Base.color('pending', Base.symbols.comma));
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
53
|
-
if (++n % width === 0) {
|
|
54
|
-
process.stdout.write('\n ');
|
|
55
|
-
}
|
|
56
|
-
if (test.speed === 'slow') {
|
|
57
|
-
process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
|
|
58
|
-
} else {
|
|
59
|
-
process.stdout.write(Base.color(test.speed, Base.symbols.dot));
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
runner.on(EVENT_TEST_FAIL, function() {
|
|
64
|
-
if (++n % width === 0) {
|
|
65
|
-
process.stdout.write('\n ');
|
|
66
|
-
}
|
|
67
|
-
process.stdout.write(Base.color('fail', Base.symbols.bang));
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
runner.once(EVENT_RUN_END, function() {
|
|
71
|
-
console.log();
|
|
72
|
-
self.epilogue();
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Inherit from `Base.prototype`.
|
|
78
|
-
*/
|
|
79
|
-
inherits(Dot, Base);
|
|
80
|
-
|
|
81
|
-
Dot.description = 'dot matrix representation';
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @module Dot
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Module dependencies.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var Base = require('./base');
|
|
10
|
+
var inherits = require('../utils').inherits;
|
|
11
|
+
var constants = require('../runner').constants;
|
|
12
|
+
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
|
13
|
+
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
|
14
|
+
var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
|
15
|
+
var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
|
16
|
+
var EVENT_RUN_END = constants.EVENT_RUN_END;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Expose `Dot`.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
exports = module.exports = Dot;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Constructs a new `Dot` reporter instance.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @class
|
|
29
|
+
* @memberof Mocha.reporters
|
|
30
|
+
* @extends Mocha.reporters.Base
|
|
31
|
+
* @param {Runner} runner - Instance triggers reporter actions.
|
|
32
|
+
* @param {Object} [options] - runner options
|
|
33
|
+
*/
|
|
34
|
+
function Dot(runner, options) {
|
|
35
|
+
Base.call(this, runner, options);
|
|
36
|
+
|
|
37
|
+
var self = this;
|
|
38
|
+
var width = (Base.window.width * 0.75) | 0;
|
|
39
|
+
var n = -1;
|
|
40
|
+
|
|
41
|
+
runner.on(EVENT_RUN_BEGIN, function() {
|
|
42
|
+
process.stdout.write('\n');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
runner.on(EVENT_TEST_PENDING, function() {
|
|
46
|
+
if (++n % width === 0) {
|
|
47
|
+
process.stdout.write('\n ');
|
|
48
|
+
}
|
|
49
|
+
process.stdout.write(Base.color('pending', Base.symbols.comma));
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
runner.on(EVENT_TEST_PASS, function(test) {
|
|
53
|
+
if (++n % width === 0) {
|
|
54
|
+
process.stdout.write('\n ');
|
|
55
|
+
}
|
|
56
|
+
if (test.speed === 'slow') {
|
|
57
|
+
process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
|
|
58
|
+
} else {
|
|
59
|
+
process.stdout.write(Base.color(test.speed, Base.symbols.dot));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
runner.on(EVENT_TEST_FAIL, function() {
|
|
64
|
+
if (++n % width === 0) {
|
|
65
|
+
process.stdout.write('\n ');
|
|
66
|
+
}
|
|
67
|
+
process.stdout.write(Base.color('fail', Base.symbols.bang));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
runner.once(EVENT_RUN_END, function() {
|
|
71
|
+
console.log();
|
|
72
|
+
self.epilogue();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Inherit from `Base.prototype`.
|
|
78
|
+
*/
|
|
79
|
+
inherits(Dot, Base);
|
|
80
|
+
|
|
81
|
+
Dot.description = 'dot matrix representation';
|