importmap_mocha-rails 0.3.3 → 0.3.4

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.
@@ -1,4 +1,4 @@
1
- // mocha@10.3.0 in javascript ES2018
1
+ // mocha@10.6.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) :
@@ -5820,6 +5820,8 @@
5820
5820
  /*istanbul ignore end*/
5821
5821
  diff: function diff(oldString, newString) {
5822
5822
  /*istanbul ignore start*/
5823
+ var _options$timeout;
5824
+
5823
5825
  var
5824
5826
  /*istanbul ignore end*/
5825
5827
  options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -5853,84 +5855,123 @@
5853
5855
  oldLen = oldString.length;
5854
5856
  var editLength = 1;
5855
5857
  var maxEditLength = newLen + oldLen;
5858
+
5859
+ if (options.maxEditLength) {
5860
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
5861
+ }
5862
+
5863
+ var maxExecutionTime =
5864
+ /*istanbul ignore start*/
5865
+ (_options$timeout =
5866
+ /*istanbul ignore end*/
5867
+ options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
5868
+ var abortAfterTimestamp = Date.now() + maxExecutionTime;
5856
5869
  var bestPath = [{
5857
- newPos: -1,
5858
- components: []
5870
+ oldPos: -1,
5871
+ lastComponent: undefined
5859
5872
  }]; // Seed editLength = 0, i.e. the content starts with the same values
5860
5873
 
5861
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
5874
+ var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
5862
5875
 
5863
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
5876
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
5864
5877
  // Identity per the equality and tokenizer
5865
5878
  return done([{
5866
5879
  value: this.join(newString),
5867
5880
  count: newString.length
5868
5881
  }]);
5869
- } // Main worker method. checks all permutations of a given edit length for acceptance.
5870
-
5882
+ } // Once we hit the right edge of the edit graph on some diagonal k, we can
5883
+ // definitely reach the end of the edit graph in no more than k edits, so
5884
+ // there's no point in considering any moves to diagonal k+1 any more (from
5885
+ // which we're guaranteed to need at least k+1 more edits).
5886
+ // Similarly, once we've reached the bottom of the edit graph, there's no
5887
+ // point considering moves to lower diagonals.
5888
+ // We record this fact by setting minDiagonalToConsider and
5889
+ // maxDiagonalToConsider to some finite value once we've hit the edge of
5890
+ // the edit graph.
5891
+ // This optimization is not faithful to the original algorithm presented in
5892
+ // Myers's paper, which instead pointlessly extends D-paths off the end of
5893
+ // the edit graph - see page 7 of Myers's paper which notes this point
5894
+ // explicitly and illustrates it with a diagram. This has major performance
5895
+ // implications for some common scenarios. For instance, to compute a diff
5896
+ // where the new text simply appends d characters on the end of the
5897
+ // original text of length n, the true Myers algorithm will take O(n+d^2)
5898
+ // time while this optimization needs only O(n+d) time.
5899
+
5900
+
5901
+ var minDiagonalToConsider = -Infinity,
5902
+ maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance.
5871
5903
 
