mocha 9.0.1 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mocha.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@9.0.1 transpiled to javascript ES5
1
+ // mocha@9.0.2 transpiled to javascript ES5
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) :
@@ -244,7 +244,7 @@
244
244
  (module.exports = function (key, value) {
245
245
  return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
246
246
  })('versions', []).push({
247
- version: '3.14.0',
247
+ version: '3.15.2',
248
248
  mode: 'global',
249
249
  copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
250
250
  });
@@ -921,13 +921,11 @@
921
921
  };
922
922
 
923
923
  // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
924
- // so we use an intermediate function.
925
- function RE(s, f) {
924
+ var RE = function (s, f) {
926
925
  return RegExp(s, f);
927
- }
926
+ };
928
927
 
929
928
  var UNSUPPORTED_Y$3 = fails(function () {
930
- // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
931
929
  var re = RE('a', 'y');
932
930
  re.lastIndex = 2;
933
931
  return re.exec('abcd') != null;
@@ -945,12 +943,115 @@
945
943
  BROKEN_CARET: BROKEN_CARET
946
944
  };
947
945
 
946
+ // `Object.defineProperties` method
947
+ // https://tc39.es/ecma262/#sec-object.defineproperties
948
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
949
+ var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
950
+ anObject(O);
951
+ var keys = objectKeys(Properties);
952
+ var length = keys.length;
953
+ var index = 0;
954
+ var key;
955
+ while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
956
+ return O;
957
+ };
958
+
959
+ var html$1 = getBuiltIn('document', 'documentElement');
960
+
961
+ var GT = '>';
962
+ var LT = '<';
963
+ var PROTOTYPE$2 = 'prototype';
964
+ var SCRIPT = 'script';
965
+ var IE_PROTO$1 = sharedKey('IE_PROTO');
966
+
967
+ var EmptyConstructor = function () { /* empty */ };
968
+
969
+ var scriptTag = function (content) {
970
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
971
+ };
972
+
973
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
974
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
975
+ activeXDocument.write(scriptTag(''));
976
+ activeXDocument.close();
977
+ var temp = activeXDocument.parentWindow.Object;
978
+ activeXDocument = null; // avoid memory leak
979
+ return temp;
980
+ };
981
+
982
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
983
+ var NullProtoObjectViaIFrame = function () {
984
+ // Thrash, waste and sodomy: IE GC bug
985
+ var iframe = documentCreateElement('iframe');
986
+ var JS = 'java' + SCRIPT + ':';
987
+ var iframeDocument;
988
+ iframe.style.display = 'none';
989
+ html$1.appendChild(iframe);
990
+ // https://github.com/zloirock/core-js/issues/475
991
+ iframe.src = String(JS);
992
+ iframeDocument = iframe.contentWindow.document;
993
+ iframeDocument.open();
994
+ iframeDocument.write(scriptTag('document.F=Object'));
995
+ iframeDocument.close();
996
+ return iframeDocument.F;
997
+ };
998
+
999
+ // Check for document.domain and active x support
1000
+ // No need to use active x approach when document.domain is not set
1001
+ // see https://github.com/es-shims/es5-shim/issues/150
1002
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1003
+ // avoid IE GC bug
1004
+ var activeXDocument;
1005
+ var NullProtoObject = function () {
1006
+ try {
1007
+ /* global ActiveXObject -- old IE */
1008
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
1009
+ } catch (error) { /* ignore */ }
1010
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
1011
+ var length = enumBugKeys.length;
1012
+ while (length--) delete NullProtoObject[PROTOTYPE$2][enumBugKeys[length]];
1013
+ return NullProtoObject();
1014
+ };
1015
+
1016
+ hiddenKeys$1[IE_PROTO$1] = true;
1017
+
1018
+ // `Object.create` method
1019
+ // https://tc39.es/ecma262/#sec-object.create
1020
+ var objectCreate = Object.create || function create(O, Properties) {
1021
+ var result;
1022
+ if (O !== null) {
1023
+ EmptyConstructor[PROTOTYPE$2] = anObject(O);
1024
+ result = new EmptyConstructor();
1025
+ EmptyConstructor[PROTOTYPE$2] = null;
1026
+ // add "__proto__" for Object.getPrototypeOf polyfill
1027
+ result[IE_PROTO$1] = O;
1028
+ } else result = NullProtoObject();
1029
+ return Properties === undefined ? result : objectDefineProperties(result, Properties);
1030
+ };
1031
+
1032
+ var regexpUnsupportedDotAll = fails(function () {
1033
+ // babel-minify transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1034
+ var re = RegExp('.', (typeof '').charAt(0));
1035
+ return !(re.dotAll && re.exec('\n') && re.flags === 's');
1036
+ });
1037
+
1038
+ var regexpUnsupportedNcg = fails(function () {
1039
+ // babel-minify transpiles RegExp('.', 'g') -> /./g and it causes SyntaxError
1040
+ var re = RegExp('(?<a>b)', (typeof '').charAt(5));
1041
+ return re.exec('b').groups.a !== 'b' ||
1042
+ 'b'.replace(re, '$<a>c') !== 'bc';
1043
+ });
1044
+
948
1045
  /* eslint-disable regexp/no-assertion-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
949
1046
  /* eslint-disable regexp/no-useless-quantifier -- testing */
