mocha 10.8.1 → 11.0.0-beta
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/lib/cli/lookup-files.js +9 -4
- package/lib/interfaces/common.js +4 -4
- package/lib/nodejs/parallel-buffered-runner.js +9 -9
- package/lib/nodejs/serializer.js +7 -1
- package/lib/reporters/html.js +2 -2
- package/lib/runner.js +3 -3
- package/lib/suite.js +4 -4
- package/lib/utils.js +3 -1
- package/mocha.js +18 -16
- package/mocha.js.map +1 -1
- package/package.json +5 -3
package/lib/cli/lookup-files.js
CHANGED
|
@@ -87,10 +87,15 @@ module.exports = function lookupFiles(
|
|
|
87
87
|
debug('looking for files using glob pattern: %s', pattern);
|
|
88
88
|
}
|
|
89
89
|
files.push(
|
|
90
|
-
...glob
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
...glob
|
|
91
|
+
.sync(pattern, {
|
|
92
|
+
nodir: true,
|
|
93
|
+
windowsPathsNoEscape: true
|
|
94
|
+
})
|
|
95
|
+
// glob@8 and earlier sorted results in en; glob@9 depends on OS sorting.
|
|
96
|
+
// This preserves the older glob behavior.
|
|
97
|
+
// https://github.com/mochajs/mocha/pull/5250/files#r1840469747
|
|
98
|
+
.sort((a, b) => a.localeCompare(b, 'en'))
|
|
94
99
|
);
|
|
95
100
|
if (!files.length) {
|
|
96
101
|
throw createNoFilesMatchPatternError(
|
package/lib/interfaces/common.js
CHANGED
|
@@ -57,7 +57,7 @@ module.exports = function (suites, context, mocha) {
|
|
|
57
57
|
* @param {Function} fn
|
|
58
58
|
*/
|
|
59
59
|
before: function (name, fn) {
|
|
60
|
-
suites[0].beforeAll(name, fn);
|
|
60
|
+
return suites[0].beforeAll(name, fn);
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
/**
|
|
@@ -67,7 +67,7 @@ module.exports = function (suites, context, mocha) {
|
|
|
67
67
|
* @param {Function} fn
|
|
68
68
|
*/
|
|
69
69
|
after: function (name, fn) {
|
|
70
|
-
suites[0].afterAll(name, fn);
|
|
70
|
+
return suites[0].afterAll(name, fn);
|
|
71
71
|
},
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -77,7 +77,7 @@ module.exports = function (suites, context, mocha) {
|
|
|
77
77
|
* @param {Function} fn
|
|
78
78
|
*/
|
|
79
79
|
beforeEach: function (name, fn) {
|
|
80
|
-
suites[0].beforeEach(name, fn);
|
|
80
|
+
return suites[0].beforeEach(name, fn);
|
|
81
81
|
},
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -87,7 +87,7 @@ module.exports = function (suites, context, mocha) {
|
|
|
87
87
|
* @param {Function} fn
|
|
88
88
|
*/
|
|
89
89
|
afterEach: function (name, fn) {
|
|
90
|
-
suites[0].afterEach(name, fn);
|
|
90
|
+
return suites[0].afterEach(name, fn);
|
|
91
91
|
},
|
|
92
92
|
|
|
93
93
|
suite: {
|
|
@@ -374,16 +374,16 @@ class ParallelBufferedRunner extends Runner {
|
|
|
374
374
|
* // this reporter needs proper object references when run in parallel mode
|
|
375
375
|
* class MyReporter() {
|
|
376
376
|
* constructor(runner) {
|
|
377
|
-
*
|
|
377
|
+
* runner.linkPartialObjects(true)
|
|
378
378
|
* .on(EVENT_SUITE_BEGIN, suite => {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
379
|
+
* // this Suite may be the same object...
|
|
380
|
+
* })
|
|
381
|
+
* .on(EVENT_TEST_BEGIN, test => {
|
|
382
|
+
* // ...as the `test.parent` property
|
|
383
|
+
* });
|
|
384
|
+
* }
|
|
385
|
+
* }
|
|
386
|
+
*/
|
|
387
387
|
linkPartialObjects(value) {
|
|
388
388
|
this._linkPartialObjects = Boolean(value);
|
|
389
389
|
return super.linkPartialObjects(value);
|
package/lib/nodejs/serializer.js
CHANGED
|
@@ -262,9 +262,15 @@ class SerializableEvent {
|
|
|
262
262
|
breakCircularDeps(result.error);
|
|
263
263
|
|
|
264
264
|
const pairs = Object.keys(result).map(key => [result, key]);
|
|
265
|
-
|
|
265
|
+
const seenPairs = new Set();
|
|
266
266
|
let pair;
|
|
267
|
+
|
|
267
268
|
while ((pair = pairs.shift())) {
|
|
269
|
+
if (seenPairs.has(pair[1])) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
seenPairs.add(pair[1]);
|
|
268
274
|
SerializableEvent._serialize(pairs, ...pair);
|
|
269
275
|
}
|
|
270
276
|
|
package/lib/reporters/html.js
CHANGED
|
@@ -285,9 +285,9 @@ function HTML(runner, options) {
|
|
|
285
285
|
function makeUrl(s) {
|
|
286
286
|
var search = window.location.search;
|
|
287
287
|
|
|
288
|
-
// Remove previous grep query
|
|
288
|
+
// Remove previous {grep, fgrep, invert} query parameters if present
|
|
289
289
|
if (search) {
|
|
290
|
-
search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
|
|
290
|
+
search = search.replace(/[?&](?:f?grep|invert)=[^&\s]*/g, '').replace(/^&/, '?');
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
return (
|
package/lib/runner.js
CHANGED
|
@@ -1116,11 +1116,11 @@ Runner.prototype.run = function (fn, opts = {}) {
|
|
|
1116
1116
|
* @public
|
|
1117
1117
|
* @example
|
|
1118
1118
|
* // this reporter needs proper object references when run in parallel mode
|
|
1119
|
-
* class MyReporter
|
|
1119
|
+
* class MyReporter {
|
|
1120
1120
|
* constructor(runner) {
|
|
1121
|
-
*
|
|
1121
|
+
* runner.linkPartialObjects(true)
|
|
1122
1122
|
* .on(EVENT_SUITE_BEGIN, suite => {
|
|
1123
|
-
|
|
1123
|
+
* // this Suite may be the same object...
|
|
1124
1124
|
* })
|
|
1125
1125
|
* .on(EVENT_TEST_BEGIN, test => {
|
|
1126
1126
|
* // ...as the `test.parent` property
|
package/lib/suite.js
CHANGED
|
@@ -257,7 +257,7 @@ Suite.prototype.beforeAll = function (title, fn) {
|
|
|
257
257
|
var hook = this._createHook(title, fn);
|
|
258
258
|
this._beforeAll.push(hook);
|
|
259
259
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
|
|
260
|
-
return
|
|
260
|
+
return hook;
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
/**
|
|
@@ -281,7 +281,7 @@ Suite.prototype.afterAll = function (title, fn) {
|
|
|
281
281
|
var hook = this._createHook(title, fn);
|
|
282
282
|
this._afterAll.push(hook);
|
|
283
283
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
|
|
284
|
-
return
|
|
284
|
+
return hook;
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
/**
|
|
@@ -305,7 +305,7 @@ Suite.prototype.beforeEach = function (title, fn) {
|
|
|
305
305
|
var hook = this._createHook(title, fn);
|
|
306
306
|
this._beforeEach.push(hook);
|
|
307
307
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
|
|
308
|
-
return
|
|
308
|
+
return hook;
|
|
309
309
|
};
|
|
310
310
|
|
|
311
311
|
/**
|
|
@@ -329,7 +329,7 @@ Suite.prototype.afterEach = function (title, fn) {
|
|
|
329
329
|
var hook = this._createHook(title, fn);
|
|
330
330
|
this._afterEach.push(hook);
|
|
331
331
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
|
|
332
|
-
return
|
|
332
|
+
return hook;
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
/**
|
package/lib/utils.js
CHANGED
|
@@ -675,7 +675,9 @@ exports.breakCircularDeps = inputObj => {
|
|
|
675
675
|
|
|
676
676
|
seen.add(obj);
|
|
677
677
|
for (const k in obj) {
|
|
678
|
-
|
|
678
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, k);
|
|
679
|
+
|
|
680
|
+
if (descriptor && descriptor.writable) {
|
|
679
681
|
obj[k] = _breakCircularDeps(obj[k], k);
|
|
680
682
|
}
|
|
681
683
|
}
|
package/mocha.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// mocha@
|
|
1
|
+
// mocha@11.0.0-beta in javascript ES2018
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -11638,7 +11638,9 @@
|
|
|
11638
11638
|
|
|
11639
11639
|
seen.add(obj);
|
|
11640
11640
|
for (const k in obj) {
|
|
11641
|
-
|
|
11641
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, k);
|
|
11642
|
+
|
|
11643
|
+
if (descriptor && descriptor.writable) {
|
|
11642
11644
|
obj[k] = _breakCircularDeps(obj[k]);
|
|
11643
11645
|
}
|
|
11644
11646
|
}
|
|
@@ -13769,7 +13771,7 @@
|
|
|
13769
13771
|
var hook = this._createHook(title, fn);
|
|
13770
13772
|
this._beforeAll.push(hook);
|
|
13771
13773
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
|
|
13772
|
-
return
|
|
13774
|
+
return hook;
|
|
13773
13775
|
};
|
|
13774
13776
|
|
|
13775
13777
|
/**
|
|
@@ -13793,7 +13795,7 @@
|
|
|
13793
13795
|
var hook = this._createHook(title, fn);
|
|
13794
13796
|
this._afterAll.push(hook);
|
|
13795
13797
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
|
|
13796
|
-
return
|
|
13798
|
+
return hook;
|
|
13797
13799
|
};
|
|
13798
13800
|
|
|
13799
13801
|
/**
|
|
@@ -13817,7 +13819,7 @@
|
|
|
13817
13819
|
var hook = this._createHook(title, fn);
|
|
13818
13820
|
this._beforeEach.push(hook);
|
|
13819
13821
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
|
|
13820
|
-
return
|
|
13822
|
+
return hook;
|
|
13821
13823
|
};
|
|
13822
13824
|
|
|
13823
13825
|
/**
|
|
@@ -13841,7 +13843,7 @@
|
|
|
13841
13843
|
var hook = this._createHook(title, fn);
|
|
13842
13844
|
this._afterEach.push(hook);
|
|
13843
13845
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
|
|
13844
|
-
return
|
|
13846
|
+
return hook;
|
|
13845
13847
|
};
|
|
13846
13848
|
|
|
13847
13849
|
/**
|
|
@@ -15294,11 +15296,11 @@
|
|
|
15294
15296
|
* @public
|
|
15295
15297
|
* @example
|
|
15296
15298
|
* // this reporter needs proper object references when run in parallel mode
|
|
15297
|
-
* class MyReporter
|
|
15299
|
+
* class MyReporter {
|
|
15298
15300
|
* constructor(runner) {
|
|
15299
|
-
*
|
|
15301
|
+
* runner.linkPartialObjects(true)
|
|
15300
15302
|
* .on(EVENT_SUITE_BEGIN, suite => {
|
|
15301
|
-
|
|
15303
|
+
* // this Suite may be the same object...
|
|
15302
15304
|
* })
|
|
15303
15305
|
* .on(EVENT_TEST_BEGIN, test => {
|
|
15304
15306
|
* // ...as the `test.parent` property
|
|
@@ -16981,9 +16983,9 @@
|
|
|
16981
16983
|
function makeUrl(s) {
|
|
16982
16984
|
var search = window.location.search;
|
|
16983
16985
|
|
|
16984
|
-
// Remove previous grep query
|
|
16986
|
+
// Remove previous {grep, fgrep, invert} query parameters if present
|
|
16985
16987
|
if (search) {
|
|
16986
|
-
search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
|
|
16988
|
+
search = search.replace(/[?&](?:f?grep|invert)=[^&\s]*/g, '').replace(/^&/, '?');
|
|
16987
16989
|
}
|
|
16988
16990
|
|
|
16989
16991
|
return (
|
|
@@ -18591,7 +18593,7 @@
|
|
|
18591
18593
|
* @param {Function} fn
|
|
18592
18594
|
*/
|
|
18593
18595
|
before: function (name, fn) {
|
|
18594
|
-
suites[0].beforeAll(name, fn);
|
|
18596
|
+
return suites[0].beforeAll(name, fn);
|
|
18595
18597
|
},
|
|
18596
18598
|
|
|
18597
18599
|
/**
|
|
@@ -18601,7 +18603,7 @@
|
|
|
18601
18603
|
* @param {Function} fn
|
|
18602
18604
|
*/
|
|
18603
18605
|
after: function (name, fn) {
|
|
18604
|
-
suites[0].afterAll(name, fn);
|
|
18606
|
+
return suites[0].afterAll(name, fn);
|
|
18605
18607
|
},
|
|
18606
18608
|
|
|
18607
18609
|
/**
|
|
@@ -18611,7 +18613,7 @@
|
|
|
18611
18613
|
* @param {Function} fn
|
|
18612
18614
|
*/
|
|
18613
18615
|
beforeEach: function (name, fn) {
|
|
18614
|
-
suites[0].beforeEach(name, fn);
|
|
18616
|
+
return suites[0].beforeEach(name, fn);
|
|
18615
18617
|
},
|
|
18616
18618
|
|
|
18617
18619
|
/**
|
|
@@ -18621,7 +18623,7 @@
|
|
|
18621
18623
|
* @param {Function} fn
|
|
18622
18624
|
*/
|
|
18623
18625
|
afterEach: function (name, fn) {
|
|
18624
|
-
suites[0].afterEach(name, fn);
|
|
18626
|
+
return suites[0].afterEach(name, fn);
|
|
18625
18627
|
},
|
|
18626
18628
|
|
|
18627
18629
|
suite: {
|
|
@@ -19199,7 +19201,7 @@
|
|
|
19199
19201
|
};
|
|
19200
19202
|
|
|
19201
19203
|
var name = "mocha";
|
|
19202
|
-
var version = "
|
|
19204
|
+
var version = "11.0.0-beta";
|
|
19203
19205
|
var homepage = "https://mochajs.org/";
|
|
19204
19206
|
var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
|
|
19205
19207
|
var require$$17 = {
|