5872
5904
  function execEditLength() {
5873
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
5905
+ for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
5874
5906
  var basePath =
5875
5907
  /*istanbul ignore start*/
5876
5908
  void 0
5877
5909
  /*istanbul ignore end*/
5878
5910
  ;
5911
+ var removePath = bestPath[diagonalPath - 1],
5912
+ addPath = bestPath[diagonalPath + 1];
5879
5913
 
5880
- var addPath = bestPath[diagonalPath - 1],
5881
- removePath = bestPath[diagonalPath + 1],
5882
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
5883
-
5884
- if (addPath) {
5914
+ if (removePath) {
5885
5915
  // No one else is going to attempt to use this value, clear it
5886
5916
  bestPath[diagonalPath - 1] = undefined;
5887
5917
  }
5888
5918
 
5889
- var canAdd = addPath && addPath.newPos + 1 < newLen,
5890
- canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
5919
+ var canAdd = false;
5920
+
5921
+ if (addPath) {
5922
+ // what newPos will be after we do an insertion:
5923
+ var addPathNewPos = addPath.oldPos - diagonalPath;
5924
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
5925
+ }
5926
+
5927
+ var canRemove = removePath && removePath.oldPos + 1 < oldLen;
5891
5928
 
5892
5929
  if (!canAdd && !canRemove) {
5893
5930
  // If this path is a terminal then prune
5894
5931
  bestPath[diagonalPath] = undefined;
5895
5932
  continue;
5896
5933
  } // Select the diagonal that we want to branch from. We select the prior
5897
- // path whose position in the new string is the farthest from the origin
5934
+ // path whose position in the old string is the farthest from the origin
5898
5935
  // and does not pass the bounds of the diff graph
5936
+ // TODO: Remove the `+ 1` here to make behavior match Myers algorithm
5937
+ // and prefer to order removals before insertions.
5899
5938
 
5900
5939
 
5901
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
5902
- basePath = clonePath(removePath);
5903
- self.pushComponent(basePath.components, undefined, true);
5940
+ if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
5941
+ basePath = self.addToPath(addPath, true, undefined, 0);
5904
5942
  } else {
5905
- basePath = addPath; // No need to clone, we've pulled it from the list
5906
-
5907
- basePath.newPos++;
5908
- self.pushComponent(basePath.components, true, undefined);
5943
+ basePath = self.addToPath(removePath, undefined, true, 1);
5909
5944
  }
5910
5945
 
5911
- _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
5946
+ newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
5912
5947
 
5913
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
5914
- return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
5948
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
5949
+ // If we have hit the end of both strings, then we are done
5950
+ return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
5915
5951
  } else {
5916
- // Otherwise track this path as a potential candidate and continue.
5917
5952
  bestPath[diagonalPath] = basePath;
5953
+
5954
+ if (basePath.oldPos + 1 >= oldLen) {
5955
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
5956
+ }
5957
+
5958
+ if (newPos + 1 >= newLen) {
5959
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
5960
+ }
5918
5961
  }
5919
5962
  }
5920
5963
 
5921
5964
  editLength++;
5922
5965
  } // Performs the length of edit iteration. Is a bit fugly as this has to support the
5923
5966
  // sync and async mode which is never fun. Loops over execEditLength until a value
5924
- // is produced.
5967
+ // is produced, or until the edit length exceeds options.maxEditLength (if given),
5968
+ // in which case it will return undefined.
5925
5969
 
5926
5970
 