950
1047
 
951
1048
 
952
1049
 
953
1050
 
1051
+ var getInternalState$5 = internalState.get;
1052
+
1053
+
1054
+
954
1055
  var nativeExec = RegExp.prototype.exec;
955
1056
  var nativeReplace = shared('native-string-replace', String.prototype.replace);
956
1057
 
@@ -969,12 +1070,24 @@
969
1070
  // nonparticipating capturing group, copied from es5-shim's String#split patch.
970
1071
  var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
971
1072
 
972
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2;
1073
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg;
973
1074
 
974
1075
  if (PATCH) {
1076
+ // eslint-disable-next-line max-statements -- TODO
975
1077
  patchedExec = function exec(str) {
976
1078
  var re = this;
977
- var lastIndex, reCopy, match, i;
1079
+ var state = getInternalState$5(re);
1080
+ var raw = state.raw;
1081
+ var result, reCopy, lastIndex, match, i, object, group;
1082
+
1083
+ if (raw) {
1084
+ raw.lastIndex = re.lastIndex;
1085
+ result = patchedExec.call(raw, str);
1086
+ re.lastIndex = raw.lastIndex;
1087
+ return result;
1088
+ }
1089
+
1090
+ var groups = state.groups;
978
1091
  var sticky = UNSUPPORTED_Y$2 && re.sticky;
979
1092
  var flags = regexpFlags.call(re);
980
1093
  var source = re.source;
@@ -1026,6 +1139,14 @@
1026
1139
  });
1027
1140
  }
1028
1141
 
1142
+ if (match && groups) {
1143
+ match.groups = object = objectCreate(null);
1144
+ for (i = 0; i < groups.length; i++) {
1145
+ group = groups[i];
1146
+ object[group[0]] = match[group[1]];
1147
+ }
1148
+ }
1149
+
1029
1150
  return match;
1030
1151
  };
1031
1152
  }
@@ -1049,47 +1170,7 @@
1049
1170
  var SPECIES$4 = wellKnownSymbol('species');
1050
1171
  var RegExpPrototype$2 = RegExp.prototype;
1051
1172
 
1052
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
1053
- // #replace needs built-in support for named groups.
1054
- // #match works fine because it just return the exec results, even if it has
1055
- // a "grops" property.
1056
- var re = /./;
1057
- re.exec = function () {
1058
- var result = [];
1059
- result.groups = { a: '7' };
1060
- return result;
1061
- };
1062
- return ''.replace(re, '$<a>') !== '7';
1063
- });
1064
-
1065
- // IE <= 11 replaces $0 with the whole match, as if it was $&
1066
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
1067
- var REPLACE_KEEPS_$0 = (function () {
1068
- // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
1069
- return 'a'.replace(/./, '$0') === '$0';
1070
- })();
1071
-
1072
- var REPLACE = wellKnownSymbol('replace');
1073
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
1074
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
1075
- if (/./[REPLACE]) {
1076
- return /./[REPLACE]('a', '$0') === '';
1077
- }
1078
- return false;
1079
- })();
1080
-
1081
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1082
- // Weex JS has frozen built-in prototypes, so use try / catch wrapper
1083
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
1084
- // eslint-disable-next-line regexp/no-empty-group -- required for testing
1085
- var re = /(?:)/;
1086
- var originalExec = re.exec;
1087
- re.exec = function () { return originalExec.apply(this, arguments); };
1088
- var result = 'ab'.split(re);
1089
- return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
1090
- });
1091
-
1092
- var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
1173
+ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
1093
1174
  var SYMBOL = wellKnownSymbol(KEY);
