mocha 10.8.1 → 11.0.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.
@@ -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: {
@@ -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
 
@@ -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 parameter if present
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/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 this;
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 this;
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 this;
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 this;
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
- if (Object.prototype.hasOwnProperty.call(obj, k)) {
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@10.8.1 in javascript ES2018
1
+ // mocha@11.0.0 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
- if (Object.prototype.hasOwnProperty.call(obj, k)) {
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 this;
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 this;
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 this;
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 this;
13846
+ return hook;
13845
13847
  };
13846
13848
 
13847
13849
  /**
@@ -16981,9 +16983,9 @@
16981
16983
  function makeUrl(s) {
16982
16984
  var search = window.location.search;
16983
16985
 
16984
- // Remove previous grep query parameter if present
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 = "10.8.1";
19204
+ var version = "11.0.0";
19203
19205
  var homepage = "https://mochajs.org/";
19204
19206
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
19205
19207
  var require$$17 = {