5927
5971
  if (callback) {
5928
5972
  (function exec() {
5929
5973
  setTimeout(function () {
5930
- // This should not happen, but we want to be safe.
5931
-
5932
- /* istanbul ignore next */
5933
- if (editLength > maxEditLength) {
5974
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
5934
5975
  return callback();
5935
5976
  }
5936
5977
 
@@ -5940,7 +5981,7 @@
5940
5981
  }, 0);
5941
5982
  })();
5942
5983
  } else {
5943
- while (editLength <= maxEditLength) {
5984
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
5944
5985
  var ret = execEditLength();
5945
5986
 
5946
5987
  if (ret) {
@@ -5953,23 +5994,29 @@
5953
5994
  /*istanbul ignore start*/
5954
5995
 
5955
5996
  /*istanbul ignore end*/
5956
- pushComponent: function pushComponent(components, added, removed) {
5957
- var last = components[components.length - 1];
5997
+ addToPath: function addToPath(path, added, removed, oldPosInc) {
5998
+ var last = path.lastComponent;
5958
5999
 
5959
6000
  if (last && last.added === added && last.removed === removed) {
5960
- // We need to clone here as the component clone operation is just
5961
- // as shallow array clone
5962
- components[components.length - 1] = {
5963
- count: last.count + 1,
5964
- added: added,
5965
- removed: removed
6001
+ return {
6002
+ oldPos: path.oldPos + oldPosInc,
6003
+ lastComponent: {
6004
+ count: last.count + 1,
6005
+ added: added,
6006
+ removed: removed,
6007
+ previousComponent: last.previousComponent
6008
+ }
5966
6009
  };
5967
6010
  } else {
5968
- components.push({
5969
- count: 1,
5970
- added: added,
5971
- removed: removed
5972
- });
6011
+ return {
6012
+ oldPos: path.oldPos + oldPosInc,
6013
+ lastComponent: {
6014
+ count: 1,
6015
+ added: added,
6016
+ removed: removed,
6017
+ previousComponent: last
6018
+ }
6019
+ };
5973
6020
  }
5974
6021
  },
5975
6022
 
@@ -5979,8 +6026,8 @@
5979
6026
  extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
5980
6027
  var newLen = newString.length,
5981
6028
  oldLen = oldString.length,
5982
- newPos = basePath.newPos,
5983
- oldPos = newPos - diagonalPath,
6029
+ oldPos = basePath.oldPos,
6030
+ newPos = oldPos - diagonalPath,
5984
6031
  commonCount = 0;
5985
6032
 
5986
6033
  while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
@@ -5990,13 +6037,14 @@
5990
6037
  }
5991
6038
 
5992
6039
  if (commonCount) {
5993
- basePath.components.push({
5994
- count: commonCount
5995
- });
6040
+ basePath.lastComponent = {
6041
+ count: commonCount,
6042
+ previousComponent: basePath.lastComponent
6043
+ };
5996
6044
  }
5997
6045
 
5998
- basePath.newPos = newPos;
5999
- return oldPos;
6046
+ basePath.oldPos = oldPos;
6047
+ return newPos;
6000
6048
  },
6001
6049
 
6002
6050
  /*istanbul ignore start*/
@@ -6047,7 +6095,20 @@
6047
6095
  }
6048
6096
  };
6049
6097
 
6050
- function buildValues(diff, components, newString, oldString, useLongestToken) {
6098
+ function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
6099
+ // First we convert our linked list of components in reverse order to an
6100
+ // array in the right order:
6101
+ var components = [];
6102
+ var nextComponent;
6103
+
6104
+ while (lastComponent) {
6105
+ components.push(lastComponent);
6106
+ nextComponent = lastComponent.previousComponent;
6107
+ delete lastComponent.previousComponent;
6108
+ lastComponent = nextComponent;
6109
+ }
6110
+
6111
+ components.reverse();
6051
6112
  var componentPos = 0,
6052
6113
  componentLen = components.length,
6053
6114
  newPos = 0,
@@ -6090,23 +6151,16 @@
6090
6151
  // This is only available for string mode.
6091
6152
 
6092
6153
 
6093
- var lastComponent = components[componentLen - 1];
6154
+ var finalComponent = components[componentLen - 1];
6094
6155
 
6095
- if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
6096
- components[componentLen - 2].value += lastComponent.value;
6156
+ if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) {
6157
+ components[componentLen - 2].value += finalComponent.value;
6097
6158
  components.pop();
6098
6159
  }
6099
6160
 
6100
6161
  return components;
6101
6162
  }
6102
6163
 
6103
- function clonePath(path) {
6104
- return {
6105
- newPos: path.newPos,
6106
- components: path.components.slice(0)
6107
- };
6108
- }
6109
-
6110
6164
  }(base));
6111
6165
 
6112
6166
  var character = {};
@@ -6322,6 +6376,11 @@
6322
6376
 
6323
6377
  /*istanbul ignore end*/
