mocha 3.5.2 → 4.1.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 +134 -0
- package/README.md +14 -14
- package/bin/.eslintrc.yml +3 -0
- package/bin/_mocha +162 -151
- package/bin/mocha +12 -10
- package/bin/options.js +8 -6
- package/browser-entry.js +3 -3
- package/lib/browser/{.eslintrc.yaml → .eslintrc.yml} +0 -0
- package/lib/browser/growl.js +5 -0
- package/lib/context.js +10 -23
- package/lib/interfaces/bdd.js +1 -1
- package/lib/interfaces/common.js +0 -3
- package/lib/mocha.js +23 -1
- package/lib/ms.js +4 -44
- package/lib/reporters/base.js +40 -44
- package/lib/reporters/base.js.orig +498 -0
- package/lib/reporters/json-stream.js +0 -1
- package/lib/reporters/progress.js +7 -5
- package/lib/reporters/xunit.js +21 -6
- package/lib/runnable.js +17 -11
- package/lib/runner.js +42 -31
- package/lib/suite.js +25 -13
- package/lib/test.js +3 -5
- package/lib/utils.js +20 -199
- package/mocha.js +7630 -8884
- package/package.json +37 -34
- package/bower.json +0 -38
- package/lib/browser/debug.js +0 -7
- package/lib/browser/events.js +0 -195
- package/lib/to-iso-string/LICENSE +0 -19
- package/lib/to-iso-string/index.js +0 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mocha",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "simple, flexible, fun test framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mocha",
|
|
@@ -198,6 +198,7 @@
|
|
|
198
198
|
"Nathan Houle <nathan+github@nathanhoule.com> (https://github.com/ndhoule)",
|
|
199
199
|
"Nathan Rajlich <nathan@tootallnate.net> (https://github.com/TooTallNate)",
|
|
200
200
|
"Nick Fitzgerald (https://github.com/fitzgen)",
|
|
201
|
+
"Nikolaos Georgiou (https://github.com/ngeor)",
|
|
201
202
|
"noirlab (https://github.com/noirlab)",
|
|
202
203
|
"Noshir Patel <nosh@blackpiano.com> (https://github.com/noshir-patel)",
|
|
203
204
|
"OlegTsyba <oleg.tsyba.ua@gmail.com> (https://github.com/OlegTsyba)",
|
|
@@ -295,55 +296,59 @@
|
|
|
295
296
|
"_mocha": "./bin/_mocha"
|
|
296
297
|
},
|
|
297
298
|
"engines": {
|
|
298
|
-
"node": ">= 0.
|
|
299
|
-
"npm": ">= 1.4.x"
|
|
299
|
+
"node": ">= 4.0.0"
|
|
300
300
|
},
|
|
301
301
|
"scripts": {
|
|
302
302
|
"lint": "eslint . bin/*",
|
|
303
|
-
"test": "make
|
|
304
|
-
"
|
|
305
|
-
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
|
303
|
+
"test": "make clean && make test",
|
|
304
|
+
"prepublishOnly": "npm test && make clean && make mocha.js",
|
|
305
|
+
"coveralls": "nyc report --reporter=text-lcov | coveralls",
|
|
306
|
+
"prebuildDocs": "rm -rf docs/_dist && node scripts/docs-update-toc.js",
|
|
307
|
+
"buildDocs": "bundle exec jekyll build --source ./docs --destination ./docs/_site --config ./docs/_config.yml --safe --drafts",
|
|
308
|
+
"postbuildDocs": "buildProduction docs/_site/index.html --outroot docs/_dist --canonicalroot https://mochajs.org/ --optimizeimages --svgo --inlinehtmlimage 9400 --inlinehtmlscript 0 --asyncscripts && cp docs/_headers docs/_dist/_headers && node scripts/netlify-headers.js >> docs/_dist/_headers",
|
|
309
|
+
"prewatchDocs": "node scripts/docs-update-toc.js",
|
|
310
|
+
"watchDocs": "bundle exec jekyll serve --source ./docs --destination ./docs/_site --config ./docs/_config.yml --safe --drafts --watch"
|
|
306
311
|
},
|
|
307
312
|
"dependencies": {
|
|
308
313
|
"browser-stdout": "1.3.0",
|
|
309
|
-
"commander": "2.
|
|
310
|
-
"debug": "
|
|
311
|
-
"diff": "3.
|
|
314
|
+
"commander": "2.11.0",
|
|
315
|
+
"debug": "3.1.0",
|
|
316
|
+
"diff": "3.3.1",
|
|
312
317
|
"escape-string-regexp": "1.0.5",
|
|
313
|
-
"glob": "7.1.
|
|
314
|
-
"growl": "1.
|
|
318
|
+
"glob": "7.1.2",
|
|
319
|
+
"growl": "1.10.3",
|
|
315
320
|
"he": "1.1.1",
|
|
316
|
-
"json3": "3.3.2",
|
|
317
|
-
"lodash.create": "3.1.1",
|
|
318
321
|
"mkdirp": "0.5.1",
|
|
319
|
-
"supports-color": "
|
|
322
|
+
"supports-color": "4.4.0"
|
|
320
323
|
},
|
|
321
324
|
"devDependencies": {
|
|
322
|
-
"@coderbyheart/karma-sauce-launcher": "git://github.com/coderbyheart/karma-sauce-launcher#5259942cd6d40090eaa13ceeef5b0b8738c7710f",
|
|
323
325
|
"assert": "^1.4.1",
|
|
324
|
-
"
|
|
326
|
+
"assetgraph-builder": "^5.6.4",
|
|
327
|
+
"browserify": "^14.4.0",
|
|
328
|
+
"buffer": "^4.9.1",
|
|
325
329
|
"coffee-script": "^1.10.0",
|
|
326
|
-
"coveralls": "^
|
|
330
|
+
"coveralls": "^3.0.0",
|
|
327
331
|
"cross-spawn": "^5.1.0",
|
|
328
|
-
"eslint": "^
|
|
329
|
-
"eslint-config-semistandard": "^
|
|
330
|
-
"eslint-config-standard": "^
|
|
332
|
+
"eslint": "^4.8.0",
|
|
333
|
+
"eslint-config-semistandard": "^11.0.0",
|
|
334
|
+
"eslint-config-standard": "^10.2.1",
|
|
335
|
+
"eslint-plugin-import": "^2.7.0",
|
|
336
|
+
"eslint-plugin-node": "^5.2.0",
|
|
331
337
|
"eslint-plugin-promise": "^3.4.0",
|
|
332
|
-
"eslint-plugin-standard": "
|
|
338
|
+
"eslint-plugin-standard": "^3.0.1",
|
|
333
339
|
"expect.js": "^0.3.1",
|
|
334
|
-
"karma": "1.
|
|
340
|
+
"karma": "^1.7.1",
|
|
335
341
|
"karma-browserify": "^5.0.5",
|
|
336
342
|
"karma-chrome-launcher": "^2.0.0",
|
|
337
343
|
"karma-expect": "^1.1.2",
|
|
338
344
|
"karma-mocha": "^1.3.0",
|
|
339
|
-
"karma-
|
|
340
|
-
"karma-
|
|
345
|
+
"karma-mocha-reporter": "^2.2.4",
|
|
346
|
+
"karma-phantomjs-launcher": "^1.0.4",
|
|
347
|
+
"karma-sauce-launcher": "^1.2.0",
|
|
348
|
+
"markdown-toc": "^1.2.0",
|
|
341
349
|
"nyc": "^11.2.1",
|
|
342
|
-
"os-name": "^2.0.1",
|
|
343
|
-
"phantomjs": "1.9.8",
|
|
344
|
-
"readable-stream": "2.2.11",
|
|
345
350
|
"rimraf": "^2.5.2",
|
|
346
|
-
"
|
|
351
|
+
"svgo": "^0.7.2",
|
|
347
352
|
"through2": "^2.0.1",
|
|
348
353
|
"watchify": "^3.7.0"
|
|
349
354
|
},
|
|
@@ -354,19 +359,17 @@
|
|
|
354
359
|
"index.js",
|
|
355
360
|
"mocha.css",
|
|
356
361
|
"mocha.js",
|
|
357
|
-
"browser-entry.js"
|
|
358
|
-
"LICENSE",
|
|
359
|
-
"bower.json"
|
|
362
|
+
"browser-entry.js"
|
|
360
363
|
],
|
|
361
364
|
"browser": {
|
|
362
|
-
"
|
|
363
|
-
"events": "./lib/browser/events.js",
|
|
365
|
+
"growl": "./lib/browser/growl.js",
|
|
364
366
|
"tty": "./lib/browser/tty.js",
|
|
365
367
|
"./index.js": "./browser-entry.js",
|
|
366
368
|
"fs": false,
|
|
367
369
|
"glob": false,
|
|
368
370
|
"path": false,
|
|
369
|
-
"supports-color": false
|
|
371
|
+
"supports-color": false,
|
|
372
|
+
"buffer": "buffer"
|
|
370
373
|
},
|
|
371
374
|
"homepage": "https://mochajs.org",
|
|
372
375
|
"logo": "https://cldup.com/S9uQ-cOLYz.svg"
|
package/bower.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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/browser/debug.js
DELETED
package/lib/browser/events.js
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Module exports.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
exports.EventEmitter = EventEmitter;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Object#toString reference.
|
|
11
|
-
*/
|
|
12
|
-
var objToString = Object.prototype.toString;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Check if a value is an array.
|
|
16
|
-
*
|
|
17
|
-
* @api private
|
|
18
|
-
* @param {*} val The value to test.
|
|
19
|
-
* @return {boolean} true if the value is an array, otherwise false.
|
|
20
|
-
*/
|
|
21
|
-
function isArray (val) {
|
|
22
|
-
return objToString.call(val) === '[object Array]';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Event emitter constructor.
|
|
27
|
-
*
|
|
28
|
-
* @api public
|
|
29
|
-
*/
|
|
30
|
-
function EventEmitter () {}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Add a listener.
|
|
34
|
-
*
|
|
35
|
-
* @api public
|
|
36
|
-
* @param {string} name Event name.
|
|
37
|
-
* @param {Function} fn Event handler.
|
|
38
|
-
* @return {EventEmitter} Emitter instance.
|
|
39
|
-
*/
|
|
40
|
-
EventEmitter.prototype.on = function (name, fn) {
|
|
41
|
-
if (!this.$events) {
|
|
42
|
-
this.$events = {};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!this.$events[name]) {
|
|
46
|
-
this.$events[name] = fn;
|
|
47
|
-
} else if (isArray(this.$events[name])) {
|
|
48
|
-
this.$events[name].push(fn);
|
|
49
|
-
} else {
|
|
50
|
-
this.$events[name] = [this.$events[name], fn];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return this;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Adds a volatile listener.
|
|
60
|
-
*
|
|
61
|
-
* @api public
|
|
62
|
-
* @param {string} name Event name.
|
|
63
|
-
* @param {Function} fn Event handler.
|
|
64
|
-
* @return {EventEmitter} Emitter instance.
|
|
65
|
-
*/
|
|
66
|
-
EventEmitter.prototype.once = function (name, fn) {
|
|
67
|
-
var self = this;
|
|
68
|
-
|
|
69
|
-
function on () {
|
|
70
|
-
self.removeListener(name, on);
|
|
71
|
-
fn.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
on.listener = fn;
|
|
75
|
-
this.on(name, on);
|
|
76
|
-
|
|
77
|
-
return this;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Remove a listener.
|
|
82
|
-
*
|
|
83
|
-
* @api public
|
|
84
|
-
* @param {string} name Event name.
|
|
85
|
-
* @param {Function} fn Event handler.
|
|
86
|
-
* @return {EventEmitter} Emitter instance.
|
|
87
|
-
*/
|
|
88
|
-
EventEmitter.prototype.removeListener = function (name, fn) {
|
|
89
|
-
if (this.$events && this.$events[name]) {
|
|
90
|
-
var list = this.$events[name];
|
|
91
|
-
|
|
92
|
-
if (isArray(list)) {
|
|
93
|
-
var pos = -1;
|
|
94
|
-
|
|
95
|
-
for (var i = 0, l = list.length; i < l; i++) {
|
|
96
|
-
if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
|
|
97
|
-
pos = i;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (pos < 0) {
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
list.splice(pos, 1);
|
|
107
|
-
|
|
108
|
-
if (!list.length) {
|
|
109
|
-
delete this.$events[name];
|
|
110
|
-
}
|
|
111
|
-
} else if (list === fn || (list.listener && list.listener === fn)) {
|
|
112
|
-
delete this.$events[name];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return this;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Remove all listeners for an event.
|
|
121
|
-
*
|
|
122
|
-
* @api public
|
|
123
|
-
* @param {string} name Event name.
|
|
124
|
-
* @return {EventEmitter} Emitter instance.
|
|
125
|
-
*/
|
|
126
|
-
EventEmitter.prototype.removeAllListeners = function (name) {
|
|
127
|
-
if (name === undefined) {
|
|
128
|
-
this.$events = {};
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (this.$events && this.$events[name]) {
|
|
133
|
-
this.$events[name] = null;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return this;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Get all listeners for a given event.
|
|
141
|
-
*
|
|
142
|
-
* @api public
|
|
143
|
-
* @param {string} name Event name.
|
|
144
|
-
* @return {EventEmitter} Emitter instance.
|
|
145
|
-
*/
|
|
146
|
-
EventEmitter.prototype.listeners = function (name) {
|
|
147
|
-
if (!this.$events) {
|
|
148
|
-
this.$events = {};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (!this.$events[name]) {
|
|
152
|
-
this.$events[name] = [];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (!isArray(this.$events[name])) {
|
|
156
|
-
this.$events[name] = [this.$events[name]];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return this.$events[name];
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Emit an event.
|
|
164
|
-
*
|
|
165
|
-
* @api public
|
|
166
|
-
* @param {string} name Event name.
|
|
167
|
-
* @return {boolean} true if at least one handler was invoked, else false.
|
|
168
|
-
*/
|
|
169
|
-
EventEmitter.prototype.emit = function (name) {
|
|
170
|
-
if (!this.$events) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
var handler = this.$events[name];
|
|
175
|
-
|
|
176
|
-
if (!handler) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
181
|
-
|
|
182
|
-
if (typeof handler === 'function') {
|
|
183
|
-
handler.apply(this, args);
|
|
184
|
-
} else if (isArray(handler)) {
|
|
185
|
-
var listeners = handler.slice();
|
|
186
|
-
|
|
187
|
-
for (var i = 0, l = listeners.length; i < l; i++) {
|
|
188
|
-
listeners[i].apply(this, args);
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return true;
|
|
195
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2016 Segment.io, Inc. (friends@segment.com)
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pad a `number` with a ten's place zero.
|
|
5
|
-
*
|
|
6
|
-
* @param {number} number
|
|
7
|
-
* @return {string}
|
|
8
|
-
*/
|
|
9
|
-
function pad(number) {
|
|
10
|
-
var n = number.toString();
|
|
11
|
-
return n.length === 1 ? '0' + n : n;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Turn a `date` into an ISO string.
|
|
16
|
-
*
|
|
17
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
|
18
|
-
*
|
|
19
|
-
* @param {Date} date
|
|
20
|
-
* @return {string}
|
|
21
|
-
*/
|
|
22
|
-
function toISOString(date) {
|
|
23
|
-
return date.getUTCFullYear()
|
|
24
|
-
+ '-' + pad(date.getUTCMonth() + 1)
|
|
25
|
-
+ '-' + pad(date.getUTCDate())
|
|
26
|
-
+ 'T' + pad(date.getUTCHours())
|
|
27
|
-
+ ':' + pad(date.getUTCMinutes())
|
|
28
|
-
+ ':' + pad(date.getUTCSeconds())
|
|
29
|
-
+ '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5)
|
|
30
|
-
+ 'Z';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* Exports.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
module.exports = toISOString;
|