importmap_mocha-rails 0.3.2 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- // mocha@10.2.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) :
@@ -972,6 +972,11 @@
972
972
  ? global$2.TYPED_ARRAY_SUPPORT
973
973
  : true;
974
974
 
975
+ /*
976
+ * Export kMaxLength after typed array support is determined.
977
+ */
978
+ kMaxLength$1();
979
+
975
980
  function kMaxLength$1 () {
976
981
  return Buffer$1.TYPED_ARRAY_SUPPORT
977
982
  ? 0x7fffffff
@@ -5815,6 +5820,8 @@
5815
5820
  /*istanbul ignore end*/
5816
5821
  diff: function diff(oldString, newString) {
5817
5822
  /*istanbul ignore start*/
5823
+ var _options$timeout;
5824
+
5818
5825
  var
5819
5826
  /*istanbul ignore end*/
5820
5827
  options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -5848,84 +5855,123 @@
5848
5855
  oldLen = oldString.length;
5849
5856
  var editLength = 1;
5850
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;
5851
5869
  var bestPath = [{
5852
- newPos: -1,
5853
- components: []
5870
+ oldPos: -1,
5871
+ lastComponent: undefined
5854
5872
  }]; // Seed editLength = 0, i.e. the content starts with the same values
5855
5873
 
5856
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
5874
+ var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
5857
5875
 
5858
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
5876
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
5859
5877
  // Identity per the equality and tokenizer
5860
5878
  return done([{
5861
5879
  value: this.join(newString),
5862
5880
  count: newString.length
5863
5881
  }]);
5864
- } // Main worker method. checks all permutations of a given edit length for acceptance.
5865
-
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.
5866
5903
 
5867
5904
  function execEditLength() {
5868
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
5905
+ for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
5869
5906
  var basePath =
5870
5907
  /*istanbul ignore start*/
5871
5908
  void 0
5872
5909
  /*istanbul ignore end*/
5873
5910
  ;
5911
+ var removePath = bestPath[diagonalPath - 1],
5912
+ addPath = bestPath[diagonalPath + 1];
5874
5913
 
5875
- var addPath = bestPath[diagonalPath - 1],
5876
- removePath = bestPath[diagonalPath + 1],
5877
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
5878
-
5879
- if (addPath) {
5914
+ if (removePath) {
5880
5915
  // No one else is going to attempt to use this value, clear it
5881
5916
  bestPath[diagonalPath - 1] = undefined;
5882
5917
  }
5883
5918
 
5884
- var canAdd = addPath && addPath.newPos + 1 < newLen,
5885
- 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;
5886
5928
 
5887
5929
  if (!canAdd && !canRemove) {
5888
5930
  // If this path is a terminal then prune
5889
5931
  bestPath[diagonalPath] = undefined;
5890
5932
  continue;
5891
5933
  } // Select the diagonal that we want to branch from. We select the prior
5892
- // 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
5893
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.
5894
5938
 
5895
5939
 
5896
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
5897
- basePath = clonePath(removePath);
5898
- self.pushComponent(basePath.components, undefined, true);
5940
+ if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
5941
+ basePath = self.addToPath(addPath, true, undefined, 0);
5899
5942
  } else {
5900
- basePath = addPath; // No need to clone, we've pulled it from the list
5901
-
5902
- basePath.newPos++;
5903
- self.pushComponent(basePath.components, true, undefined);
5943
+ basePath = self.addToPath(removePath, undefined, true, 1);
5904
5944
  }
5905
5945
 
5906
- _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);
5907
5947
 
5908
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
5909
- 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));
5910
5951
  } else {
5911
- // Otherwise track this path as a potential candidate and continue.
5912
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
+ }
5913
5961
  }
5914
5962
  }
5915
5963
 
5916
5964
  editLength++;
5917
5965
  } // Performs the length of edit iteration. Is a bit fugly as this has to support the
5918
5966
  // sync and async mode which is never fun. Loops over execEditLength until a value
5919
- // is produced.
5967
+ // is produced, or until the edit length exceeds options.maxEditLength (if given),
5968
+ // in which case it will return undefined.
5920
5969
 
5921
5970
 