6324
6378
  lineDiff.tokenize = function (value) {
6379
+ if (this.options.stripTrailingCr) {
6380
+ // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
6381
+ value = value.replace(/\r\n/g, '\n');
6382
+ }
6383
+
6325
6384
  var retLines = [],
6326
6385
  linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
6327
6386
 
@@ -7042,7 +7101,7 @@
7042
7101
  var line = _hunk.lines[j],
7043
7102
  operation = line.length > 0 ? line[0] : ' ',
7044
7103
  content = line.length > 0 ? line.substr(1) : line,
7045
- delimiter = _hunk.linedelimiters[j];
7104
+ delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n';
7046
7105
 
7047
7106
  if (operation === ' ') {
7048
7107
  _toPos++;
@@ -7184,6 +7243,11 @@
7184
7243
  diffLines)
7185
7244
  /*istanbul ignore end*/
7186
7245
  (oldStr, newStr, options);
7246
+
7247
+ if (!diff) {
7248
+ return;
7249
+ }
7250
+
7187
7251
  diff.push({
7188
7252
  value: '',
7189
7253
  lines: []
@@ -7360,6 +7424,10 @@
7360
7424
  }
7361
7425
 
7362
7426
  function formatPatch(diff) {
7427
+ if (Array.isArray(diff)) {
7428
+ return diff.map(formatPatch).join('\n');
7429
+ }
7430
+
7363
7431
  var ret = [];
7364
7432
 
7365
7433
  if (diff.oldFileName == diff.newFileName) {
@@ -8038,6 +8106,70 @@
8038
8106
  };
8039
8107
  }
8040
8108
 
8109
+ var reverse = {};
8110
+
8111
+ /*istanbul ignore start*/
8112
+
8113
+ Object.defineProperty(reverse, "__esModule", {
8114
+ value: true
8115
+ });
8116
+ reverse.reversePatch = reversePatch;
8117
+
8118
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
8119
+
8120
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8121
+
8122
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8123
+
8124
+ /*istanbul ignore end*/
8125
+ function reversePatch(structuredPatch) {
8126
+ if (Array.isArray(structuredPatch)) {
8127
+ return structuredPatch.map(reversePatch).reverse();
8128
+ }
8129
+
8130
+ return (
8131
+ /*istanbul ignore start*/
8132
+ _objectSpread(_objectSpread({},
8133
+ /*istanbul ignore end*/
8134
+ structuredPatch), {}, {
8135
+ oldFileName: structuredPatch.newFileName,
8136
+ oldHeader: structuredPatch.newHeader,
8137
+ newFileName: structuredPatch.oldFileName,
8138
+ newHeader: structuredPatch.oldHeader,
8139
+ hunks: structuredPatch.hunks.map(function (hunk) {
8140
+ return {
8141
+ oldLines: hunk.newLines,
8142
+ oldStart: hunk.newStart,
8143
+ newLines: hunk.oldLines,
8144
+ newStart: hunk.oldStart,
8145
+ linedelimiters: hunk.linedelimiters,
8146
+ lines: hunk.lines.map(function (l) {
8147
+ if (l.startsWith('-')) {
8148
+ return (
8149
+ /*istanbul ignore start*/
8150
+ "+".concat(
8151
+ /*istanbul ignore end*/
8152
+ l.slice(1))
8153
+ );
8154
+ }
8155
+
8156
+ if (l.startsWith('+')) {
8157
+ return (
8158
+ /*istanbul ignore start*/
8159
+ "-".concat(
8160
+ /*istanbul ignore end*/
8161
+ l.slice(1))
8162
+ );
8163
+ }
8164
+
8165
+ return l;
8166
+ })
8167
+ };
8168
+ })
8169
+ })
8170
+ );
8171
+ }
8172
+
8041
8173
  var dmp = {};
8042
8174
 
8043
8175
  /*istanbul ignore start*/
@@ -8211,6 +8343,12 @@
8211
8343
  return _merge.merge;
8212
8344
  }
8213
8345
  });
8346
+ Object.defineProperty(exports, "reversePatch", {
8347
+ enumerable: true,
8348
+ get: function get() {
8349
+ return _reverse.reversePatch;
8350
+ }
8351
+ });
8214
8352
  Object.defineProperty(exports, "structuredPatch", {
8215
8353
  enumerable: true,
8216
8354
  get: function get() {
@@ -8229,6 +8367,12 @@
8229
8367
  return _create.createPatch;
8230
8368
  }
8231
8369
  });
