mocha 10.0.0 → 10.2.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/mocha.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@10.0.0 in javascript ES2018
1
+ // mocha@10.2.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) :
@@ -10899,7 +10899,7 @@
10899
10899
  .replace(/^\uFEFF/, '')
10900
10900
  // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
10901
10901
  .replace(
10902
- /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
10902
+ /^function(?:\s*|\s[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\}|((?:.|\n)*))$/,
10903
10903
  '$1$2$3'
10904
10904
  );
10905
10905
 
@@ -16542,6 +16542,20 @@
16542
16542
  */
16543
16543
  Progress.prototype.draw = function (ctx) {
16544
16544
  try {
16545
+ var darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
16546
+ var isDarkMode = !!darkMatcher.matches;
16547
+ var lightColors = {
16548
+ outerCircle: '#9f9f9f',
16549
+ innerCircle: '#eee',
16550
+ text: '#000'
16551
+ };
16552
+ var darkColors = {
16553
+ outerCircle: '#888',
16554
+ innerCircle: '#444',
16555
+ text: '#fff'
16556
+ };
16557
+ var colors = isDarkMode ? darkColors : lightColors;
16558
+
16545
16559
  var percent = Math.min(this.percent, 100);
16546
16560
  var size = this._size;
16547
16561
  var half = size / 2;
@@ -16556,13 +16570,13 @@
16556
16570
  ctx.clearRect(0, 0, size, size);
16557
16571
 
16558
16572
  // outer circle
16559
- ctx.strokeStyle = '#9f9f9f';
16573
+ ctx.strokeStyle = colors.outerCircle;
16560
16574
  ctx.beginPath();
16561
16575
  ctx.arc(x, y, rad, 0, angle, false);
16562
16576
  ctx.stroke();
16563
16577
 
16564
16578
  // inner circle
16565
- ctx.strokeStyle = '#eee';
16579
+ ctx.strokeStyle = colors.innerCircle;
16566
16580
  ctx.beginPath();
16567
16581
  ctx.arc(x, y, rad - 1, 0, angle, true);
16568
16582
  ctx.stroke();
@@ -16571,6 +16585,7 @@
16571
16585
  var text = this._text || (percent | 0) + '%';
16572
16586
  var w = ctx.measureText(text).width;
16573
16587
 
16588
+ ctx.fillStyle = colors.text;
16574
16589
  ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
16575
16590
  } catch (ignore) {
16576
16591
  // don't fail if we can't render progress
@@ -17766,7 +17781,7 @@
17766
17781
  var ret = obj;
17767
17782
  var key = SUITE_PREFIX + suite.title;
17768
17783
 
17769
- obj = obj[key] = obj[key] || {suite: suite};
17784
+ obj = obj[key] = obj[key] || {suite};
17770
17785
  suite.suites.forEach(function (suite) {
17771
17786
  mapTOC(suite, obj);
17772
17787
  });
@@ -18096,7 +18111,7 @@
18096
18111
  var total = runner.total;
18097
18112
 
18098
18113
  runner.once(EVENT_RUN_BEGIN, function () {
18099
- writeEvent(['start', {total: total}]);
18114
+ writeEvent(['start', {total}]);
18100
18115
  });
18101
18116
 
18102
18117
  runner.on(EVENT_TEST_PASS, function (test) {
@@ -18628,9 +18643,9 @@
18628
18643
 
18629
18644
  context.describe = context.context = function (title, fn) {
18630
18645
  return common$1.suite.create({
18631
- title: title,
18632
- file: file,
18633
- fn: fn
18646
+ title,
18647
+ file,
18648
+ fn
18634
18649
  });
18635
18650
  };
18636
18651
 
@@ -18643,9 +18658,9 @@
18643
18658
  context.describe.skip =
18644
18659
  function (title, fn) {
18645
18660
  return common$1.suite.skip({
18646
- title: title,
18647
- file: file,
18648
- fn: fn
18661
+ title,
18662
+ file,
18663
+ fn
18649
18664
  });
18650
18665
  };
18651
18666
 
@@ -18655,9 +18670,9 @@
18655
18670
 
18656
18671
  context.describe.only = function (title, fn) {
18657
18672
  return common$1.suite.only({
18658
- title: title,
18659
- file: file,
18660
- fn: fn
18673
+ title,
18674
+ file,
18675
+ fn
18661
18676
  });
18662
18677
  };
18663
18678
 
@@ -18750,9 +18765,9 @@
18750
18765
  */
18751
18766
  context.suite = function (title, fn) {
18752
18767
  return common$1.suite.create({
18753
- title: title,
18754
- file: file,
18755
- fn: fn
18768
+ title,
18769
+ file,
18770
+ fn
18756
18771
  });
18757
18772
  };
18758
18773
 
@@ -18761,9 +18776,9 @@
18761
18776
  */
18762
18777
  context.suite.skip = function (title, fn) {
18763
18778
  return common$1.suite.skip({
18764
- title: title,
18765
- file: file,
18766
- fn: fn
18779
+ title,
18780
+ file,
18781
+ fn
18767
18782
  });
18768
18783
  };
18769
18784
 
@@ -18772,9 +18787,9 @@
18772
18787
  */
18773
18788
  context.suite.only = function (title, fn) {
18774
18789
  return common$1.suite.only({
18775
- title: title,
18776
- file: file,
18777
- fn: fn
18790
+ title,
18791
+ file,
18792
+ fn
18778
18793
  });
18779
18794
  };
18780
18795
 
@@ -18859,8 +18874,8 @@
18859
18874
  suites.shift();
18860
18875
  }
18861
18876
  return common$1.suite.create({
18862
- title: title,
18863
- file: file,
18877
+ title,
18878
+ file,
18864
18879
  fn: false
18865
18880
  });
18866
18881
  };
@@ -18874,8 +18889,8 @@
18874
18889
  suites.shift();
18875
18890
  }
18876
18891
  return common$1.suite.only({
18877
- title: title,
18878
- file: file,
18892
+ title,
18893
+ file,
18879
18894
  fn: false
18880
18895
  });
18881
18896
  };