1094
1175
 
1095
1176
  var DELEGATES_TO_SYMBOL = !fails(function () {
@@ -1126,12 +1207,7 @@
1126
1207
  if (
1127
1208
  !DELEGATES_TO_SYMBOL ||
1128
1209
  !DELEGATES_TO_EXEC ||
1129
- (KEY === 'replace' && !(
1130
- REPLACE_SUPPORTS_NAMED_GROUPS &&
1131
- REPLACE_KEEPS_$0 &&
1132
- !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
1133
- )) ||
1134
- (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
1210
+ FORCED
1135
1211
  ) {
1136
1212
  var nativeRegExpMethod = /./[SYMBOL];
1137
1213
  var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
@@ -1146,25 +1222,13 @@
1146
1222
  return { done: true, value: nativeMethod.call(str, regexp, arg2) };
1147
1223
  }
1148
1224
  return { done: false };
1149
- }, {
1150
- REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
1151
- REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
1152
1225
  });
1153
- var stringMethod = methods[0];
1154
- var regexMethod = methods[1];
1155
-
1156
- redefine(String.prototype, KEY, stringMethod);
1157
- redefine(RegExpPrototype$2, SYMBOL, length == 2
1158
- // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
1159
- // 21.2.5.11 RegExp.prototype[@@split](string, limit)
1160
- ? function (string, arg) { return regexMethod.call(string, this, arg); }
1161
- // 21.2.5.6 RegExp.prototype[@@match](string)
1162
- // 21.2.5.9 RegExp.prototype[@@search](string)
1163
- : function (string) { return regexMethod.call(string, this); }
1164
- );
1226
+
1227
+ redefine(String.prototype, KEY, methods[0]);
1228
+ redefine(RegExpPrototype$2, SYMBOL, methods[1]);
1165
1229
  }
1166
1230
 
1167
- if (sham) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
1231
+ if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
1168
1232
  };
1169
1233
 
1170
1234
  // `SameValue` abstract operation
@@ -1195,7 +1259,7 @@
1195
1259
  };
1196
1260
 
1197
1261
  // @@search logic
1198
- fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
1262
+ fixRegexpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
1199
1263
  return [
1200
1264
  // `String.prototype.search` method
1201
1265
  // https://tc39.es/ecma262/#sec-string.prototype.search
@@ -1206,12 +1270,12 @@
1206
1270
  },
1207
1271
  // `RegExp.prototype[@@search]` method