8370
+ Object.defineProperty(exports, "formatPatch", {
8371
+ enumerable: true,
8372
+ get: function get() {
8373
+ return _create.formatPatch;
8374
+ }
8375
+ });
8232
8376
  Object.defineProperty(exports, "convertChangesToDMP", {
8233
8377
  enumerable: true,
8234
8378
  get: function get() {
@@ -8309,6 +8453,12 @@
8309
8453
  /*istanbul ignore end*/
8310
8454
  ;
8311
8455
 
8456
+ var
8457
+ /*istanbul ignore start*/
8458
+ _reverse = reverse
8459
+ /*istanbul ignore end*/
8460
+ ;
8461
+
8312
8462
  var
8313
8463
  /*istanbul ignore start*/
8314
8464
  _create = create
@@ -11460,6 +11610,39 @@
11460
11610
  */
11461
11611
  exports.getMochaID = obj =>
11462
11612
  obj && typeof obj === 'object' ? obj[MOCHA_ID_PROP_NAME] : undefined;
11613
+
11614
+ /**
11615
+ * Replaces any detected circular dependency with the string '[Circular]'
11616
+ * Mutates original object
11617
+ * @param inputObj {*}
11618
+ * @returns {*}
11619
+ */
11620
+ exports.breakCircularDeps = inputObj => {
11621
+ const seen = new Set();
11622
+
11623
+ function _breakCircularDeps(obj) {
11624
+ if (obj && typeof obj !== 'object') {
11625
+ return obj;
11626
+ }
11627
+
11628
+ if (seen.has(obj)) {
11629
+ return '[Circular]';
11630
+ }
11631
+
11632
+ seen.add(obj);
11633
+ for (const k in obj) {
11634
+ if (Object.prototype.hasOwnProperty.call(obj, k)) {
11635
+ obj[k] = _breakCircularDeps(obj[k]);
11636
+ }
11637
+ }
11638
+
11639
+ // deleting means only a seen object that is its own child will be detected
11640
+ seen.delete(obj);
11641
+ return obj;
11642
+ }
11643
+
11644
+ return _breakCircularDeps(inputObj);
11645
+ };
11463
11646
  }(utils$3));
11464
11647
 
11465
11648
  var _nodeResolve_empty = {};
@@ -14433,11 +14616,22 @@
14433
14616
  err = thrown2Error(err);
14434
14617
  }
14435
14618
 
14436
- try {
14437
- err.stack =
14438
- this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
14439
- } catch (ignore) {
14440
- // some environments do not take kindly to monkeying with the stack
14619
+ // Filter the stack traces
14620
+ if (!this.fullStackTrace) {
14621
+ const alreadyFiltered = new Set();
14622
+ let currentErr = err;
14623
+
14624
+ while (currentErr && currentErr.stack && !alreadyFiltered.has(currentErr)) {
14625
+ alreadyFiltered.add(currentErr);
14626
+
14627
+ try {
14628
+ currentErr.stack = stackFilter(currentErr.stack);
14629
+ } catch (ignore) {
14630
+ // some environments do not take kindly to monkeying with the stack
14631
+ }
14632
+
14633
+ currentErr = currentErr.cause;
14634
+ }
14441
14635
  }
14442
14636
 
14443
14637
  this.emit(constants$1.EVENT_TEST_FAIL, test, err);
@@ -15468,6 +15662,56 @@
15468
15662
  }
15469
15663
  });
15470
15664
 
