mocha 10.4.0 → 10.5.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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p align="center">☕️ Simple, flexible, fun JavaScript test framework for Node.js & The Browser ☕️</p>
6
6
 
7
7
  <p align="center">
8
- <a href="https://github.com/mochajs/mocha/actions?query=workflow%3ATests+branch%3Amaster"><img src="https://github.com/mochajs/mocha/workflows/Tests/badge.svg?branch=master" alt="GitHub Actions Build Status"></a>
8
+ <a href="https://github.com/mochajs/mocha/actions?query=workflow%3ATests+branch%3Amain"><img src="https://github.com/mochajs/mocha/workflows/Tests/badge.svg?branch=main" alt="GitHub Actions Build Status"></a>
9
9
  <a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a>
10
10
  <a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_shield"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=shield" alt="FOSSA Status"></a>
11
11
  <a href="https://discord.gg/KeDn2uXhER"><img alt="Chat - Discord" src="https://img.shields.io/badge/chat-Discord-5765F2.svg" /></a>
@@ -23,10 +23,10 @@
23
23
  ## Links
24
24
 
25
25
  - **[Documentation](https://mochajs.org)**
26
- - **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)**
27
- - [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md)
28
- - [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md)
29
- - [Development](https://github.com/mochajs/mocha/blob/master/.github/DEVELOPMENT.md)
26
+ - **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)**
27
+ - [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md)
28
+ - [Contributing](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md)
29
+ - [Development](https://github.com/mochajs/mocha/blob/main/.github/DEVELOPMENT.md)
30
30
  - [Discord](https://discord.gg/KeDn2uXhER) (ask questions here!)
31
31
  - [Issue Tracker](https://github.com/mochajs/mocha/issues)
32
32
 
@@ -59,7 +59,7 @@ You might want to help:
59
59
 
60
60
  - New to contributing to Mocha? Check out this list of [good first issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
61
61
  - Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
62
- - The [maintainer's handbook](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) explains how things get done
62
+ - The [maintainer's handbook](https://github.com/mochajs/mocha/blob/main/MAINTAINERS.md) explains how things get done
63
63
 
64
64
  Finally, come [chat with the maintainers on Discord](https://discord.gg/KeDn2uXhER) if you want to help with:
65
65
 
@@ -69,6 +69,6 @@ Finally, come [chat with the maintainers on Discord](https://discord.gg/KeDn2uXh
69
69
 
70
70
  ## License
71
71
 
72
- Copyright 2011-2022 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE).
72
+ Copyright 2011-2022 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/main/LICENSE).
73
73
 
74
74
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large)
package/browser-entry.js CHANGED
@@ -71,8 +71,8 @@ process.listenerCount = function (name) {
71
71
 
72
72
  process.on = function (e, fn) {
73
73
  if (e === 'uncaughtException') {
74
- global.onerror = function (err, url, line) {
75
- fn(new Error(err + ' (' + url + ':' + line + ')'));
74
+ global.onerror = function (msg, url, line, col, err) {
75
+ fn(err || new Error(msg + ' (' + url + ':' + line + ':' + col + ')'));
76
76
  return !mocha.options.allowUncaught;
77
77
  };
78
78
  uncaughtExceptionHandlers.push(fn);
@@ -208,9 +208,10 @@ module.exports.loadPkgRc = loadPkgRc;
208
208
  * Priority list:
209
209
  *
210
210
  * 1. Command-line args
211
- * 2. RC file (`.mocharc.c?js`, `.mocharc.ya?ml`, `mocharc.json`)
212
- * 3. `mocha` prop of `package.json`
213
- * 4. default configuration (`lib/mocharc.json`)
211
+ * 2. `MOCHA_OPTIONS` environment variable.
212
+ * 3. RC file (`.mocharc.c?js`, `.mocharc.ya?ml`, `mocharc.json`)
213
+ * 4. `mocha` prop of `package.json`
214
+ * 5. default configuration (`lib/mocharc.json`)
214
215
  *
215
216
  * If a {@link module:lib/cli/one-and-dones.ONE_AND_DONE_ARGS "one-and-done" option} is present in the `argv` array, no external config files will be read.
216
217
  * @summary Parses options read from `.mocharc.*` and `package.json`.
@@ -231,6 +232,7 @@ const loadOptions = (argv = []) => {
231
232
  return args;
232
233
  }
233
234
 
235
+ const envConfig = parse(process.env.MOCHA_OPTIONS || '');
234
236
  const rcConfig = loadRc(args);
235
237
  const pkgConfig = loadPkgRc(args);
236
238
 
@@ -243,7 +245,14 @@ const loadOptions = (argv = []) => {
243
245
  args._ = args._.concat(pkgConfig._ || []);
244
246
  }
245
247
 
246
- args = parse(args._, mocharc, args, rcConfig || {}, pkgConfig || {});
248
+ args = parse(
249
+ args._,
250
+ mocharc,
251
+ args,
252
+ envConfig,
253
+ rcConfig || {},
254
+ pkgConfig || {}
255
+ );
247
256
 
248
257
  // recombine positional arguments and "spec"
249
258
  if (args.spec) {
@@ -54,7 +54,7 @@ const ONCE_EVENT_NAMES = [EVENT_DELAY_BEGIN, EVENT_DELAY_END];
54
54
 
55
55
  /**
56
56
  * The `ParallelBuffered` reporter is used by each worker process in "parallel"
57
- * mode, by default. Instead of reporting to to `STDOUT`, etc., it retains a
57
+ * mode, by default. Instead of reporting to `STDOUT`, etc., it retains a
58
58
  * list of events it receives and hands these off to the callback passed into
59
59
  * {@link Mocha#run}. That callback will then return the data to the main
60
60
  * process.
@@ -117,7 +117,7 @@ class SerializableEvent {
117
117
  /**
118
118
  * Constructs a `SerializableEvent`, throwing if we receive unexpected data.
119
119
  *
120
- * Practically, events emitted from `Runner` have a minumum of zero (0)
120
+ * Practically, events emitted from `Runner` have a minimum of zero (0)
121
121
  * arguments-- (for example, {@link Runnable.constants.EVENT_RUN_BEGIN}) and a
122
122
  * maximum of two (2) (for example,
123
123
  * {@link Runnable.constants.EVENT_TEST_FAIL}, where the second argument is an
@@ -10,7 +10,6 @@
10
10
 
11
11
  var Base = require('./base');
12
12
  var utils = require('../utils');
13
- var Progress = require('../browser/progress');
14
13
  var escapeRe = require('escape-string-regexp');
15
14
  var constants = require('../runner').constants;
16
15
  var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
@@ -38,7 +37,7 @@ exports = module.exports = HTML;
38
37
 
39
38
  var statsTemplate =
40
39
  '<ul id="mocha-stats">' +
41
- '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
40
+ '<li class="progress-contain"><progress class="progress-element" max="100" value="0"></progress><svg class="progress-ring"><circle class="ring-flatlight" stroke-dasharray="100%,0%"/><circle class="ring-highlight" stroke-dasharray="0%,100%"/></svg><div class="progress-text">0%</div></li>' +
42
41
  '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
43
42
  '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
44
43
  '<li class="duration">duration: <em>0</em>s</li>' +
@@ -68,24 +67,16 @@ function HTML(runner, options) {
68
67
  var failures = items[2].getElementsByTagName('em')[0];
69
68
  var failuresLink = items[2].getElementsByTagName('a')[0];
70
69
  var duration = items[3].getElementsByTagName('em')[0];
71
- var canvas = stat.getElementsByTagName('canvas')[0];
72
70
  var report = fragment('<ul id="mocha-report"></ul>');
73
71
  var stack = [report];
74
- var progress;
75
- var ctx;
72
+ var progressText = items[0].getElementsByTagName('div')[0];
73
+ var progressBar = items[0].getElementsByTagName('progress')[0];
74
+ var progressRing = [
75
+ items[0].getElementsByClassName('ring-flatlight')[0],
76
+ items[0].getElementsByClassName('ring-highlight')[0]];
77
+ var progressRingRadius = null; // computed CSS unavailable now, so set later
76
78
  var root = document.getElementById('mocha');
77
79
 
78
- if (canvas.getContext) {
79
- var ratio = window.devicePixelRatio || 1;
80
- canvas.style.width = canvas.width;
81
- canvas.style.height = canvas.height;
82
- canvas.width *= ratio;
83
- canvas.height *= ratio;
84
- ctx = canvas.getContext('2d');
85
- ctx.scale(ratio, ratio);
86
- progress = new Progress();
87
- }
88
-
89
80
  if (!root) {
90
81
  return error('#mocha div missing, add it to your document');
91
82
  }
@@ -115,10 +106,6 @@ function HTML(runner, options) {
115
106
  root.appendChild(stat);
116
107
  root.appendChild(report);
117
108
 
118
- if (progress) {
119
- progress.size(40);
120
- }
121
-
122
109
  runner.on(EVENT_SUITE_BEGIN, function (suite) {
123
110
  if (suite.root) {
124
111
  return;
@@ -234,8 +221,26 @@ function HTML(runner, options) {
234
221
  function updateStats() {
235
222
  // TODO: add to stats
236
223
  var percent = ((stats.tests / runner.total) * 100) | 0;
237
- if (progress) {
238
- progress.update(percent).draw(ctx);
224
+ progressBar.value = percent;
225
+ if (progressText) {
226
+ // setting a toFixed that is too low, makes small changes to progress not shown
227
+ // setting it too high, makes the progress text longer then it needs to
228
+ // to address this, calculate the toFixed based on the magnitude of total
229
+ var decimalPlaces = Math.ceil(Math.log10(runner.total / 100));
230
+ text(
231
+ progressText,
232
+ percent.toFixed(Math.min(Math.max(decimalPlaces, 0), 100)) + '%'
233
+ );
234
+ }
235
+ if (progressRing) {
236
+ var radius = parseFloat(getComputedStyle(progressRing[0]).getPropertyValue('r'));
237
+ var wholeArc = Math.PI * 2 * radius;
238
+ var highlightArc = percent * (wholeArc / 100);
239
+ // The progress ring is in 2 parts, the flatlight color and highlight color.
240
+ // Rendering both on top of the other, seems to make a 3rd color on the edges.
241
+ // To create 1 whole ring with 2 colors, both parts are inverse of the other.
242
+ progressRing[0].style['stroke-dasharray'] = `0,${highlightArc}px,${wholeArc}px`;
243
+ progressRing[1].style['stroke-dasharray'] = `${highlightArc}px,${wholeArc}px`;
239
244
  }
240
245
 
241
246
  // update stats
package/mocha.css CHANGED
@@ -22,6 +22,9 @@
22
22
  --mocha-stats-color: #888;
23
23
  --mocha-stats-em-color: #000;
24
24
  --mocha-stats-hover-color: #eee;
25
+ --mocha-progress-ring-color: #eee;
26
+ --mocha-progress-ring-highlight-color: #9f9f9f;
27
+ --mocha-progress-text-color: #000;
25
28
  --mocha-error-color: #c00;
26
29
 
27
30
  --mocha-code-comment: #ddd;
@@ -54,6 +57,9 @@
54
57
  --mocha-stats-color: #aaa;
55
58
  --mocha-stats-em-color: #fff;
56
59
  --mocha-stats-hover-color: #444;
60
+ --mocha-progress-ring-color: #444;
61
+ --mocha-progress-ring-highlight-color: #888;
62
+ --mocha-progress-text-color: #fff;
57
63
  --mocha-error-color: #f44;
58
64
 
59
65
  --mocha-code-comment: #ddd;
@@ -325,6 +331,10 @@ body {
325
331
  }
326
332
 
327
333
  #mocha-stats {
334
+ --ring-container-size: 40px;
335
+ --ring-size: 39px;
336
+ --ring-radius: calc(var(--ring-size) / 2);
337
+
328
338
  position: fixed;
329
339
  top: 15px;
330
340
  right: 10px;
@@ -334,20 +344,52 @@ body {
334
344
  z-index: 1;
335
345
  }
336
346
 
337
- #mocha-stats .progress {
347
+ #mocha-stats .progress-contain {
338
348
  float: right;
339
- padding-top: 0;
349
+ padding: 0;
350
+ }
351
+
352
+ #mocha-stats :is(.progress-element, .progress-text) {
353
+ width: var(--ring-container-size);
354
+ display: block;
355
+ top: 12px;
356
+ position: absolute;
357
+ }
358
+
359
+ #mocha-stats .progress-element {
360
+ visibility: hidden;
361
+ height: calc(var(--ring-container-size) / 2);
362
+ }
363
+
364
+ #mocha-stats .progress-text {
365
+ text-align: center;
366
+ text-overflow: clip;
367
+ overflow: hidden;
368
+ color: var(--mocha-stats-em-color);
369
+ font-size: 11px;
370
+ }
340
371
 
341
- /**
342
- * Set safe initial values, so mochas .progress does not inherit these
343
- * properties from Bootstrap .progress (which causes .progress height to
344
- * equal line height set in Bootstrap).
345
- */
346
- height: auto;
347
- -webkit-box-shadow: none;
348
- -moz-box-shadow: none;
349
- box-shadow: none;
350
- background-color: initial;
372
+ #mocha-stats .progress-ring {
373
+ width: var(--ring-container-size);
374
+ height: var(--ring-container-size);
375
+ }
376
+
377
+ #mocha-stats :is(.ring-flatlight, .ring-highlight) {
378
+ --stroke-thickness: 1.65px;
379
+ --center: calc(var(--ring-container-size) / 2);
380
+ cx: var(--center);
381
+ cy: var(--center);
382
+ r: calc(var(--ring-radius) - calc(var(--stroke-thickness) / 2));
383
+ fill: hsla(0, 0%, 0%, 0);
384
+ stroke-width: var(--stroke-thickness);
385
+ }
386
+
387
+ #mocha-stats .ring-flatlight {
388
+ stroke: var(--mocha-progress-ring-color);
389
+ }
390
+
391
+ #mocha-stats .ring-highlight {
392
+ stroke: var(--mocha-progress-ring-highlight-color);
351
393
  }
352
394
 
353
395
  #mocha-stats em {
@@ -370,11 +412,6 @@ body {
370
412
  padding-top: 11px;
371
413
  }
372
414
 
373
- #mocha-stats canvas {
374
- width: 40px;
375
- height: 40px;
376
- }
377
-
378
415
  #mocha code .comment { color: var(--mocha-code-comment); }
379
416
  #mocha code .init { color: var(--mocha-code-init); }
380
417
  #mocha code .string { color: var(--mocha-code-string); }
package/mocha.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@10.4.0 in javascript ES2018
1
+ // mocha@10.5.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) :
@@ -16507,143 +16507,6 @@
16507
16507
 
16508
16508
  var html = {exports: {}};
16509
16509
 
16510
- /**
16511
- @module browser/Progress
16512
- */
16513
-
16514
- /**
16515
- * Expose `Progress`.
16516
- */
16517
-
16518
- var progress$1 = Progress;
16519
-
16520
- /**
16521
- * Initialize a new `Progress` indicator.
16522
- */
16523
- function Progress() {
16524
- this.percent = 0;
16525
- this.size(0);
16526
- this.fontSize(11);
16527
- this.font('helvetica, arial, sans-serif');
16528
- }
16529
-
16530
- /**
16531
- * Set progress size to `size`.
16532
- *
16533
- * @public
16534
- * @param {number} size
16535
- * @return {Progress} Progress instance.
16536
- */
16537
- Progress.prototype.size = function (size) {
16538
- this._size = size;
16539
- return this;
16540
- };
16541
-
16542
- /**
16543
- * Set text to `text`.
16544
- *
16545
- * @public
16546
- * @param {string} text
16547
- * @return {Progress} Progress instance.
16548
- */
16549
- Progress.prototype.text = function (text) {
16550
- this._text = text;
16551
- return this;
16552
- };
16553
-
16554
- /**
16555
- * Set font size to `size`.
16556
- *
16557
- * @public
16558
- * @param {number} size
16559
- * @return {Progress} Progress instance.
16560
- */
16561
- Progress.prototype.fontSize = function (size) {
16562
- this._fontSize = size;
16563
- return this;
16564
- };
16565
-
16566
- /**
16567
- * Set font to `family`.
16568
- *
16569
- * @param {string} family
16570
- * @return {Progress} Progress instance.
16571
- */
16572
- Progress.prototype.font = function (family) {
16573
- this._font = family;
16574
- return this;
16575
- };
16576
-
16577
- /**
16578
- * Update percentage to `n`.
16579
- *
16580
- * @param {number} n
16581
- * @return {Progress} Progress instance.
16582
- */
16583
- Progress.prototype.update = function (n) {
16584
- this.percent = n;
16585
- return this;
16586
- };
16587
-
16588
- /**
16589
- * Draw on `ctx`.
16590
- *
16591
- * @param {CanvasRenderingContext2d} ctx
16592
- * @return {Progress} Progress instance.
16593
- */
16594
- Progress.prototype.draw = function (ctx) {
16595
- try {
16596
- var darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
16597
- var isDarkMode = !!darkMatcher.matches;
16598
- var lightColors = {
16599
- outerCircle: '#9f9f9f',
16600
- innerCircle: '#eee',
16601
- text: '#000'
16602
- };
16603
- var darkColors = {
16604
- outerCircle: '#888',
16605
- innerCircle: '#444',
16606
- text: '#fff'
16607
- };
16608
- var colors = isDarkMode ? darkColors : lightColors;
16609
-
16610
- var percent = Math.min(this.percent, 100);
16611
- var size = this._size;
16612
- var half = size / 2;
16613
- var x = half;
16614
- var y = half;
16615
- var rad = half - 1;
16616
- var fontSize = this._fontSize;
16617
-
16618
- ctx.font = fontSize + 'px ' + this._font;
16619
-
16620
- var angle = Math.PI * 2 * (percent / 100);
16621
- ctx.clearRect(0, 0, size, size);
16622
-
16623
- // outer circle
16624
- ctx.strokeStyle = colors.outerCircle;
16625
- ctx.beginPath();
16626
- ctx.arc(x, y, rad, 0, angle, false);
16627
- ctx.stroke();
16628
-
16629
- // inner circle
16630
- ctx.strokeStyle = colors.innerCircle;
16631
- ctx.beginPath();
16632
- ctx.arc(x, y, rad - 1, 0, angle, true);
16633
- ctx.stroke();
16634
-
16635
- // text
16636
- var text = this._text || (percent | 0) + '%';
16637
- var w = ctx.measureText(text).width;
16638
-
16639
- ctx.fillStyle = colors.text;
16640
- ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
16641
- } catch (ignore) {
16642
- // don't fail if we can't render progress
16643
- }
16644
- return this;
16645
- };
16646
-
16647
16510
  (function (module, exports) {
16648
16511
 
16649
16512
  /* eslint-env browser */
@@ -16656,7 +16519,6 @@
16656
16519
 
16657
16520
  var Base = base$1.exports;
16658
16521
  var utils = utils$3;
16659
- var Progress = progress$1;
16660
16522
  var escapeRe = escapeStringRegexp;
16661
16523
  var constants = runner.constants;
16662
16524
  var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
@@ -16684,7 +16546,7 @@
16684
16546
 
16685
16547
  var statsTemplate =
16686
16548
  '<ul id="mocha-stats">' +
16687
- '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
16549
+ '<li class="progress-contain"><progress class="progress-element" max="100" value="0"></progress><svg class="progress-ring"><circle class="ring-flatlight" stroke-dasharray="100%,0%"/><circle class="ring-highlight" stroke-dasharray="0%,100%"/></svg><div class="progress-text">0%</div></li>' +
16688
16550
  '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
16689
16551
  '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
16690
16552
  '<li class="duration">duration: <em>0</em>s</li>' +
@@ -16714,24 +16576,15 @@
16714
16576
  var failures = items[2].getElementsByTagName('em')[0];
16715
16577
  var failuresLink = items[2].getElementsByTagName('a')[0];
16716
16578
  var duration = items[3].getElementsByTagName('em')[0];
16717
- var canvas = stat.getElementsByTagName('canvas')[0];
16718
16579
  var report = fragment('<ul id="mocha-report"></ul>');
16719
16580
  var stack = [report];
16720
- var progress;
16721
- var ctx;
16581
+ var progressText = items[0].getElementsByTagName('div')[0];
16582
+ var progressBar = items[0].getElementsByTagName('progress')[0];
16583
+ var progressRing = [
16584
+ items[0].getElementsByClassName('ring-flatlight')[0],
16585
+ items[0].getElementsByClassName('ring-highlight')[0]];
16722
16586
  var root = document.getElementById('mocha');
16723
16587
 
16724
- if (canvas.getContext) {
16725
- var ratio = window.devicePixelRatio || 1;
16726
- canvas.style.width = canvas.width;
16727
- canvas.style.height = canvas.height;
16728
- canvas.width *= ratio;
16729
- canvas.height *= ratio;
16730
- ctx = canvas.getContext('2d');
16731
- ctx.scale(ratio, ratio);
16732
- progress = new Progress();
16733
- }
16734
-
16735
16588
  if (!root) {
16736
16589
  return error('#mocha div missing, add it to your document');
16737
16590
  }
@@ -16761,10 +16614,6 @@
16761
16614
  root.appendChild(stat);
16762
16615
  root.appendChild(report);
16763
16616
 
16764
- if (progress) {
16765
- progress.size(40);
16766
- }
16767
-
16768
16617
  runner.on(EVENT_SUITE_BEGIN, function (suite) {
16769
16618
  if (suite.root) {
16770
16619
  return;
@@ -16880,8 +16729,26 @@
16880
16729
  function updateStats() {
16881
16730
  // TODO: add to stats
16882
16731
  var percent = ((stats.tests / runner.total) * 100) | 0;
16883
- if (progress) {
16884
- progress.update(percent).draw(ctx);
16732
+ progressBar.value = percent;
16733
+ if (progressText) {
16734
+ // setting a toFixed that is too low, makes small changes to progress not shown
16735
+ // setting it too high, makes the progress text longer then it needs to
16736
+ // to address this, calculate the toFixed based on the magnitude of total
16737
+ var decimalPlaces = Math.ceil(Math.log10(runner.total / 100));
16738
+ text(
16739
+ progressText,
16740
+ percent.toFixed(Math.min(Math.max(decimalPlaces, 0), 100)) + '%'
16741
+ );
16742
+ }
16743
+ if (progressRing) {
16744
+ var radius = parseFloat(getComputedStyle(progressRing[0]).getPropertyValue('r'));
16745
+ var wholeArc = Math.PI * 2 * radius;
16746
+ var highlightArc = percent * (wholeArc / 100);
16747
+ // The progress ring is in 2 parts, the flatlight color and highlight color.
16748
+ // Rendering both on top of the other, seems to make a 3rd color on the edges.
16749
+ // To create 1 whole ring with 2 colors, both parts are inverse of the other.
16750
+ progressRing[0].style['stroke-dasharray'] = `0,${highlightArc}px,${wholeArc}px`;
16751
+ progressRing[1].style['stroke-dasharray'] = `${highlightArc}px,${wholeArc}px`;
16885
16752
  }
16886
16753
 
16887
16754
  // update stats
@@ -19119,7 +18986,7 @@
19119
18986
  };
19120
18987
 
19121
18988
  var name = "mocha";
19122
- var version = "10.4.0";
18989
+ var version = "10.5.0";
19123
18990
  var homepage = "https://mochajs.org/";
19124
18991
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
19125
18992
  var require$$17 = {
@@ -20518,8 +20385,8 @@
20518
20385
 
20519
20386
  process.on = function (e, fn) {
20520
20387
  if (e === 'uncaughtException') {
20521
- commonjsGlobal.onerror = function (err, url, line) {
20522
- fn(new Error(err + ' (' + url + ':' + line + ')'));
20388
+ commonjsGlobal.onerror = function (msg, url, line, col, err) {
20389
+ fn(err || new Error(msg + ' (' + url + ':' + line + ':' + col + ')'));
20523
20390
  return !mocha.options.allowUncaught;
20524
20391
  };
20525
20392
  uncaughtExceptionHandlers.push(fn);