1208
1272
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
1209
- function (regexp) {
1210
- var res = maybeCallNative(nativeSearch, regexp, this);
1273
+ function (string) {
1274
+ var res = maybeCallNative(nativeSearch, this, string);
1211
1275
  if (res.done) return res.value;
1212
1276
 
1213
- var rx = anObject(regexp);
1214
- var S = String(this);
1277
+ var rx = anObject(this);
1278
+ var S = String(string);
1215
1279
 
1216
1280
  var previousLastIndex = rx.lastIndex;
1217
1281
  if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
@@ -1310,12 +1374,12 @@
1310
1374
  return spreadable !== undefined ? !!spreadable : isArray$3(O);
1311
1375
  };
1312
1376
 
1313
- var FORCED$9 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1377
+ var FORCED$8 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1314
1378
 
1315
1379
  // `Array.prototype.concat` method
1316
1380
  // https://tc39.es/ecma262/#sec-array.prototype.concat
1317
1381
  // with adding support of @@isConcatSpreadable and @@species
1318
- _export({ target: 'Array', proto: true, forced: FORCED$9 }, {
1382
+ _export({ target: 'Array', proto: true, forced: FORCED$8 }, {
1319
1383
  // eslint-disable-next-line no-unused-vars -- required for `.length`
1320
1384
  concat: function concat(arg) {
1321
1385
  var O = toObject(this);
@@ -1673,7 +1737,7 @@
1673
1737
  return Object.getPrototypeOf(new F()) !== F.prototype;
1674
1738
  });
1675
1739
 
1676
- var IE_PROTO$1 = sharedKey('IE_PROTO');
1740
+ var IE_PROTO = sharedKey('IE_PROTO');
1677
1741
  var ObjectPrototype$3 = Object.prototype;
1678
1742
 
1679
1743
  // `Object.getPrototypeOf` method
@@ -1681,7 +1745,7 @@
1681
1745
  // eslint-disable-next-line es/no-object-getprototypeof -- safe
1682
1746
  var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
1683
1747
  O = toObject(O);
1684
- if (has$1(O, IE_PROTO$1)) return O[IE_PROTO$1];
1748
+ if (has$1(O, IE_PROTO)) return O[IE_PROTO];
1685
1749
  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
1686
1750
  return O.constructor.prototype;
1687
1751
  } return O instanceof Object ? ObjectPrototype$3 : null;
@@ -2220,92 +2284,6 @@
2220
2284
  return $this;
2221
2285
  };
2222
2286
 
2223
- // `Object.defineProperties` method
2224
- // https://tc39.es/ecma262/#sec-object.defineproperties
2225
- // eslint-disable-next-line es/no-object-defineproperties -- safe
2226
- var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
2227
- anObject(O);
2228
- var keys = objectKeys(Properties);
2229
- var length = keys.length;
2230
- var index = 0;
2231
- var key;
2232
- while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
2233
- return O;
2234
- };
2235
-
2236
- var html$1 = getBuiltIn('document', 'documentElement');
2237
-
2238
- var GT = '>';
2239
- var LT = '<';
2240
- var PROTOTYPE$2 = 'prototype';
2241
- var SCRIPT = 'script';
2242
- var IE_PROTO = sharedKey('IE_PROTO');
2243
-
2244
- var EmptyConstructor = function () { /* empty */ };
2245
-
2246
- var scriptTag = function (content) {
2247
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2248
- };
2249
-
2250
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2251
- var NullProtoObjectViaActiveX = function (activeXDocument) {
2252
- activeXDocument.write(scriptTag(''));
2253
- activeXDocument.close();
2254
- var temp = activeXDocument.parentWindow.Object;
2255
- activeXDocument = null; // avoid memory leak
2256
- return temp;
2257
- };
2258
-
2259
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
2260
- var NullProtoObjectViaIFrame = function () {
2261
- // Thrash, waste and sodomy: IE GC bug
2262
- var iframe = documentCreateElement('iframe');
2263
- var JS = 'java' + SCRIPT + ':';
2264
- var iframeDocument;
2265
- iframe.style.display = 'none';
2266
- html$1.appendChild(iframe);
2267
- // https://github.com/zloirock/core-js/issues/475
2268
- iframe.src = String(JS);
2269
- iframeDocument = iframe.contentWindow.document;
2270
- iframeDocument.open();
2271
- iframeDocument.write(scriptTag('document.F=Object'));
2272
- iframeDocument.close();
2273
- return iframeDocument.F;
2274
- };
2275
-
2276
- // Check for document.domain and active x support
2277
- // No need to use active x approach when document.domain is not set
2278
- // see https://github.com/es-shims/es5-shim/issues/150
2279
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2280
- // avoid IE GC bug
2281
- var activeXDocument;
2282
- var NullProtoObject = function () {
2283
- try {
2284
- /* global ActiveXObject -- old IE */
2285
- activeXDocument = document.domain && new ActiveXObject('htmlfile');
2286
- } catch (error) { /* ignore */ }
2287
- NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
2288
- var length = enumBugKeys.length;
2289
- while (length--) delete NullProtoObject[PROTOTYPE$2][enumBugKeys[length]];
2290
- return NullProtoObject();
2291
- };
2292
-
2293
- hiddenKeys$1[IE_PROTO] = true;
2294
-
2295
- // `Object.create` method
2296
- // https://tc39.es/ecma262/#sec-object.create
2297
- var objectCreate = Object.create || function create(O, Properties) {
2298
- var result;
2299
- if (O !== null) {
2300
- EmptyConstructor[PROTOTYPE$2] = anObject(O);
2301
- result = new EmptyConstructor();
2302
- EmptyConstructor[PROTOTYPE$2] = null;
2303
- // add "__proto__" for Object.getPrototypeOf polyfill
2304
- result[IE_PROTO] = O;
2305
- } else result = NullProtoObject();
2306
- return Properties === undefined ? result : objectDefineProperties(result, Properties);
2307
- };
2308
-
2309
2287
  // a string of all valid unicode whitespaces
2310
2288
  var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
2311
2289
  '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
@@ -2410,11 +2388,11 @@
2410
2388
 
2411
2389
 
2412
2390
  var FAILS_ON_PRIMITIVES$2 = fails(function () { nativeGetOwnPropertyDescriptor$1(1); });
2413
- var FORCED$8 = !descriptors || FAILS_ON_PRIMITIVES$2;
2391
+ var FORCED$7 = !descriptors || FAILS_ON_PRIMITIVES$2;
2414
2392
 
2415
2393
  // `Object.getOwnPropertyDescriptor` method
2416
2394
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
2417
- _export({ target: 'Object', stat: true, forced: FORCED$8, sham: !descriptors }, {
2395
+ _export({ target: 'Object', stat: true, forced: FORCED$7, sham: !descriptors }, {
2418
2396
  getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
2419
2397
  return nativeGetOwnPropertyDescriptor$1(toIndexedObject(it), key);
2420
2398
  }
@@ -2489,13 +2467,18 @@
2489
2467
 
2490
2468
 
2491
2469
 
2470
+
2492
2471
  var enforceInternalState = internalState.enforce;
2493
2472
 
2494
2473
 
2495
2474
 
2475
+
2476
+
2496
2477
  var MATCH$1 = wellKnownSymbol('match');
2497
2478
  var NativeRegExp = global_1.RegExp;
2498
2479
  var RegExpPrototype = NativeRegExp.prototype;
2480
+ // TODO: Use only propper RegExpIdentifierName
2481
+ var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
2499
2482
  var re1 = /a/g;
2500
2483
  var re2 = /a/g;
2501
2484
 
@@ -2504,50 +2487,143 @@
2504
2487
 
2505
2488
  var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y;
2506
2489
 
2507
- var FORCED$7 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y$1 || fails(function () {
2508
- re2[MATCH$1] = false;
2509
- // RegExp constructor can alter flags and IsRegExp works correct with @@match
2510
- return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
2511
- })));
2490
+ var BASE_FORCED = descriptors &&
2491
+ (!CORRECT_NEW || UNSUPPORTED_Y$1 || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () {
2492
+ re2[MATCH$1] = false;
2493
+ // RegExp constructor can alter flags and IsRegExp works correct with @@match
2494
+ return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
2495
+ }));
2496
+
2497
+ var handleDotAll = function (string) {
2498
+ var length = string.length;
2499
+ var index = 0;
2500
+ var result = '';
2501
+ var brackets = false;
2502
+ var chr;
2503
+ for (; index <= length; index++) {
2504
+ chr = string.charAt(index);
2505
+ if (chr === '\\') {
2506
+ result += chr + string.charAt(++index);
2507
+ continue;
2508
+ }
2509
+ if (!brackets && chr === '.') {
2510
+ result += '[\\s\\S]';
2511
+ } else {
2512
+ if (chr === '[') {
2513
+ brackets = true;
2514
+ } else if (chr === ']') {
2515
+ brackets = false;
2516
+ } result += chr;
2517
+ }
2518
+ } return result;
2519
+ };
2520
+
2521
+ var handleNCG = function (string) {
2522
+ var length = string.length;
2523
+ var index = 0;
2524
+ var result = '';
2525
+ var named = [];
2526
+ var names = {};
2527
+ var brackets = false;
2528
+ var ncg = false;
2529
+ var groupid = 0;
2530
+ var groupname = '';
2531
+ var chr;
2532
+ for (; index <= length; index++) {
2533
+ chr = string.charAt(index);
2534
+ if (chr === '\\') {
2535
+ chr = chr + string.charAt(++index);
2536
+ } else if (chr === ']') {
2537
+ brackets = false;
2538
+ } else if (!brackets) switch (true) {
2539
+ case chr === '[':
2540
+ brackets = true;
2541
+ break;
2542
+ case chr === '(':
2543
+ if (IS_NCG.test(string.slice(index + 1))) {
2544
+ index += 2;
2545
+ ncg = true;
2546
+ }
2547
+ result += chr;
2548
+ groupid++;
2549
+ continue;
2550
+ case chr === '>' && ncg:
2551
+ if (groupname === '' || has$1(names, groupname)) {
2552
+ throw new SyntaxError('Invalid capture group name');
2553
+ }
2554
+ names[groupname] = true;
2555
+ named.push([groupname, groupid]);
2556
+ ncg = false;
2557
+ groupname = '';
2558
+ continue;
2559
+ }
2560
+ if (ncg) groupname += chr;
2561
+ else result += chr;
2562
+ } return [result, named];
2563
+ };
2512
2564
 
2513
2565
  // `RegExp` constructor
2514
2566
  // https://tc39.es/ecma262/#sec-regexp-constructor
2515
- if (FORCED$7) {
2567
+ if (isForced_1('RegExp', BASE_FORCED)) {
2516
2568
  var RegExpWrapper = function RegExp(pattern, flags) {
2517
2569
  var thisIsRegExp = this instanceof RegExpWrapper;
2518
2570
  var patternIsRegExp = isRegexp(pattern);
2519
2571
  var flagsAreUndefined = flags === undefined;
2520
- var sticky;
2572
+ var groups = [];
2573
+ var rawPattern = pattern;
2574
+ var rawFlags, dotAll, sticky, handled, result, state;
2521
2575
 
2522
- if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {
2576
+ if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
2523
2577
  return pattern;
2524
2578
  }
2525
2579
 
2526
- if (CORRECT_NEW) {
2527
- if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;
2528
- } else if (pattern instanceof RegExpWrapper) {
2529
- if (flagsAreUndefined) flags = regexpFlags.call(pattern);
2580
+ if (patternIsRegExp || pattern instanceof RegExpWrapper) {
2530
2581
  pattern = pattern.source;
2582
+ if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : regexpFlags.call(rawPattern);
2583
+ }
2584
+
2585
+ pattern = pattern === undefined ? '' : String(pattern);
2586
+ flags = flags === undefined ? '' : String(flags);
2587
+ rawPattern = pattern;
2588
+
2589
+ if (regexpUnsupportedDotAll && 'dotAll' in re1) {
2590
+ dotAll = !!flags && flags.indexOf('s') > -1;
2591
+ if (dotAll) flags = flags.replace(/s/g, '');
2531
2592
  }
2532
2593
 
2533
- if (UNSUPPORTED_Y$1) {
2594
+ rawFlags = flags;
2595
+
2596
+ if (UNSUPPORTED_Y$1 && 'sticky' in re1) {
2534
2597
  sticky = !!flags && flags.indexOf('y') > -1;
2535
2598
  if (sticky) flags = flags.replace(/y/g, '');
2536
2599
  }
2537
2600
 
2538
- var result = inheritIfRequired(
2539
- CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),
2540
- thisIsRegExp ? this : RegExpPrototype,
2541
- RegExpWrapper
2542
- );
2601
+ if (regexpUnsupportedNcg) {
2602
+ handled = handleNCG(pattern);
2603
+ pattern = handled[0];
2604
+ groups = handled[1];
2605
+ }
2606
+
2607
+ result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
2543
2608
 
2544
- if (UNSUPPORTED_Y$1 && sticky) {
2545
- var state = enforceInternalState(result);
2546
- state.sticky = true;
2609
+ if (dotAll || sticky || groups.length) {
2610
+ state = enforceInternalState(result);
2611
+ if (dotAll) {
2612
+ state.dotAll = true;
2613
+ state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
2614
+ }
2615
+ if (sticky) state.sticky = true;
2616
+ if (groups.length) state.groups = groups;
2547
2617
  }
2548
2618
 
2619
+ if (pattern !== rawPattern) try {
2620
+ // fails in old engines, but we have no alternatives for unsupported regex syntax
2621
+ createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
2622
+ } catch (error) { /* empty */ }
2623
+
2549
2624
  return result;
2550
2625
  };
2626
+
2551
2627
  var proxy = function (key) {
2552
2628
  key in RegExpWrapper || defineProperty$6(RegExpWrapper, key, {
2553
2629
  configurable: true,
@@ -2555,9 +2631,11 @@
2555
2631
  set: function (it) { NativeRegExp[key] = it; }
2556
2632
  });
2557
2633
  };
2558
- var keys$2 = getOwnPropertyNames$1(NativeRegExp);
2559
- var index = 0;
2560
- while (keys$2.length > index) proxy(keys$2[index++]);
2634
+
2635
+ for (var keys$2 = getOwnPropertyNames$1(NativeRegExp), index = 0; keys$2.length > index;) {
2636
+ proxy(keys$2[index++]);
2637
+ }
2638
+
2561
2639
  RegExpPrototype.constructor = RegExpWrapper;
2562
2640
  RegExpWrapper.prototype = RegExpPrototype;
2563
2641
  redefine(global_1, 'RegExp', RegExpWrapper);
@@ -2600,7 +2678,7 @@
2600
2678
  };
2601
2679
 
2602
2680
  // @@match logic
2603
- fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
2681
+ fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
2604
2682
  return [
2605
2683
  // `String.prototype.match` method
2606
2684
  // https://tc39.es/ecma262/#sec-string.prototype.match
@@ -2611,12 +2689,12 @@
2611
2689
  },
2612
2690
  // `RegExp.prototype[@@match]` method
2613
2691
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
2614
- function (regexp) {
2615
- var res = maybeCallNative(nativeMatch, regexp, this);
2692
+ function (string) {
2693
+ var res = maybeCallNative(nativeMatch, this, string);
2616
2694
  if (res.done) return res.value;
2617
2695
 
2618
- var rx = anObject(regexp);
2619
- var S = String(this);
2696
+ var rx = anObject(this);
2697
+ var S = String(string);
2620
2698
 
2621
2699
  if (!rx.global) return regexpExecAbstract(rx, S);
2622
2700
 
@@ -2676,6 +2754,7 @@
2676
2754
  });
2677
2755
  };
2678
2756
 
2757
+ var REPLACE = wellKnownSymbol('replace');
2679
2758
  var max$1 = Math.max;
2680
2759
  var min$4 = Math.min;
2681
2760
 
@@ -2683,10 +2762,33 @@
2683
2762
  return it === undefined ? it : String(it);
2684
2763
  };
2685
2764
 
2765
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
2766
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
2767
+ var REPLACE_KEEPS_$0 = (function () {
2768
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
2769
+ return 'a'.replace(/./, '$0') === '$0';
2770
+ })();
2771
+
2772
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
2773
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
2774
+ if (/./[REPLACE]) {
2775
+ return /./[REPLACE]('a', '$0') === '';
2776
+ }
2777
+ return false;
2778
+ })();
2779
+
2780
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
2781
+ var re = /./;
2782
+ re.exec = function () {
2783
+ var result = [];
2784
+ result.groups = { a: '7' };
2785
+ return result;
2786
+ };
2787
+ return ''.replace(re, '$<a>') !== '7';
2788
+ });
2789
+
2686
2790
  // @@replace logic