5922
5971
  if (callback) {
5923
5972
  (function exec() {
5924
5973
  setTimeout(function () {
5925
- // This should not happen, but we want to be safe.
5926
-
5927
- /* istanbul ignore next */
5928
- if (editLength > maxEditLength) {
5974
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
5929
5975
  return callback();
5930
5976
  }
5931
5977
 
@@ -5935,7 +5981,7 @@
5935
5981
  }, 0);
5936
5982
  })();
5937
5983
  } else {
5938
- while (editLength <= maxEditLength) {
5984
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
5939
5985
  var ret = execEditLength();
5940
5986
 
5941
5987
  if (ret) {
@@ -5948,23 +5994,29 @@
5948
5994
  /*istanbul ignore start*/
5949
5995
 
5950
5996
  /*istanbul ignore end*/
5951
- pushComponent: function pushComponent(components, added, removed) {
5952
- var last = components[components.length - 1];
5997
+ addToPath: function addToPath(path, added, removed, oldPosInc) {
5998
+ var last = path.lastComponent;
5953
5999
 
5954
6000
  if (last && last.added === added && last.removed === removed) {
5955
- // We need to clone here as the component clone operation is just
5956
- // as shallow array clone
5957
- components[components.length - 1] = {
5958
- count: last.count + 1,
5959
- added: added,
5960
- 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
+ }
5961
6009
  };
5962
6010
  } else {
5963
- components.push({
5964
- count: 1,
5965
- added: added,
5966
- removed: removed
5967
- });
6011
+ return {
6012
+ oldPos: path.oldPos + oldPosInc,
6013
+ lastComponent: {
6014
+ count: 1,
6015
+ added: added,
6016
+ removed: removed,
6017
+ previousComponent: last
6018
+ }
6019
+ };
5968
6020
  }
5969
6021
  },
5970
6022
 
@@ -5974,8 +6026,8 @@
5974
6026
  extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
5975
6027
  var newLen = newString.length,
5976
6028
  oldLen = oldString.length,
5977
- newPos = basePath.newPos,
5978
- oldPos = newPos - diagonalPath,
6029
+ oldPos = basePath.oldPos,
6030
+ newPos = oldPos - diagonalPath,
5979
6031
  commonCount = 0;
5980
6032
 
5981
6033
  while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
@@ -5985,13 +6037,14 @@
5985
6037
  }
5986
6038
 
5987
6039
  if (commonCount) {
5988
- basePath.components.push({
5989
- count: commonCount
5990
- });
6040
+ basePath.lastComponent = {
6041
+ count: commonCount,
6042
+ previousComponent: basePath.lastComponent
6043
+ };
5991
6044
  }
5992
6045
 
5993
- basePath.newPos = newPos;
5994
- return oldPos;
6046
+ basePath.oldPos = oldPos;
6047
+ return newPos;
5995
6048
  },
5996
6049
 
5997
6050
  /*istanbul ignore start*/
@@ -6042,7 +6095,20 @@
6042
6095
  }
6043
6096
  };
6044
6097
 
6045
- 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();
6046
6112
  var componentPos = 0,
6047
6113
  componentLen = components.length,
6048
6114
  newPos = 0,
@@ -6085,23 +6151,16 @@
6085
6151
  // This is only available for string mode.
6086
6152
 
6087
6153
 
6088
- var lastComponent = components[componentLen - 1];
6154
+ var finalComponent = components[componentLen - 1];
6089
6155
 
6090
- if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
6091
- 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;
6092
6158
  components.pop();
6093
6159
  }
6094
6160
 
6095
6161
  return components;
6096
6162
  }
6097
6163
 
6098
- function clonePath(path) {
6099
- return {
6100
- newPos: path.newPos,
6101
- components: path.components.slice(0)
6102
- };
6103
- }
6104
-
6105
6164
  }(base));
6106
6165
 
6107
6166
  var character = {};
@@ -6317,6 +6376,11 @@
6317
6376
 
6318
6377
  /*istanbul ignore end*/
6319
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
+
6320
6384
  var retLines = [],
6321
6385
  linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
6322
6386
 
@@ -7037,7 +7101,7 @@
7037
7101
  var line = _hunk.lines[j],
7038
7102
  operation = line.length > 0 ? line[0] : ' ',
7039
7103
  content = line.length > 0 ? line.substr(1) : line,