15665
+ /**
15666
+ * Traverses err.cause and returns all stack traces
15667
+ *
15668
+ * @private
15669
+ * @param {Error} err
15670
+ * @param {Set<Error>} [seen]
15671
+ * @return {FullErrorStack}
15672
+ */
15673
+ var getFullErrorStack = function (err, seen) {
15674
+ if (seen && seen.has(err)) {
15675
+ return { message: '', msg: '<circular>', stack: '' };
15676
+ }
15677
+
15678
+ var message;
15679
+
15680
+ if (typeof err.inspect === 'function') {
15681
+ message = err.inspect() + '';
15682
+ } else if (err.message && typeof err.message.toString === 'function') {
15683
+ message = err.message + '';
15684
+ } else {
15685
+ message = '';
15686
+ }
15687
+
15688
+ var msg;
15689
+ var stack = err.stack || message;
15690
+ var index = message ? stack.indexOf(message) : -1;
15691
+
15692
+ if (index === -1) {
15693
+ msg = message;
15694
+ } else {
15695
+ index += message.length;
15696
+ msg = stack.slice(0, index);
15697
+ // remove msg from stack
15698
+ stack = stack.slice(index + 1);
15699
+
15700
+ if (err.cause) {
15701
+ seen = seen || new Set();
15702
+ seen.add(err);
15703
+ const causeStack = getFullErrorStack(err.cause, seen);
15704
+ stack += '\n Caused by: ' + causeStack.msg + (causeStack.stack ? '\n' + causeStack.stack : '');
15705
+ }
15706
+ }
15707
+
15708
+ return {
15709
+ message,
15710
+ msg,
15711
+ stack
15712
+ };
15713
+ };
15714
+
15471
15715
  /**
15472
15716
  * Outputs the given `failures` as a list.
15473
15717
  *
@@ -15488,7 +15732,6 @@
15488
15732
  color('error stack', '\n%s\n');
15489
15733
 
15490
15734
  // msg
15491
- var msg;
15492
15735
  var err;
15493
15736
  if (test.err && test.err.multiple) {
15494
15737
  if (multipleTest !== test) {
@@ -15499,25 +15742,8 @@
15499
15742
  } else {
15500
15743
  err = test.err;
15501
15744
  }
15502
- var message;
15503
- if (typeof err.inspect === 'function') {
15504
- message = err.inspect() + '';
15505
- } else if (err.message && typeof err.message.toString === 'function') {
15506
- message = err.message + '';
15507
- } else {
15508
- message = '';
15509
- }
15510
- var stack = err.stack || message;
15511
- var index = message ? stack.indexOf(message) : -1;
15512
15745
 
15513
- if (index === -1) {
15514
- msg = message;
15515
- } else {
15516
- index += message.length;
15517
- msg = stack.slice(0, index);
15518
- // remove msg from stack
15519
- stack = stack.slice(index + 1);
15520
- }
15746
+ var { message, msg, stack } = getFullErrorStack(err);
15521
15747
 
15522
15748
  // uncaught
15523
15749
  if (err.uncaught) {
@@ -15795,6 +16021,15 @@
15795
16021
  Base.consoleLog = consoleLog;
15796
16022
 
15797
16023
  Base.abstract = true;
16024
+
16025
+ /**
16026
+ * An object with all stack traces recursively mounted from each err.cause
16027
+ * @memberof module:lib/reporters/base
16028
+ * @typedef {Object} FullErrorStack
16029
+ * @property {string} message
16030
+ * @property {string} msg
16031
+ * @property {string} stack
16032
+ */
15798
16033
  }(base$1, base$1.exports));
15799
16034
 
15800
16035
  var dot = {exports: {}};
@@ -16455,143 +16690,6 @@
16455
16690
 
16456
16691
  var html = {exports: {}};
16457
16692
 