2687
- fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
2688
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
2689
- var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
2791
+ fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
2690
2792
  var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
2691
2793
 
2692
2794
  return [
@@ -2701,17 +2803,18 @@
2701
2803
  },
2702
2804
  // `RegExp.prototype[@@replace]` method
2703
2805
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
2704
- function (regexp, replaceValue) {
2806
+ function (string, replaceValue) {
2705
2807
  if (
2706
- (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
2707
- (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
2808
+ typeof replaceValue === 'string' &&
2809
+ replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 &&
2810
+ replaceValue.indexOf('$<') === -1
2708
2811
  ) {
2709
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
2812
+ var res = maybeCallNative(nativeReplace, this, string, replaceValue);
2710
2813
  if (res.done) return res.value;
2711
2814
  }
2712
2815
 
2713
- var rx = anObject(regexp);
2714
- var S = String(this);
2816
+ var rx = anObject(this);
2817
+ var S = String(string);
2715
2818
 
2716
2819
  var functionalReplace = typeof replaceValue === 'function';
2717
2820
  if (!functionalReplace) replaceValue = String(replaceValue);
@@ -2763,7 +2866,7 @@
2763
2866
  return accumulatedResult + S.slice(nextSourcePosition);
2764
2867
  }
2765
2868
  ];
2766
- });
2869
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
2767
2870
 