7040
- delimiter = _hunk.linedelimiters[j];
7104
+ delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n';
7041
7105
 
7042
7106
  if (operation === ' ') {
7043
7107
  _toPos++;
@@ -7179,6 +7243,11 @@
7179
7243
  diffLines)
7180
7244
  /*istanbul ignore end*/
7181
7245
  (oldStr, newStr, options);
7246
+
7247
+ if (!diff) {
7248
+ return;
7249
+ }
7250
+
7182
7251
  diff.push({
7183
7252
  value: '',
7184
7253
  lines: []
@@ -7355,6 +7424,10 @@
7355
7424
  }
7356
7425
 
7357
7426
  function formatPatch(diff) {
7427
+ if (Array.isArray(diff)) {
7428
+ return diff.map(formatPatch).join('\n');
7429
+ }
7430
+
7358
7431
  var ret = [];
7359
7432
 
7360
7433
  if (diff.oldFileName == diff.newFileName) {
@@ -8033,6 +8106,70 @@
8033
8106
  };
8034
8107
  }
8035
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
+
8036
8173
  var dmp = {};
8037
8174
 
8038
8175
  /*istanbul ignore start*/
@@ -8206,6 +8343,12 @@
8206
8343
  return _merge.merge;
8207
8344
  }
8208
8345
  });
8346
+ Object.defineProperty(exports, "reversePatch", {
8347
+ enumerable: true,
8348
+ get: function get() {
8349
+ return _reverse.reversePatch;
8350
+ }
8351
+ });
8209
8352
  Object.defineProperty(exports, "structuredPatch", {
8210
8353
  enumerable: true,
8211
8354
  get: function get() {
@@ -8224,6 +8367,12 @@
8224
8367
  return _create.createPatch;
8225
8368
  }
8226
8369
  });