@@ -19061,7 +19076,7 @@
19061
19076
  };
19062
19077
 
19063
19078
  var name = "mocha";
19064
- var version = "10.0.0";
19079
+ var version = "10.2.0";
19065
19080
  var homepage = "https://mochajs.org/";
19066
19081
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
19067
19082
  var require$$17 = {
@@ -19502,6 +19517,8 @@
19502
19517
  * @see {@link Mocha#addFile}
19503
19518
  * @see {@link Mocha#run}
19504
19519
  * @see {@link Mocha#unloadFiles}
19520
+ * @param {Object} [options] - Settings object.
19521
+ * @param {Function} [options.esmDecorator] - Function invoked on esm module name right before importing it. By default will passthrough as is.
19505
19522
  * @returns {Promise}
19506
19523
  * @example
19507
19524
  *
@@ -19510,7 +19527,7 @@
19510
19527
  * .then(() => mocha.run(failures => process.exitCode = failures ? 1 : 0))
19511
19528
  * .catch(() => process.exitCode = 1);
19512
19529
  */
19513
- Mocha.prototype.loadFilesAsync = function () {
19530
+ Mocha.prototype.loadFilesAsync = function ({esmDecorator} = {}) {
19514
19531
  var self = this;
19515
19532
  var suite = this.suite;
19516
19533
  this.lazyLoadFiles(true);
@@ -19523,7 +19540,8 @@
19523
19540
  function (file, resultModule) {
19524
19541
  suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
19525
19542
  suite.emit(EVENT_FILE_POST_REQUIRE, commonjsGlobal, file, self);
19526
- }
19543
+ },
19544
+ esmDecorator
19527
19545
  );
19528
19546
  };
19529
19547