2768
2871
  var SPECIES$2 = wellKnownSymbol('species');
2769
2872
 
@@ -2780,8 +2883,19 @@
2780
2883
  var min$3 = Math.min;
2781
2884
  var MAX_UINT32 = 0xFFFFFFFF;
2782
2885
 
2886
+ // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
2887
+ // Weex JS has frozen built-in prototypes, so use try / catch wrapper
2888
+ var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
2889
+ // eslint-disable-next-line regexp/no-empty-group -- required for testing
2890
+ var re = /(?:)/;
2891
+ var originalExec = re.exec;
2892
+ re.exec = function () { return originalExec.apply(this, arguments); };
2893
+ var result = 'ab'.split(re);
2894
+ return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
2895
+ });
2896
+
2783
2897
  // @@split logic
2784
- fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
2898
+ fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
2785
2899
  var internalSplit;
2786
2900
  if (
2787
2901
  'abbc'.split(/(b)*/)[1] == 'c' ||
@@ -2850,12 +2964,12 @@
2850
2964
  //
2851
2965
  // NOTE: This cannot be properly polyfilled in engines that don't support
2852
2966
  // the 'y' flag.
2853
- function (regexp, limit) {
2854
- var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
2967
+ function (string, limit) {
2968
+ var res = maybeCallNative(internalSplit, this, string, limit, internalSplit !== nativeSplit);
2855
2969
  if (res.done) return res.value;
2856
2970
 
2857
- var rx = anObject(regexp);
2858
- var S = String(this);
2971
+ var rx = anObject(this);
2972
+ var S = String(string);
2859
2973
  var C = speciesConstructor(rx, RegExp);
2860
2974
 
2861
2975
  var unicodeMatching = rx.unicode;
@@ -2896,7 +3010,7 @@
2896
3010
  return A;
2897
3011
  }
2898
3012
  ];
2899
- }, UNSUPPORTED_Y);
3013
+ }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
2900
3014
 
