mocha 3.5.1 → 4.0.1
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 +93 -1
- package/README.md +1 -1
- package/bin/_mocha +9 -5
- package/browser-entry.js +3 -3
- package/lib/browser/growl.js +5 -0
- package/lib/context.js +1 -8
- package/lib/interfaces/common.js +0 -3
- package/lib/mocha.js +0 -1
- package/lib/reporters/base.js +17 -5
- package/lib/reporters/json-stream.js +0 -1
- package/lib/reporters/xunit.js +21 -6
- package/lib/runnable.js +12 -6
- package/lib/runner.js +42 -31
- package/lib/suite.js +20 -8
- package/lib/test.js +3 -5
- package/lib/utils.js +19 -198
- package/mocha.js +7563 -8782
- package/package.json +29 -33
- 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.0.1",
|
|
4
4
|
"description": "simple, flexible, fun test framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mocha",
|
|
@@ -295,55 +295,53 @@
|
|
|
295
295
|
"_mocha": "./bin/_mocha"
|
|
296
296
|
},
|
|
297
297
|
"engines": {
|
|
298
|
-
"node": ">= 0.
|
|
299
|
-
"npm": ">=
|
|
298
|
+
"node": ">= 4.0.0",
|
|
299
|
+
"npm": ">= 2.15.11"
|
|
300
300
|
},
|
|
301
301
|
"scripts": {
|
|
302
302
|
"lint": "eslint . bin/*",
|
|
303
|
-
"test": "make
|
|
304
|
-
"
|
|
303
|
+
"test": "make clean && make test",
|
|
304
|
+
"prepublishOnly": "npm test && make clean && make mocha.js",
|
|
305
305
|
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
|
306
306
|
},
|
|
307
307
|
"dependencies": {
|
|
308
308
|
"browser-stdout": "1.3.0",
|
|
309
|
-
"commander": "2.
|
|
310
|
-
"debug": "
|
|
311
|
-
"diff": "3.
|
|
309
|
+
"commander": "2.11.0",
|
|
310
|
+
"debug": "3.1.0",
|
|
311
|
+
"diff": "3.3.1",
|
|
312
312
|
"escape-string-regexp": "1.0.5",
|
|
313
|
-
"glob": "7.1.
|
|
314
|
-
"growl": "1.
|
|
313
|
+
"glob": "7.1.2",
|
|
314
|
+
"growl": "1.10.3",
|
|
315
315
|
"he": "1.1.1",
|
|
316
|
-
"json3": "3.3.2",
|
|
317
|
-
"lodash.create": "3.1.1",
|
|
318
316
|
"mkdirp": "0.5.1",
|
|
319
|
-
"supports-color": "
|
|
317
|
+
"supports-color": "4.4.0"
|
|
320
318
|
},
|
|
321
319
|
"devDependencies": {
|
|
322
|
-
"@coderbyheart/karma-sauce-launcher": "git://github.com/coderbyheart/karma-sauce-launcher#5259942cd6d40090eaa13ceeef5b0b8738c7710f",
|
|
323
320
|
"assert": "^1.4.1",
|
|
324
|
-
"browserify": "^
|
|
321
|
+
"browserify": "^14.4.0",
|
|
322
|
+
"buffer": "^4.9.1",
|
|
325
323
|
"coffee-script": "^1.10.0",
|
|
326
|
-
"coveralls": "^
|
|
324
|
+
"coveralls": "^3.0.0",
|
|
327
325
|
"cross-spawn": "^5.1.0",
|
|
328
|
-
"eslint": "^
|
|
329
|
-
"eslint-config-semistandard": "^
|
|
330
|
-
"eslint-config-standard": "^
|
|
326
|
+
"eslint": "^4.8.0",
|
|
327
|
+
"eslint-config-semistandard": "^11.0.0",
|
|
328
|
+
"eslint-config-standard": "^10.2.1",
|
|
329
|
+
"eslint-plugin-import": "^2.7.0",
|
|
330
|
+
"eslint-plugin-node": "^5.2.0",
|
|
331
331
|
"eslint-plugin-promise": "^3.4.0",
|
|
332
|
-
"eslint-plugin-standard": "
|
|
332
|
+
"eslint-plugin-standard": "^3.0.1",
|
|
333
333
|
"expect.js": "^0.3.1",
|
|
334
|
-
"karma": "1.
|
|
334
|
+
"karma": "^1.7.1",
|
|
335
335
|
"karma-browserify": "^5.0.5",
|
|
336
336
|
"karma-chrome-launcher": "^2.0.0",
|
|
337
337
|
"karma-expect": "^1.1.2",
|
|
338
338
|
"karma-mocha": "^1.3.0",
|
|
339
|
-
"karma-
|
|
340
|
-
"karma-
|
|
339
|
+
"karma-mocha-reporter": "^2.2.4",
|
|
340
|
+
"karma-phantomjs-launcher": "^1.0.4",
|
|
341
|
+
"karma-sauce-launcher": "^1.2.0",
|
|
341
342
|
"nyc": "^11.2.1",
|
|
342
|
-
"os-name": "^2.0.1",
|
|
343
|
-
"phantomjs": "1.9.8",
|
|
344
|
-
"readable-stream": "2.2.11",
|
|
345
343
|
"rimraf": "^2.5.2",
|
|
346
|
-
"should": "^
|
|
344
|
+
"should": "^13.1.0",
|
|
347
345
|
"through2": "^2.0.1",
|
|
348
346
|
"watchify": "^3.7.0"
|
|
349
347
|
},
|
|
@@ -354,19 +352,17 @@
|
|
|
354
352
|
"index.js",
|
|
355
353
|
"mocha.css",
|
|
356
354
|
"mocha.js",
|
|
357
|
-
"browser-entry.js"
|
|
358
|
-
"LICENSE",
|
|
359
|
-
"bower.json"
|
|
355
|
+
"browser-entry.js"
|
|
360
356
|
],
|
|
361
357
|
"browser": {
|
|
362
|
-
"
|
|
363
|
-
"events": "./lib/browser/events.js",
|
|
358
|
+
"growl": "./lib/browser/growl.js",
|
|
364
359
|
"tty": "./lib/browser/tty.js",
|
|
365
360
|
"./index.js": "./browser-entry.js",
|
|
366
361
|
"fs": false,
|
|
367
362
|
"glob": false,
|
|
368
363
|
"path": false,
|
|
369
|
-
"supports-color": false
|
|
364
|
+
"supports-color": false,
|
|
365
|
+
"buffer": "buffer"
|
|
370
366
|
},
|
|
371
367
|
"homepage": "https://mochajs.org",
|
|
372
368
|
"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;
|