16458
- /**
16459
- @module browser/Progress
16460
- */
16461
-
16462
- /**
16463
- * Expose `Progress`.
16464
- */
16465
-
16466
- var progress$1 = Progress;
16467
-
16468
- /**
16469
- * Initialize a new `Progress` indicator.
16470
- */
16471
- function Progress() {
16472
- this.percent = 0;
16473
- this.size(0);
16474
- this.fontSize(11);
16475
- this.font('helvetica, arial, sans-serif');
16476
- }
16477
-
16478
- /**
16479
- * Set progress size to `size`.
16480
- *
16481
- * @public
16482
- * @param {number} size
16483
- * @return {Progress} Progress instance.
16484
- */
16485
- Progress.prototype.size = function (size) {
16486
- this._size = size;
16487
- return this;
16488
- };
16489
-
16490
- /**
16491
- * Set text to `text`.
16492
- *
16493
- * @public
16494
- * @param {string} text
16495
- * @return {Progress} Progress instance.
16496
- */
16497
- Progress.prototype.text = function (text) {
16498
- this._text = text;
16499
- return this;
16500
- };
16501
-
16502
- /**
16503
- * Set font size to `size`.
16504
- *
16505
- * @public
16506
- * @param {number} size
16507
- * @return {Progress} Progress instance.
16508
- */
16509
- Progress.prototype.fontSize = function (size) {
16510
- this._fontSize = size;
16511
- return this;
16512
- };
16513
-
16514
- /**
16515
- * Set font to `family`.
16516
- *
16517
- * @param {string} family
16518
- * @return {Progress} Progress instance.
16519
- */
16520
- Progress.prototype.font = function (family) {
16521
- this._font = family;
16522
- return this;
16523
- };
16524
-
16525
- /**
16526
- * Update percentage to `n`.
16527
- *
16528
- * @param {number} n
16529
- * @return {Progress} Progress instance.
16530
- */
16531
- Progress.prototype.update = function (n) {
16532
- this.percent = n;
16533
- return this;
16534
- };
16535
-
16536
- /**
16537
- * Draw on `ctx`.
16538
- *
16539
- * @param {CanvasRenderingContext2d} ctx
16540
- * @return {Progress} Progress instance.
16541
- */
16542
- Progress.prototype.draw = function (ctx) {
16543
- try {
16544
- var darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
16545
- var isDarkMode = !!darkMatcher.matches;
16546
- var lightColors = {
16547
- outerCircle: '#9f9f9f',
16548
- innerCircle: '#eee',
16549
- text: '#000'
16550
- };
16551
- var darkColors = {
16552
- outerCircle: '#888',
16553
- innerCircle: '#444',
16554
- text: '#fff'
16555
- };
16556
- var colors = isDarkMode ? darkColors : lightColors;
16557
-
16558
- var percent = Math.min(this.percent, 100);
16559
- var size = this._size;
16560
- var half = size / 2;
16561
- var x = half;
16562
- var y = half;
16563
- var rad = half - 1;
16564
- var fontSize = this._fontSize;
16565
-
16566
- ctx.font = fontSize + 'px ' + this._font;
16567
-
16568
- var angle = Math.PI * 2 * (percent / 100);
16569
- ctx.clearRect(0, 0, size, size);
16570
-
16571
- // outer circle
16572
- ctx.strokeStyle = colors.outerCircle;
16573
- ctx.beginPath();
16574
- ctx.arc(x, y, rad, 0, angle, false);
16575
- ctx.stroke();
16576
-
16577
- // inner circle
16578
- ctx.strokeStyle = colors.innerCircle;
16579
- ctx.beginPath();
16580
- ctx.arc(x, y, rad - 1, 0, angle, true);
16581
- ctx.stroke();
16582
-
16583
- // text
16584
- var text = this._text || (percent | 0) + '%';
16585
- var w = ctx.measureText(text).width;
16586
-
16587
- ctx.fillStyle = colors.text;
16588
- ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
16589
- } catch (ignore) {
16590
- // don't fail if we can't render progress
16591
- }
16592
- return this;
16593
- };
16594
-
16595
16693
  (function (module, exports) {
16596
16694
 
16597
16695
  /* eslint-env browser */
@@ -16604,7 +16702,6 @@
16604
16702
 
16605
16703
  var Base = base$1.exports;
16606
16704
  var utils = utils$3;
16607
- var Progress = progress$1;
16608
16705
  var escapeRe = escapeStringRegexp;
16609
16706
  var constants = runner.constants;
16610
16707
  var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
@@ -16632,7 +16729,7 @@
16632
16729
 
16633
16730
  var statsTemplate =
16634
16731
  '<ul id="mocha-stats">' +
16635
- '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
16732
+ '<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>' +
16636
16733
  '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
16637
16734
  '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
16638
16735
  '<li class="duration">duration: <em>0</em>s</li>' +
@@ -16662,24 +16759,15 @@
16662
16759
  var failures = items[2].getElementsByTagName('em')[0];
16663
16760
  var failuresLink = items[2].getElementsByTagName('a')[0];
16664
16761
  var duration = items[3].getElementsByTagName('em')[0];
16665
- var canvas = stat.getElementsByTagName('canvas')[0];
16666
16762
  var report = fragment('<ul id="mocha-report"></ul>');
16667
16763
  var stack = [report];
16668
- var progress;
16669
- var ctx;
16764
+ var progressText = items[0].getElementsByTagName('div')[0];
16765
+ var progressBar = items[0].getElementsByTagName('progress')[0];
16766
+ var progressRing = [
16767
+ items[0].getElementsByClassName('ring-flatlight')[0],
16768
+ items[0].getElementsByClassName('ring-highlight')[0]];
16670
16769
  var root = document.getElementById('mocha');
16671
16770
 
16672
- if (canvas.getContext) {
16673
- var ratio = window.devicePixelRatio || 1;
16674
- canvas.style.width = canvas.width;
16675
- canvas.style.height = canvas.height;
16676
- canvas.width *= ratio;
16677
- canvas.height *= ratio;
16678
- ctx = canvas.getContext('2d');
16679
- ctx.scale(ratio, ratio);
16680
- progress = new Progress();
16681
- }
16682
-
16683
16771
  if (!root) {
16684
16772
  return error('#mocha div missing, add it to your document');
16685
16773
  }
@@ -16709,10 +16797,6 @@
16709
16797
  root.appendChild(stat);
16710
16798
  root.appendChild(report);
16711
16799
 
16712
- if (progress) {
16713
- progress.size(40);
16714
- }
16715
-
16716
16800
  runner.on(EVENT_SUITE_BEGIN, function (suite) {
16717
16801
  if (suite.root) {
16718
16802
  return;
@@ -16828,8 +16912,26 @@
16828
16912
  function updateStats() {
16829
16913
  // TODO: add to stats
16830
16914
  var percent = ((stats.tests / runner.total) * 100) | 0;
16831
- if (progress) {
16832
- progress.update(percent).draw(ctx);
16915
+ progressBar.value = percent;
16916
+ if (progressText) {
16917
+ // setting a toFixed that is too low, makes small changes to progress not shown
16918
+ // setting it too high, makes the progress text longer then it needs to
16919
+ // to address this, calculate the toFixed based on the magnitude of total
16920
+ var decimalPlaces = Math.ceil(Math.log10(runner.total / 100));
16921
+ text(
16922
+ progressText,
16923
+ percent.toFixed(Math.min(Math.max(decimalPlaces, 0), 100)) + '%'
16924
+ );
16925
+ }
16926
+ if (progressRing) {
16927
+ var radius = parseFloat(getComputedStyle(progressRing[0]).getPropertyValue('r'));
16928
+ var wholeArc = Math.PI * 2 * radius;
16929
+ var highlightArc = percent * (wholeArc / 100);
16930
+ // The progress ring is in 2 parts, the flatlight color and highlight color.
16931
+ // Rendering both on top of the other, seems to make a 3rd color on the edges.
16932
+ // To create 1 whole ring with 2 colors, both parts are inverse of the other.
16933
+ progressRing[0].style['stroke-dasharray'] = `0,${highlightArc}px,${wholeArc}px`;
16934
+ progressRing[1].style['stroke-dasharray'] = `${highlightArc}px,${wholeArc}px`;
16833
16935
  }
16834
16936
 
16835
16937
  // update stats
@@ -17658,6 +17760,7 @@
17658
17760
  var attrs = {
17659
17761
  classname: test.parent.fullTitle(),
17660
17762
  name: test.title,
17763
+ file: test.file,
17661
17764
  time: test.duration / 1000 || 0
17662
17765
  };
17663
17766
 
@@ -19066,7 +19169,7 @@
19066
19169
  };
19067
19170
 
19068
19171
  var name = "mocha";
19069
- var version = "10.3.0";
19172
+ var version = "10.6.0";
19070
19173
  var homepage = "https://mochajs.org/";
19071
19174
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
19072
19175
  var require$$17 = {
@@ -20465,8 +20568,8 @@
20465
20568
 
20466
20569
  process.on = function (e, fn) {
20467
20570
  if (e === 'uncaughtException') {
20468
- commonjsGlobal.onerror = function (err, url, line) {
20469
- fn(new Error(err + ' (' + url + ':' + line + ')'));
20571
+ commonjsGlobal.onerror = function (msg, url, line, col, err) {
20572
+ fn(err || new Error(msg + ' (' + url + ':' + line + ':' + col + ')'));
20470
20573
  return !mocha.options.allowUncaught;
20471
20574
  };
20472
20575
  uncaughtExceptionHandlers.push(fn);