2901
3015
  function ownKeys(object, enumerableOnly) {
2902
3016
  var keys = Object.keys(object);
@@ -12219,7 +12333,8 @@
12219
12333
  var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
12220
12334
 
12221
12335
  var FORCED$2 = isForced_1(PROMISE, function () {
12222
- var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
12336
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
12337
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
12223
12338
  // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
12224
12339
  // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
12225
12340
  // We can't detect it synchronously, so just check versions
@@ -12227,7 +12342,7 @@
12227
12342
  // We can't use @@species feature detection in V8 since it causes
12228
12343
  // deoptimization and performance degradation
12229
12344
  // https://github.com/zloirock/core-js/issues/679
12230
- if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;
12345
+ if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
12231
12346
  // Detect correctness of subclassing with @@species support
12232
12347
  var promise = new PromiseConstructor(function (resolve) { resolve(1); });
12233
12348
  var FakePromise = function (exec) {
@@ -15532,7 +15647,7 @@
15532
15647
 
15533
15648
  var setMetadata = function (it) {
15534
15649
  defineProperty(it, METADATA, { value: {
15535
- objectID: 'O' + ++id, // object ID
15650
+ objectID: 'O' + id++, // object ID
15536
15651
  weakData: {} // weak collections IDs
15537
15652
  } });
15538
15653
  };
@@ -27429,7 +27544,7 @@
27429
27544
  });
27430
27545
 
27431
27546
  var name = "mocha";
27432
- var version = "9.0.1";
27547
+ var version = "9.0.2";
27433
27548
  var homepage = "https://mochajs.org/";
27434
27549
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
27435
27550
  var _package = {