8370
+ Object.defineProperty(exports, "formatPatch", {
8371
+ enumerable: true,
8372
+ get: function get() {
8373
+ return _create.formatPatch;
8374
+ }
8375
+ });
8227
8376
  Object.defineProperty(exports, "convertChangesToDMP", {
8228
8377
  enumerable: true,
8229
8378
  get: function get() {
@@ -8304,6 +8453,12 @@
8304
8453
  /*istanbul ignore end*/
8305
8454
  ;
8306
8455
 
8456
+ var
8457
+ /*istanbul ignore start*/
8458
+ _reverse = reverse
8459
+ /*istanbul ignore end*/
8460
+ ;
8461
+
8307
8462
  var
8308
8463
  /*istanbul ignore start*/
8309
8464
  _create = create
@@ -8722,6 +8877,11 @@
8722
8877
  ? global$1.TYPED_ARRAY_SUPPORT
8723
8878
  : true;
8724
8879
 
8880
+ /*
8881
+ * Export kMaxLength after typed array support is determined.
8882
+ */
8883
+ kMaxLength();
8884
+
8725
8885
  function kMaxLength () {
8726
8886
  return Buffer.TYPED_ARRAY_SUPPORT
8727
8887
  ? 0x7fffffff
@@ -8813,6 +8973,8 @@
8813
8973
  if (Buffer.TYPED_ARRAY_SUPPORT) {
8814
8974
  Buffer.prototype.__proto__ = Uint8Array.prototype;
8815
8975
  Buffer.__proto__ = Uint8Array;
8976
+ if (typeof Symbol !== 'undefined' && Symbol.species &&
8977
+ Buffer[Symbol.species] === Buffer) ;
8816
8978
  }
8817
8979
 
8818
8980
  function assertSize (size) {
@@ -10456,28 +10618,6 @@
10456
10618
 
10457
10619
  var utils$3 = {};
10458
10620
 
10459
- let urlAlphabet =
10460
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
10461
- let customAlphabet = (alphabet, defaultSize = 21) => {
10462
- return (size = defaultSize) => {
10463
- let id = '';
10464
- let i = size;
10465
- while (i--) {
10466
- id += alphabet[(Math.random() * alphabet.length) | 0];
10467
- }
10468
- return id
10469
- }
10470
- };
10471
- let nanoid = (size = 21) => {
10472
- let id = '';
10473
- let i = size;
10474
- while (i--) {
10475
- id += urlAlphabet[(Math.random() * 64) | 0];
10476
- }
10477
- return id
10478
- };
10479
- var nonSecure = { nanoid, customAlphabet };
10480
-
10481
10621
  var he = {exports: {}};
10482
10622
 
10483
10623
  /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
@@ -10831,8 +10971,6 @@
10831
10971
  /**
10832
10972
  * Module dependencies.
10833
10973
  */
10834
-
10835
- const {nanoid} = nonSecure;
10836
10974
  var path = require$$1;
10837
10975
  var util = require$$0$1;
10838
10976
  var he$1 = he.exports;
@@ -11438,11 +11576,22 @@
11438
11576
  MOCHA_ID_PROP_NAME
11439
11577
  });
11440
11578
 
11579
+ const uniqueIDBase =
11580
+ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
11581
+
11441
11582
  /**
11442
11583
  * Creates a new unique identifier
11584
+ * Does not create cryptographically safe ids.
11585
+ * Trivial copy of nanoid/non-secure
11443
11586
  * @returns {string} Unique identifier
11444
11587
  */
11445
- exports.uniqueID = () => nanoid();
11588
+ exports.uniqueID = () => {
11589
+ let id = '';
11590
+ for (let i = 0; i < 21; i++) {
11591
+ id += uniqueIDBase[(Math.random() * 64) | 0];
11592
+ }
11593
+ return id;
11594
+ };
11446
11595
 
11447
11596
  exports.assignNewMochaID = obj => {
11448
11597
  const id = exports.uniqueID();
@@ -11461,6 +11610,39 @@
11461
11610
  */
11462
11611
  exports.getMochaID = obj =>
11463
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
+ };
11464
11646
  }(utils$3));
11465
11647
 
11466
11648
  var _nodeResolve_empty = {};
@@ -12969,7 +13151,7 @@
12969
13151
  *
12970
13152
  * @memberof Mocha.Runnable
12971
13153
  * @public
12972
- * @return {string}
13154
+ * @return {string[]}
12973
13155
  */
12974
13156
  Runnable$3.prototype.titlePath = function () {
12975
13157
  return this.parent.titlePath().concat([this.title]);
@@ -13712,7 +13894,7 @@
13712
13894
  *
13713
13895
  * @memberof Suite
13714
13896
  * @public
13715
- * @return {string}
13897
+ * @return {string[]}
13716
13898
  */
13717
13899
  Suite.prototype.titlePath = function () {
13718
13900
  var result = [];
@@ -14434,11 +14616,22 @@
14434
14616
  err = thrown2Error(err);
14435
14617
  }
14436
14618
 
14437
- try {
14438
- err.stack =
14439
- this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
14440
- } catch (ignore) {
14441
- // 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
+ }
14442
14635
  }
14443
14636
 
14444
14637
  this.emit(constants$1.EVENT_TEST_FAIL, test, err);
@@ -15469,6 +15662,56 @@
15469
15662
  }
15470
15663
  });
15471
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
+
15472
15715
  /**
15473
15716
  * Outputs the given `failures` as a list.
15474
15717
  *
@@ -15489,7 +15732,6 @@
15489
15732
  color('error stack', '\n%s\n');
15490
15733
 
15491
15734
  // msg
15492
- var msg;
15493
15735
  var err;
15494
15736
  if (test.err && test.err.multiple) {
15495
15737
  if (multipleTest !== test) {
@@ -15500,25 +15742,8 @@
15500
15742
  } else {
15501
15743
  err = test.err;
15502
15744
  }
15503
- var message;
15504
- if (typeof err.inspect === 'function') {
15505
- message = err.inspect() + '';
15506
- } else if (err.message && typeof err.message.toString === 'function') {
15507
- message = err.message + '';
15508
- } else {
15509
- message = '';
15510
- }
15511
- var stack = err.stack || message;
15512
- var index = message ? stack.indexOf(message) : -1;
15513
15745
 
15514
- if (index === -1) {
15515
- msg = message;
15516
- } else {
15517
- index += message.length;
15518
- msg = stack.slice(0, index);
15519
- // remove msg from stack
15520
- stack = stack.slice(index + 1);
15521
- }
15746
+ var { message, msg, stack } = getFullErrorStack(err);
15522
15747
 
15523
15748
  // uncaught
15524
15749
  if (err.uncaught) {
@@ -15796,6 +16021,15 @@
15796
16021
  Base.consoleLog = consoleLog;
15797
16022
 
15798
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
+ */
15799
16033
  }(base$1, base$1.exports));
