mocha 10.8.2 → 11.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/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/runner.js +3 -3
- package/lib/suite.js +4 -4
- package/mocha.js +13 -13
- 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/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/mocha.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// mocha@
|
|
1
|
+
// mocha@11.0.1 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) :
|
|
@@ -13771,7 +13771,7 @@
|
|
|
13771
13771
|
var hook = this._createHook(title, fn);
|
|
13772
13772
|
this._beforeAll.push(hook);
|
|
13773
13773
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
|
|
13774
|
-
return
|
|
13774
|
+
return hook;
|
|
13775
13775
|
};
|
|
13776
13776
|
|
|
13777
13777
|
/**
|
|
@@ -13795,7 +13795,7 @@
|
|
|
13795
13795
|
var hook = this._createHook(title, fn);
|
|
13796
13796
|
this._afterAll.push(hook);
|
|
13797
13797
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
|
|
13798
|
-
return
|
|
13798
|
+
return hook;
|
|
13799
13799
|
};
|
|
13800
13800
|
|
|
13801
13801
|
/**
|
|
@@ -13819,7 +13819,7 @@
|
|
|
13819
13819
|
var hook = this._createHook(title, fn);
|
|
13820
13820
|
this._beforeEach.push(hook);
|
|
13821
13821
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
|
|
13822
|
-
return
|
|
13822
|
+
return hook;
|
|
13823
13823
|
};
|
|
13824
13824
|
|
|
13825
13825
|
/**
|
|
@@ -13843,7 +13843,7 @@
|
|
|
13843
13843
|
var hook = this._createHook(title, fn);
|
|
13844
13844
|
this._afterEach.push(hook);
|
|
13845
13845
|
this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
|
|
13846
|
-
return
|
|
13846
|
+
return hook;
|
|
13847
13847
|
};
|
|
13848
13848
|
|
|
13849
13849
|
/**
|
|
@@ -15296,11 +15296,11 @@
|
|
|
15296
15296
|
* @public
|
|
15297
15297
|
* @example
|
|
15298
15298
|
* // this reporter needs proper object references when run in parallel mode
|
|
15299
|
-
* class MyReporter
|
|
15299
|
+
* class MyReporter {
|
|
15300
15300
|
* constructor(runner) {
|
|
15301
|
-
*
|
|
15301
|
+
* runner.linkPartialObjects(true)
|
|
15302
15302
|
* .on(EVENT_SUITE_BEGIN, suite => {
|
|
15303
|
-
|
|
15303
|
+
* // this Suite may be the same object...
|
|
15304
15304
|
* })
|
|
15305
15305
|
* .on(EVENT_TEST_BEGIN, test => {
|
|
15306
15306
|
* // ...as the `test.parent` property
|
|
@@ -18593,7 +18593,7 @@
|
|
|
18593
18593
|
* @param {Function} fn
|
|
18594
18594
|
*/
|
|
18595
18595
|
before: function (name, fn) {
|
|
18596
|
-
suites[0].beforeAll(name, fn);
|
|
18596
|
+
return suites[0].beforeAll(name, fn);
|
|
18597
18597
|
},
|
|
18598
18598
|
|
|
18599
18599
|
/**
|
|
@@ -18603,7 +18603,7 @@
|
|
|
18603
18603
|
* @param {Function} fn
|
|
18604
18604
|
*/
|
|
18605
18605
|
after: function (name, fn) {
|
|
18606
|
-
suites[0].afterAll(name, fn);
|
|
18606
|
+
return suites[0].afterAll(name, fn);
|
|
18607
18607
|
},
|
|
18608
18608
|
|
|
18609
18609
|
/**
|
|
@@ -18613,7 +18613,7 @@
|
|
|
18613
18613
|
* @param {Function} fn
|
|
18614
18614
|
*/
|
|
18615
18615
|
beforeEach: function (name, fn) {
|
|
18616
|
-
suites[0].beforeEach(name, fn);
|
|
18616
|
+
return suites[0].beforeEach(name, fn);
|
|
18617
18617
|
},
|
|
18618
18618
|
|
|
18619
18619
|
/**
|
|
@@ -18623,7 +18623,7 @@
|
|
|
18623
18623
|
* @param {Function} fn
|
|
18624
18624
|
*/
|
|
18625
18625
|
afterEach: function (name, fn) {
|
|
18626
|
-
suites[0].afterEach(name, fn);
|
|
18626
|
+
return suites[0].afterEach(name, fn);
|
|
18627
18627
|
},
|
|
18628
18628
|
|
|
18629
18629
|
suite: {
|
|
@@ -19201,7 +19201,7 @@
|
|
|
19201
19201
|
};
|
|
19202
19202
|
|
|
19203
19203
|
var name = "mocha";
|
|
19204
|
-
var version = "
|
|
19204
|
+
var version = "11.0.1";
|
|
19205
19205
|
var homepage = "https://mochajs.org/";
|
|
19206
19206
|
var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
|
|
19207
19207
|
var require$$17 = {
|