15800
16034
 
15801
16035
  var dot = {exports: {}};
@@ -16456,143 +16690,6 @@
16456
16690
 
16457
16691
  var html = {exports: {}};
16458
16692
 
16459
- /**
16460
- @module browser/Progress
16461
- */
16462
-
16463
- /**
16464
- * Expose `Progress`.
16465
- */
16466
-
16467
- var progress$1 = Progress;
16468
-
16469
- /**
16470
- * Initialize a new `Progress` indicator.
16471
- */
16472
- function Progress() {
16473
- this.percent = 0;
16474
- this.size(0);
16475
- this.fontSize(11);
16476
- this.font('helvetica, arial, sans-serif');
16477
- }
16478
-
16479
- /**
16480
- * Set progress size to `size`.
16481
- *
16482
- * @public
16483
- * @param {number} size
16484
- * @return {Progress} Progress instance.
16485
- */
16486
- Progress.prototype.size = function (size) {
16487
- this._size = size;
16488
- return this;
16489
- };
16490
-
16491
- /**
16492
- * Set text to `text`.
16493
- *
16494
- * @public
16495
- * @param {string} text
16496
- * @return {Progress} Progress instance.
16497
- */
16498
- Progress.prototype.text = function (text) {
16499
- this._text = text;
16500
- return this;
16501
- };
16502
-
16503
- /**
16504
- * Set font size to `size`.
16505
- *
16506
- * @public
16507
- * @param {number} size
16508
- * @return {Progress} Progress instance.
16509
- */
16510
- Progress.prototype.fontSize = function (size) {
16511
- this._fontSize = size;
16512
- return this;
16513
- };
16514
-
16515
- /**
16516
- * Set font to `family`.
16517
- *
16518
- * @param {string} family
16519
- * @return {Progress} Progress instance.
16520
- */
16521
- Progress.prototype.font = function (family) {
16522
- this._font = family;
16523
- return this;
16524
- };
16525
-
16526
- /**
16527
- * Update percentage to `n`.
16528
- *
16529
- * @param {number} n
16530
- * @return {Progress} Progress instance.
16531
- */
16532
- Progress.prototype.update = function (n) {
16533
- this.percent = n;
16534
- return this;
16535
- };
16536
-
16537
- /**
16538
- * Draw on `ctx`.
16539
- *
16540
- * @param {CanvasRenderingContext2d} ctx
16541
- * @return {Progress} Progress instance.
16542
- */
16543
- Progress.prototype.draw = function (ctx) {
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
-
16559
- var percent = Math.min(this.percent, 100);
16560
- var size = this._size;
16561
- var half = size / 2;
16562
- var x = half;
16563
- var y = half;
16564
- var rad = half - 1;
16565
- var fontSize = this._fontSize;
16566
-
16567
- ctx.font = fontSize + 'px ' + this._font;
16568
-
16569
- var angle = Math.PI * 2 * (percent / 100);
16570
- ctx.clearRect(0, 0, size, size);
16571
-
16572
- // outer circle
16573
- ctx.strokeStyle = colors.outerCircle;
16574
- ctx.beginPath();
16575
- ctx.arc(x, y, rad, 0, angle, false);
16576
- ctx.stroke();
16577
-
16578
- // inner circle
16579
- ctx.strokeStyle = colors.innerCircle;
16580
- ctx.beginPath();
16581
- ctx.arc(x, y, rad - 1, 0, angle, true);
16582
- ctx.stroke();
16583
-
16584
- // text
16585
- var text = this._text || (percent | 0) + '%';
16586
- var w = ctx.measureText(text).width;
16587
-
16588
- ctx.fillStyle = colors.text;
16589
- ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
16590
- } catch (ignore) {
16591
- // don't fail if we can't render progress
16592
- }
16593
- return this;
16594
- };
16595
-
16596
16693
  (function (module, exports) {
16597
16694
 
16598
16695
  /* eslint-env browser */
@@ -16605,7 +16702,6 @@
16605
16702
 
16606
16703
  var Base = base$1.exports;
16607
16704
  var utils = utils$3;
16608
- var Progress = progress$1;
16609
16705
  var escapeRe = escapeStringRegexp;
16610
16706
  var constants = runner.constants;
16611
16707
  var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
@@ -16633,7 +16729,7 @@
16633
16729
 
16634
16730
  var statsTemplate =
16635
16731
  '<ul id="mocha-stats">' +
16636
- '<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>' +
16637
16733
  '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
16638
16734
  '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
16639
16735
  '<li class="duration">duration: <em>0</em>s</li>' +
@@ -16663,24 +16759,15 @@
16663
16759
  var failures = items[2].getElementsByTagName('em')[0];
16664
16760
  var failuresLink = items[2].getElementsByTagName('a')[0];
16665
16761
  var duration = items[3].getElementsByTagName('em')[0];
16666
- var canvas = stat.getElementsByTagName('canvas')[0];
16667
16762
  var report = fragment('<ul id="mocha-report"></ul>');
16668
16763
  var stack = [report];
16669
- var progress;
16670
- 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]];
16671
16769
  var root = document.getElementById('mocha');
16672
16770
 
16673
- if (canvas.getContext) {
16674
- var ratio = window.devicePixelRatio || 1;
16675
- canvas.style.width = canvas.width;
16676
- canvas.style.height = canvas.height;
16677
- canvas.width *= ratio;
16678
- canvas.height *= ratio;
16679
- ctx = canvas.getContext('2d');
16680
- ctx.scale(ratio, ratio);
16681
- progress = new Progress();
16682
- }
16683
-
16684
16771
  if (!root) {
16685
16772
  return error('#mocha div missing, add it to your document');
16686
16773
  }
@@ -16710,10 +16797,6 @@
16710
16797
  root.appendChild(stat);
16711
16798
  root.appendChild(report);
16712
16799
 
16713
- if (progress) {
16714
- progress.size(40);
16715
- }
16716
-
16717
16800
  runner.on(EVENT_SUITE_BEGIN, function (suite) {
16718
16801
  if (suite.root) {
16719
16802
  return;
@@ -16829,8 +16912,26 @@
16829
16912
  function updateStats() {
16830
16913
  // TODO: add to stats
16831
16914
  var percent = ((stats.tests / runner.total) * 100) | 0;
16832
- if (progress) {
16833
- 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`;
16834
16935
  }
16835
16936
 
16836
16937
  // update stats
@@ -17296,7 +17397,7 @@
17296
17397
  runner.once(EVENT_RUN_END, function () {
17297
17398
  Base.cursor.show();
17298
17399
  for (var i = 0; i < self.numberOfLines; i++) {
17299
- write('\n');
17400
+ process.stdout.write('\n');
17300
17401
  }
17301
17402
  self.epilogue();
17302
17403
  });
@@ -17332,15 +17433,15 @@
17332
17433
  var stats = this.stats;
17333
17434
 
17334
17435
  function draw(type, n) {
17335
- write(' ');
17336
- write(Base.color(type, n));
17337
- write('\n');
17436
+ process.stdout.write(' ');
17437
+ process.stdout.write(Base.color(type, n));
17438
+ process.stdout.write('\n');
17338
17439
  }
17339
17440
 
17340
17441
  draw('green', stats.passes);
17341
17442
  draw('fail', stats.failures);
17342
17443
  draw('pending', stats.pending);
17343
- write('\n');
17444
+ process.stdout.write('\n');
17344
17445
 
17345
17446
  this.cursorUp(this.numberOfLines);
17346
17447
  };
@@ -17374,9 +17475,9 @@
17374
17475
  var self = this;
17375
17476
 
17376
17477
  this.trajectories.forEach(function (line) {
17377
- write('\u001b[' + self.scoreboardWidth + 'C');
17378
- write(line.join(''));
17379
- write('\n');
17478
+ process.stdout.write('\u001b[' + self.scoreboardWidth + 'C');
17479
+ process.stdout.write(line.join(''));
17480
+ process.stdout.write('\n');
17380
17481
  });
17381
17482
 
17382
17483
  this.cursorUp(this.numberOfLines);
@@ -17393,25 +17494,25 @@
17393
17494
  var dist = '\u001b[' + startWidth + 'C';
17394
17495
  var padding = '';
17395
17496
 
17396
- write(dist);
17397
- write('_,------,');
17398
- write('\n');
17497
+ process.stdout.write(dist);
17498
+ process.stdout.write('_,------,');
17499
+ process.stdout.write('\n');
17399
17500
 
17400
- write(dist);
17501
+ process.stdout.write(dist);
17401
17502
  padding = self.tick ? ' ' : ' ';
17402
- write('_|' + padding + '/\\_/\\ ');
17403
- write('\n');
17503
+ process.stdout.write('_|' + padding + '/\\_/\\ ');
17504
+ process.stdout.write('\n');
17404
17505
 
17405
- write(dist);
17506
+ process.stdout.write(dist);
17406
17507
  padding = self.tick ? '_' : '__';
17407
17508
  var tail = self.tick ? '~' : '^';
17408
- write(tail + '|' + padding + this.face() + ' ');
17409
- write('\n');
17509
+ process.stdout.write(tail + '|' + padding + this.face() + ' ');
17510
+ process.stdout.write('\n');
17410
17511
 
17411
- write(dist);
17512
+ process.stdout.write(dist);
17412
17513
  padding = self.tick ? ' ' : ' ';
17413
- write(padding + '"" "" ');
17414
- write('\n');
17514
+ process.stdout.write(padding + '"" "" ');
17515
+ process.stdout.write('\n');
17415
17516
 
17416
17517
  this.cursorUp(this.numberOfLines);
17417
17518
  };
@@ -17443,7 +17544,7 @@
17443
17544
  */
17444
17545
 
17445
17546
  NyanCat.prototype.cursorUp = function (n) {
17446
- write('\u001b[' + n + 'A');
17547
+ process.stdout.write('\u001b[' + n + 'A');
17447
17548
  };
17448
17549
 
17449
17550
  /**
@@ -17454,7 +17555,7 @@
17454
17555
  */
17455
17556
 
17456
17557
  NyanCat.prototype.cursorDown = function (n) {
17457
- write('\u001b[' + n + 'B');
17558
+ process.stdout.write('\u001b[' + n + 'B');
17458
17559
  };
17459
17560
 
17460
17561
  /**
@@ -17494,15 +17595,6 @@
17494
17595
  return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
17495
17596
  };
17496
17597
 
17497
- /**
17498
- * Stdout helper.
17499
- *
17500
- * @param {string} string A message to write to stdout.
17501
- */
17502
- function write(string) {
17503
- process.stdout.write(string);
17504
- }
17505
-
17506
17598
  NyanCat.description = '"nyan cat"';
17507
17599
  }(nyan));
17508
17600
 
@@ -17668,6 +17760,7 @@
17668
17760
  var attrs = {
17669
17761
  classname: test.parent.fullTitle(),
17670
17762
  name: test.title,
17763
+ file: test.file,
17671
17764
  time: test.duration / 1000 || 0
17672
17765
  };
17673
17766
 
@@ -19076,7 +19169,7 @@
19076
19169
  };
19077
19170
 
19078
19171
  var name = "mocha";
19079
- var version = "10.2.0";
19172
+ var version = "10.6.0";
19080
19173
  var homepage = "https://mochajs.org/";
19081
19174
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
19082
19175
  var require$$17 = {
@@ -20475,8 +20568,8 @@
20475
20568
 
20476
20569
  process.on = function (e, fn) {
20477
20570
  if (e === 'uncaughtException') {
20478
- commonjsGlobal.onerror = function (err, url, line) {
20479
- fn(new Error(err + ' (' + url + ':' + line + ')'));
20571
+ commonjsGlobal.onerror = function (msg, url, line, col, err) {
20572
+ fn(err || new Error(msg + ' (' + url + ':' + line + ':' + col + ')'));
20480
20573
  return !mocha.options.allowUncaught;
20481
20574
  };
20482
20575
  uncaughtExceptionHandlers.push(fn);
@@ -20632,4 +20725,3 @@
20632
20725
  return browserEntry;
20633
20726
 
20634
20727
  }));
20635
- //# sourceMappingURL=mocha.js.map