@noma.to/qwik-testing-library 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/lib/lib/mock.qwik.cjs +3 -3
- package/lib/lib/mock.qwik.mjs +1 -1
- package/lib/lib/qwik-testing-library.qwik.cjs +2 -2
- package/lib/lib/qwik-testing-library.qwik.mjs +3 -3
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +89 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +89 -0
- package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.cjs +321 -97
- package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.mjs +318 -94
- package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +312 -15
- package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +317 -20
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +2 -2
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +2 -2
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.cjs +161 -69
- package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.mjs +158 -66
- package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.cjs +976 -538
- package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.mjs +976 -538
- package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.cjs +20 -3
- package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.mjs +20 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs → @vitest_utils@3.0.5/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs} +7 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs → @vitest_utils@3.0.5/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs} +7 -3
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.cjs +491 -467
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.mjs +491 -467
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.cjs +6 -6
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.mjs +3 -3
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.5/node_modules/@vitest/utils/dist/index.qwik.cjs +474 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.5/node_modules/@vitest/utils/dist/index.qwik.mjs +474 -0
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.cjs +20 -20
- package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.mjs +20 -20
- package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.cjs +71 -39
- package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.mjs +71 -39
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.cjs +7 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.mjs +7 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.mjs +6 -6
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.cjs +1 -3
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.mjs +1 -3
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.cjs +1 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.mjs +1 -1
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.cjs +1 -2
- package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.mjs +1 -2
- package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.cjs +44 -33
- package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.mjs +44 -33
- package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.cjs} +2 -2
- package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.mjs} +2 -2
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +4 -0
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +5 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +66 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +66 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.cjs +2977 -0
- package/lib/node_modules/.pnpm/vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.mjs +2977 -0
- package/package.json +13 -13
- package/lib/_virtual/_commonjsHelpers.qwik.cjs +0 -4
- package/lib/_virtual/_commonjsHelpers.qwik.mjs +0 -4
- package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +0 -4
- package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +0 -4
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +0 -425
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +0 -425
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +0 -81
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +0 -81
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +0 -7
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +0 -8
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +0 -6
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +0 -6
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +0 -16
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +0 -16
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +0 -2556
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +0 -2556
- /package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -0
- /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -0
|
@@ -3,450 +3,8 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
-
const index = require("../../../../../@vitest_pretty-format@
|
|
7
|
-
const
|
|
8
|
-
function getDefaultExportFromCjs(x) {
|
|
9
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
10
|
-
}
|
|
11
|
-
var naturalCompare$2 = { exports: {} };
|
|
12
|
-
/*
|
|
13
|
-
* @version 1.4.0
|
|
14
|
-
* @date 2015-10-26
|
|
15
|
-
* @stability 3 - Stable
|
|
16
|
-
* @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
|
|
17
|
-
* @license MIT License
|
|
18
|
-
*/
|
|
19
|
-
var naturalCompare = function(a2, b) {
|
|
20
|
-
var i, codeA, codeB = 1, posA = 0, posB = 0, alphabet = String.alphabet;
|
|
21
|
-
function getCode(str, pos, code) {
|
|
22
|
-
if (code) {
|
|
23
|
-
for (i = pos; code = getCode(str, i), code < 76 && code > 65; ) ++i;
|
|
24
|
-
return +str.slice(pos - 1, i);
|
|
25
|
-
}
|
|
26
|
-
code = alphabet && alphabet.indexOf(str.charAt(pos));
|
|
27
|
-
return code > -1 ? code + 76 : (code = str.charCodeAt(pos) || 0, code < 45 || code > 127) ? code : code < 46 ? 65 : code < 48 ? code - 1 : code < 58 ? code + 18 : code < 65 ? code - 11 : code < 91 ? code + 11 : code < 97 ? code - 37 : code < 123 ? code + 5 : code - 63;
|
|
28
|
-
}
|
|
29
|
-
if ((a2 += "") != (b += "")) for (; codeB; ) {
|
|
30
|
-
codeA = getCode(a2, posA++);
|
|
31
|
-
codeB = getCode(b, posB++);
|
|
32
|
-
if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
|
|
33
|
-
codeA = getCode(a2, posA, posA);
|
|
34
|
-
codeB = getCode(b, posB, posA = i);
|
|
35
|
-
posB = i;
|
|
36
|
-
}
|
|
37
|
-
if (codeA != codeB) return codeA < codeB ? -1 : 1;
|
|
38
|
-
}
|
|
39
|
-
return 0;
|
|
40
|
-
};
|
|
41
|
-
try {
|
|
42
|
-
naturalCompare$2.exports = naturalCompare;
|
|
43
|
-
} catch (e) {
|
|
44
|
-
String.naturalCompare = naturalCompare;
|
|
45
|
-
}
|
|
46
|
-
var naturalCompareExports = naturalCompare$2.exports;
|
|
47
|
-
var naturalCompare$1 = /* @__PURE__ */ getDefaultExportFromCjs(naturalCompareExports);
|
|
48
|
-
function notNullish(v) {
|
|
49
|
-
return v != null;
|
|
50
|
-
}
|
|
51
|
-
function isPrimitive(value) {
|
|
52
|
-
return value === null || typeof value !== "function" && typeof value !== "object";
|
|
53
|
-
}
|
|
54
|
-
function isObject(item) {
|
|
55
|
-
return item != null && typeof item === "object" && !Array.isArray(item);
|
|
56
|
-
}
|
|
57
|
-
function getCallLastIndex(code) {
|
|
58
|
-
let charIndex = -1;
|
|
59
|
-
let inString = null;
|
|
60
|
-
let startedBracers = 0;
|
|
61
|
-
let endedBracers = 0;
|
|
62
|
-
let beforeChar = null;
|
|
63
|
-
while (charIndex <= code.length) {
|
|
64
|
-
beforeChar = code[charIndex];
|
|
65
|
-
charIndex++;
|
|
66
|
-
const char = code[charIndex];
|
|
67
|
-
const isCharString = char === '"' || char === "'" || char === "`";
|
|
68
|
-
if (isCharString && beforeChar !== "\\") {
|
|
69
|
-
if (inString === char) {
|
|
70
|
-
inString = null;
|
|
71
|
-
} else if (!inString) {
|
|
72
|
-
inString = char;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (!inString) {
|
|
76
|
-
if (char === "(") {
|
|
77
|
-
startedBracers++;
|
|
78
|
-
}
|
|
79
|
-
if (char === ")") {
|
|
80
|
-
endedBracers++;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (startedBracers && endedBracers && startedBracers === endedBracers) {
|
|
84
|
-
return charIndex;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
let getPromiseValue = () => "Promise{…}";
|
|
90
|
-
try {
|
|
91
|
-
const { getPromiseDetails, kPending, kRejected } = process.binding("util");
|
|
92
|
-
if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
|
93
|
-
getPromiseValue = (value, options) => {
|
|
94
|
-
const [state, innerValue] = getPromiseDetails(value);
|
|
95
|
-
if (state === kPending) {
|
|
96
|
-
return "Promise{<pending>}";
|
|
97
|
-
}
|
|
98
|
-
return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
} catch (notNode) {
|
|
102
|
-
}
|
|
103
|
-
let nodeInspect = false;
|
|
104
|
-
try {
|
|
105
|
-
const nodeUtil = require("util");
|
|
106
|
-
nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
|
|
107
|
-
} catch (noNodeInspect) {
|
|
108
|
-
nodeInspect = false;
|
|
109
|
-
}
|
|
110
|
-
const lineSplitRE = /\r?\n/;
|
|
111
|
-
function positionToOffset(source, lineNumber, columnNumber) {
|
|
112
|
-
const lines = source.split(lineSplitRE);
|
|
113
|
-
const nl = /\r\n/.test(source) ? 2 : 1;
|
|
114
|
-
let start = 0;
|
|
115
|
-
if (lineNumber > lines.length) {
|
|
116
|
-
return source.length;
|
|
117
|
-
}
|
|
118
|
-
for (let i = 0; i < lineNumber - 1; i++) {
|
|
119
|
-
start += lines[i].length + nl;
|
|
120
|
-
}
|
|
121
|
-
return start + columnNumber;
|
|
122
|
-
}
|
|
123
|
-
function offsetToLineNumber(source, offset) {
|
|
124
|
-
if (offset > source.length) {
|
|
125
|
-
throw new Error(
|
|
126
|
-
`offset is longer than source length! offset ${offset} > length ${source.length}`
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
const lines = source.split(lineSplitRE);
|
|
130
|
-
const nl = /\r\n/.test(source) ? 2 : 1;
|
|
131
|
-
let counted = 0;
|
|
132
|
-
let line = 0;
|
|
133
|
-
for (; line < lines.length; line++) {
|
|
134
|
-
const lineLength = lines[line].length + nl;
|
|
135
|
-
if (counted + lineLength >= offset) {
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
counted += lineLength;
|
|
139
|
-
}
|
|
140
|
-
return line + 1;
|
|
141
|
-
}
|
|
142
|
-
var LineTerminatorSequence;
|
|
143
|
-
LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
|
|
144
|
-
RegExp(LineTerminatorSequence.source);
|
|
145
|
-
var reservedWords = {
|
|
146
|
-
keyword: [
|
|
147
|
-
"break",
|
|
148
|
-
"case",
|
|
149
|
-
"catch",
|
|
150
|
-
"continue",
|
|
151
|
-
"debugger",
|
|
152
|
-
"default",
|
|
153
|
-
"do",
|
|
154
|
-
"else",
|
|
155
|
-
"finally",
|
|
156
|
-
"for",
|
|
157
|
-
"function",
|
|
158
|
-
"if",
|
|
159
|
-
"return",
|
|
160
|
-
"switch",
|
|
161
|
-
"throw",
|
|
162
|
-
"try",
|
|
163
|
-
"var",
|
|
164
|
-
"const",
|
|
165
|
-
"while",
|
|
166
|
-
"with",
|
|
167
|
-
"new",
|
|
168
|
-
"this",
|
|
169
|
-
"super",
|
|
170
|
-
"class",
|
|
171
|
-
"extends",
|
|
172
|
-
"export",
|
|
173
|
-
"import",
|
|
174
|
-
"null",
|
|
175
|
-
"true",
|
|
176
|
-
"false",
|
|
177
|
-
"in",
|
|
178
|
-
"instanceof",
|
|
179
|
-
"typeof",
|
|
180
|
-
"void",
|
|
181
|
-
"delete"
|
|
182
|
-
],
|
|
183
|
-
strict: [
|
|
184
|
-
"implements",
|
|
185
|
-
"interface",
|
|
186
|
-
"let",
|
|
187
|
-
"package",
|
|
188
|
-
"private",
|
|
189
|
-
"protected",
|
|
190
|
-
"public",
|
|
191
|
-
"static",
|
|
192
|
-
"yield"
|
|
193
|
-
]
|
|
194
|
-
};
|
|
195
|
-
new Set(reservedWords.keyword);
|
|
196
|
-
new Set(reservedWords.strict);
|
|
197
|
-
var f = {
|
|
198
|
-
reset: [0, 0],
|
|
199
|
-
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
200
|
-
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
201
|
-
italic: [3, 23],
|
|
202
|
-
underline: [4, 24],
|
|
203
|
-
inverse: [7, 27],
|
|
204
|
-
hidden: [8, 28],
|
|
205
|
-
strikethrough: [9, 29],
|
|
206
|
-
black: [30, 39],
|
|
207
|
-
red: [31, 39],
|
|
208
|
-
green: [32, 39],
|
|
209
|
-
yellow: [33, 39],
|
|
210
|
-
blue: [34, 39],
|
|
211
|
-
magenta: [35, 39],
|
|
212
|
-
cyan: [36, 39],
|
|
213
|
-
white: [37, 39],
|
|
214
|
-
gray: [90, 39],
|
|
215
|
-
bgBlack: [40, 49],
|
|
216
|
-
bgRed: [41, 49],
|
|
217
|
-
bgGreen: [42, 49],
|
|
218
|
-
bgYellow: [43, 49],
|
|
219
|
-
bgBlue: [44, 49],
|
|
220
|
-
bgMagenta: [45, 49],
|
|
221
|
-
bgCyan: [46, 49],
|
|
222
|
-
bgWhite: [47, 49],
|
|
223
|
-
blackBright: [90, 39],
|
|
224
|
-
redBright: [91, 39],
|
|
225
|
-
greenBright: [92, 39],
|
|
226
|
-
yellowBright: [93, 39],
|
|
227
|
-
blueBright: [94, 39],
|
|
228
|
-
magentaBright: [95, 39],
|
|
229
|
-
cyanBright: [96, 39],
|
|
230
|
-
whiteBright: [97, 39],
|
|
231
|
-
bgBlackBright: [100, 49],
|
|
232
|
-
bgRedBright: [101, 49],
|
|
233
|
-
bgGreenBright: [102, 49],
|
|
234
|
-
bgYellowBright: [103, 49],
|
|
235
|
-
bgBlueBright: [104, 49],
|
|
236
|
-
bgMagentaBright: [105, 49],
|
|
237
|
-
bgCyanBright: [106, 49],
|
|
238
|
-
bgWhiteBright: [107, 49]
|
|
239
|
-
}, h = Object.entries(f);
|
|
240
|
-
function a(n) {
|
|
241
|
-
return String(n);
|
|
242
|
-
}
|
|
243
|
-
a.open = "";
|
|
244
|
-
a.close = "";
|
|
245
|
-
function C(n = false) {
|
|
246
|
-
let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
|
|
247
|
-
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
|
|
248
|
-
}
|
|
249
|
-
function p(n = false) {
|
|
250
|
-
let e = C(n), i = (r, t, c, o) => {
|
|
251
|
-
let l = "", s = 0;
|
|
252
|
-
do
|
|
253
|
-
l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
|
|
254
|
-
while (~o);
|
|
255
|
-
return l + r.substring(s);
|
|
256
|
-
}, g = (r, t, c = r) => {
|
|
257
|
-
let o = (l) => {
|
|
258
|
-
let s = String(l), b = s.indexOf(t, r.length);
|
|
259
|
-
return ~b ? r + i(s, t, c, b) + t : r + s + t;
|
|
260
|
-
};
|
|
261
|
-
return o.open = r, o.close = t, o;
|
|
262
|
-
}, u = {
|
|
263
|
-
isColorSupported: e
|
|
264
|
-
}, d = (r) => `\x1B[${r}m`;
|
|
265
|
-
for (let [r, t] of h)
|
|
266
|
-
u[r] = e ? g(
|
|
267
|
-
d(t[0]),
|
|
268
|
-
d(t[1]),
|
|
269
|
-
t[2]
|
|
270
|
-
) : a;
|
|
271
|
-
return u;
|
|
272
|
-
}
|
|
273
|
-
p(false);
|
|
274
|
-
const serialize$1 = (val, config, indentation, depth, refs, printer) => {
|
|
275
|
-
const name = val.getMockName();
|
|
276
|
-
const nameString = name === "vi.fn()" ? "" : ` ${name}`;
|
|
277
|
-
let callsString = "";
|
|
278
|
-
if (val.mock.calls.length !== 0) {
|
|
279
|
-
const indentationNext = indentation + config.indent;
|
|
280
|
-
callsString = ` {${config.spacingOuter}${indentationNext}"calls": ${printer(
|
|
281
|
-
val.mock.calls,
|
|
282
|
-
config,
|
|
283
|
-
indentationNext,
|
|
284
|
-
depth,
|
|
285
|
-
refs
|
|
286
|
-
)}${config.min ? ", " : ","}${config.spacingOuter}${indentationNext}"results": ${printer(
|
|
287
|
-
val.mock.results,
|
|
288
|
-
config,
|
|
289
|
-
indentationNext,
|
|
290
|
-
depth,
|
|
291
|
-
refs
|
|
292
|
-
)}${config.min ? "" : ","}${config.spacingOuter}${indentation}}`;
|
|
293
|
-
}
|
|
294
|
-
return `[MockFunction${nameString}]${callsString}`;
|
|
295
|
-
};
|
|
296
|
-
const test = (val) => val && !!val._isMockFunction;
|
|
297
|
-
const plugin = { serialize: serialize$1, test };
|
|
298
|
-
const {
|
|
299
|
-
DOMCollection,
|
|
300
|
-
DOMElement,
|
|
301
|
-
Immutable,
|
|
302
|
-
ReactElement,
|
|
303
|
-
ReactTestComponent,
|
|
304
|
-
AsymmetricMatcher
|
|
305
|
-
} = index.plugins;
|
|
306
|
-
let PLUGINS = [
|
|
307
|
-
ReactTestComponent,
|
|
308
|
-
ReactElement,
|
|
309
|
-
DOMElement,
|
|
310
|
-
DOMCollection,
|
|
311
|
-
Immutable,
|
|
312
|
-
AsymmetricMatcher,
|
|
313
|
-
plugin
|
|
314
|
-
];
|
|
315
|
-
function addSerializer(plugin2) {
|
|
316
|
-
PLUGINS = [plugin2].concat(PLUGINS);
|
|
317
|
-
}
|
|
318
|
-
function getSerializers() {
|
|
319
|
-
return PLUGINS;
|
|
320
|
-
}
|
|
321
|
-
function testNameToKey(testName, count) {
|
|
322
|
-
return `${testName} ${count}`;
|
|
323
|
-
}
|
|
324
|
-
function keyToTestName(key) {
|
|
325
|
-
if (!/ \d+$/.test(key)) {
|
|
326
|
-
throw new Error("Snapshot keys must end with a number.");
|
|
327
|
-
}
|
|
328
|
-
return key.replace(/ \d+$/, "");
|
|
329
|
-
}
|
|
330
|
-
function getSnapshotData(content, options) {
|
|
331
|
-
const update = options.updateSnapshot;
|
|
332
|
-
const data = /* @__PURE__ */ Object.create(null);
|
|
333
|
-
let snapshotContents = "";
|
|
334
|
-
let dirty = false;
|
|
335
|
-
if (content != null) {
|
|
336
|
-
try {
|
|
337
|
-
snapshotContents = content;
|
|
338
|
-
const populate = new Function("exports", snapshotContents);
|
|
339
|
-
populate(data);
|
|
340
|
-
} catch {
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
const isInvalid = snapshotContents;
|
|
344
|
-
if ((update === "all" || update === "new") && isInvalid) {
|
|
345
|
-
dirty = true;
|
|
346
|
-
}
|
|
347
|
-
return { data, dirty };
|
|
348
|
-
}
|
|
349
|
-
function addExtraLineBreaks(string) {
|
|
350
|
-
return string.includes("\n") ? `
|
|
351
|
-
${string}
|
|
352
|
-
` : string;
|
|
353
|
-
}
|
|
354
|
-
function removeExtraLineBreaks(string) {
|
|
355
|
-
return string.length > 2 && string.startsWith("\n") && string.endsWith("\n") ? string.slice(1, -1) : string;
|
|
356
|
-
}
|
|
357
|
-
const escapeRegex = true;
|
|
358
|
-
const printFunctionName = false;
|
|
359
|
-
function serialize(val, indent = 2, formatOverrides = {}) {
|
|
360
|
-
return normalizeNewlines(
|
|
361
|
-
index.format(val, {
|
|
362
|
-
escapeRegex,
|
|
363
|
-
indent,
|
|
364
|
-
plugins: getSerializers(),
|
|
365
|
-
printFunctionName,
|
|
366
|
-
...formatOverrides
|
|
367
|
-
})
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
function escapeBacktickString(str) {
|
|
371
|
-
return str.replace(/`|\\|\$\{/g, "\\$&");
|
|
372
|
-
}
|
|
373
|
-
function printBacktickString(str) {
|
|
374
|
-
return `\`${escapeBacktickString(str)}\``;
|
|
375
|
-
}
|
|
376
|
-
function normalizeNewlines(string) {
|
|
377
|
-
return string.replace(/\r\n|\r/g, "\n");
|
|
378
|
-
}
|
|
379
|
-
async function saveSnapshotFile(environment, snapshotData, snapshotPath) {
|
|
380
|
-
const snapshots = Object.keys(snapshotData).sort(naturalCompare$1).map(
|
|
381
|
-
(key) => `exports[${printBacktickString(key)}] = ${printBacktickString(
|
|
382
|
-
normalizeNewlines(snapshotData[key])
|
|
383
|
-
)};`
|
|
384
|
-
);
|
|
385
|
-
const content = `${environment.getHeader()}
|
|
386
|
-
|
|
387
|
-
${snapshots.join("\n\n")}
|
|
388
|
-
`;
|
|
389
|
-
const oldContent = await environment.readSnapshotFile(snapshotPath);
|
|
390
|
-
const skipWriting = oldContent != null && oldContent === content;
|
|
391
|
-
if (skipWriting) {
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
await environment.saveSnapshotFile(snapshotPath, content);
|
|
395
|
-
}
|
|
396
|
-
function prepareExpected(expected) {
|
|
397
|
-
function findStartIndent() {
|
|
398
|
-
var _a, _b;
|
|
399
|
-
const matchObject = /^( +)\}\s+$/m.exec(expected || "");
|
|
400
|
-
const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length;
|
|
401
|
-
if (objectIndent) {
|
|
402
|
-
return objectIndent;
|
|
403
|
-
}
|
|
404
|
-
const matchText = /^\n( +)"/.exec(expected || "");
|
|
405
|
-
return ((_b = matchText == null ? void 0 : matchText[1]) == null ? void 0 : _b.length) || 0;
|
|
406
|
-
}
|
|
407
|
-
const startIndent = findStartIndent();
|
|
408
|
-
let expectedTrimmed = expected == null ? void 0 : expected.trim();
|
|
409
|
-
if (startIndent) {
|
|
410
|
-
expectedTrimmed = expectedTrimmed == null ? void 0 : expectedTrimmed.replace(new RegExp(`^${" ".repeat(startIndent)}`, "gm"), "").replace(/ +\}$/, "}");
|
|
411
|
-
}
|
|
412
|
-
return expectedTrimmed;
|
|
413
|
-
}
|
|
414
|
-
function deepMergeArray(target = [], source = []) {
|
|
415
|
-
const mergedOutput = Array.from(target);
|
|
416
|
-
source.forEach((sourceElement, index2) => {
|
|
417
|
-
const targetElement = mergedOutput[index2];
|
|
418
|
-
if (Array.isArray(target[index2])) {
|
|
419
|
-
mergedOutput[index2] = deepMergeArray(target[index2], sourceElement);
|
|
420
|
-
} else if (isObject(targetElement)) {
|
|
421
|
-
mergedOutput[index2] = deepMergeSnapshot(target[index2], sourceElement);
|
|
422
|
-
} else {
|
|
423
|
-
mergedOutput[index2] = sourceElement;
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
return mergedOutput;
|
|
427
|
-
}
|
|
428
|
-
function deepMergeSnapshot(target, source) {
|
|
429
|
-
if (isObject(target) && isObject(source)) {
|
|
430
|
-
const mergedOutput = { ...target };
|
|
431
|
-
Object.keys(source).forEach((key) => {
|
|
432
|
-
if (isObject(source[key]) && !source[key].$$typeof) {
|
|
433
|
-
if (!(key in target)) {
|
|
434
|
-
Object.assign(mergedOutput, { [key]: source[key] });
|
|
435
|
-
} else {
|
|
436
|
-
mergedOutput[key] = deepMergeSnapshot(target[key], source[key]);
|
|
437
|
-
}
|
|
438
|
-
} else if (Array.isArray(source[key])) {
|
|
439
|
-
mergedOutput[key] = deepMergeArray(target[key], source[key]);
|
|
440
|
-
} else {
|
|
441
|
-
Object.assign(mergedOutput, { [key]: source[key] });
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
return mergedOutput;
|
|
445
|
-
} else if (Array.isArray(target) && Array.isArray(source)) {
|
|
446
|
-
return deepMergeArray(target, source);
|
|
447
|
-
}
|
|
448
|
-
return target;
|
|
449
|
-
}
|
|
6
|
+
const index = require("../../../../../@vitest_pretty-format@3.0.5/node_modules/@vitest/pretty-format/dist/index.qwik.cjs");
|
|
7
|
+
const pathe_UZHd4nF = require("../../../../../pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.cjs");
|
|
450
8
|
const comma = ",".charCodeAt(0);
|
|
451
9
|
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
452
10
|
const intToChar = new Uint8Array(64);
|
|
@@ -680,15 +238,19 @@ function resolve$1(input, base) {
|
|
|
680
238
|
switch (inputType) {
|
|
681
239
|
case UrlType.Empty:
|
|
682
240
|
url.hash = baseUrl.hash;
|
|
241
|
+
// fall through
|
|
683
242
|
case UrlType.Hash:
|
|
684
243
|
url.query = baseUrl.query;
|
|
244
|
+
// fall through
|
|
685
245
|
case UrlType.Query:
|
|
686
246
|
case UrlType.RelativePath:
|
|
687
247
|
mergePaths(url, baseUrl);
|
|
248
|
+
// fall through
|
|
688
249
|
case UrlType.AbsolutePath:
|
|
689
250
|
url.user = baseUrl.user;
|
|
690
251
|
url.host = baseUrl.host;
|
|
691
252
|
url.port = baseUrl.port;
|
|
253
|
+
// fall through
|
|
692
254
|
case UrlType.SchemeRelative:
|
|
693
255
|
url.scheme = baseUrl.scheme;
|
|
694
256
|
}
|
|
@@ -698,6 +260,8 @@ function resolve$1(input, base) {
|
|
|
698
260
|
normalizePath(url, inputType);
|
|
699
261
|
const queryHash = url.query + url.hash;
|
|
700
262
|
switch (inputType) {
|
|
263
|
+
// This is impossible, because of the empty checks at the start of the function.
|
|
264
|
+
// case UrlType.Empty:
|
|
701
265
|
case UrlType.Hash:
|
|
702
266
|
case UrlType.Query:
|
|
703
267
|
return queryHash;
|
|
@@ -897,6 +461,47 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
897
461
|
return -1;
|
|
898
462
|
return index2;
|
|
899
463
|
}
|
|
464
|
+
function notNullish(v) {
|
|
465
|
+
return v != null;
|
|
466
|
+
}
|
|
467
|
+
function isPrimitive(value) {
|
|
468
|
+
return value === null || typeof value !== "function" && typeof value !== "object";
|
|
469
|
+
}
|
|
470
|
+
function isObject(item) {
|
|
471
|
+
return item != null && typeof item === "object" && !Array.isArray(item);
|
|
472
|
+
}
|
|
473
|
+
function getCallLastIndex(code) {
|
|
474
|
+
let charIndex = -1;
|
|
475
|
+
let inString = null;
|
|
476
|
+
let startedBracers = 0;
|
|
477
|
+
let endedBracers = 0;
|
|
478
|
+
let beforeChar = null;
|
|
479
|
+
while (charIndex <= code.length) {
|
|
480
|
+
beforeChar = code[charIndex];
|
|
481
|
+
charIndex++;
|
|
482
|
+
const char = code[charIndex];
|
|
483
|
+
const isCharString = char === '"' || char === "'" || char === "`";
|
|
484
|
+
if (isCharString && beforeChar !== "\\") {
|
|
485
|
+
if (inString === char) {
|
|
486
|
+
inString = null;
|
|
487
|
+
} else if (!inString) {
|
|
488
|
+
inString = char;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (!inString) {
|
|
492
|
+
if (char === "(") {
|
|
493
|
+
startedBracers++;
|
|
494
|
+
}
|
|
495
|
+
if (char === ")") {
|
|
496
|
+
endedBracers++;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
if (startedBracers && endedBracers && startedBracers === endedBracers) {
|
|
500
|
+
return charIndex;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
900
505
|
const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
|
|
901
506
|
const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
|
|
902
507
|
const stackIgnorePatterns = [
|
|
@@ -998,7 +603,7 @@ function parseSingleV8Stack(raw) {
|
|
|
998
603
|
if (file.startsWith("file://")) {
|
|
999
604
|
file = file.slice(7);
|
|
1000
605
|
}
|
|
1001
|
-
file =
|
|
606
|
+
file = file.startsWith("node:") || file.startsWith("internal:") ? file : pathe_UZHd4nF.r(file);
|
|
1002
607
|
if (method) {
|
|
1003
608
|
method = method.replace(/__vite_ssr_import_\d+__\./g, "");
|
|
1004
609
|
}
|
|
@@ -1040,25 +645,604 @@ function parseFFOrSafariStackTrace(stack) {
|
|
|
1040
645
|
function parseV8Stacktrace(stack) {
|
|
1041
646
|
return stack.split("\n").map((line) => parseSingleV8Stack(line)).filter(notNullish);
|
|
1042
647
|
}
|
|
1043
|
-
function parseErrorStacktrace(e, options = {}) {
|
|
1044
|
-
if (!e || isPrimitive(e)) {
|
|
1045
|
-
return [];
|
|
648
|
+
function parseErrorStacktrace(e, options = {}) {
|
|
649
|
+
if (!e || isPrimitive(e)) {
|
|
650
|
+
return [];
|
|
651
|
+
}
|
|
652
|
+
if (e.stacks) {
|
|
653
|
+
return e.stacks;
|
|
654
|
+
}
|
|
655
|
+
const stackStr = e.stack || e.stackStr || "";
|
|
656
|
+
let stackFrames = parseStacktrace(stackStr, options);
|
|
657
|
+
if (options.frameFilter) {
|
|
658
|
+
stackFrames = stackFrames.filter(
|
|
659
|
+
(f2) => options.frameFilter(e, f2) !== false
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
e.stacks = stackFrames;
|
|
663
|
+
return stackFrames;
|
|
664
|
+
}
|
|
665
|
+
let getPromiseValue = () => "Promise{…}";
|
|
666
|
+
try {
|
|
667
|
+
const { getPromiseDetails, kPending, kRejected } = process.binding("util");
|
|
668
|
+
if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
|
669
|
+
getPromiseValue = (value, options) => {
|
|
670
|
+
const [state, innerValue] = getPromiseDetails(value);
|
|
671
|
+
if (state === kPending) {
|
|
672
|
+
return "Promise{<pending>}";
|
|
673
|
+
}
|
|
674
|
+
return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`;
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
} catch (notNode) {
|
|
678
|
+
}
|
|
679
|
+
let nodeInspect = false;
|
|
680
|
+
try {
|
|
681
|
+
const nodeUtil = require("util");
|
|
682
|
+
nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
|
|
683
|
+
} catch (noNodeInspect) {
|
|
684
|
+
nodeInspect = false;
|
|
685
|
+
}
|
|
686
|
+
function getDefaultExportFromCjs(x) {
|
|
687
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
688
|
+
}
|
|
689
|
+
var jsTokens_1;
|
|
690
|
+
var hasRequiredJsTokens;
|
|
691
|
+
function requireJsTokens() {
|
|
692
|
+
if (hasRequiredJsTokens) return jsTokens_1;
|
|
693
|
+
hasRequiredJsTokens = 1;
|
|
694
|
+
var Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
|
|
695
|
+
RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\\]).|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;
|
|
696
|
+
Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
|
|
697
|
+
Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;
|
|
698
|
+
StringLiteral = /(['"])(?:(?!\1)[^\\\n\r]|\\(?:\r\n|[^]))*(\1)?/y;
|
|
699
|
+
NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
|
|
700
|
+
Template = /[`}](?:[^`\\$]|\\[^]|\$(?!\{))*(`|\$\{)?/y;
|
|
701
|
+
WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/yu;
|
|
702
|
+
LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
|
|
703
|
+
MultiLineComment = /\/\*(?:[^*]|\*(?!\/))*(\*\/)?/y;
|
|
704
|
+
SingleLineComment = /\/\/.*/y;
|
|
705
|
+
JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
|
|
706
|
+
JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;
|
|
707
|
+
JSXString = /(['"])(?:(?!\1)[^])*(\1)?/y;
|
|
708
|
+
JSXText = /[^<>{}]+/y;
|
|
709
|
+
TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
|
|
710
|
+
TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
|
|
711
|
+
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
712
|
+
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
713
|
+
Newline = RegExp(LineTerminatorSequence.source);
|
|
714
|
+
jsTokens_1 = function* (input, { jsx = false } = {}) {
|
|
715
|
+
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
716
|
+
({ length } = input);
|
|
717
|
+
lastIndex = 0;
|
|
718
|
+
lastSignificantToken = "";
|
|
719
|
+
stack = [
|
|
720
|
+
{ tag: "JS" }
|
|
721
|
+
];
|
|
722
|
+
braces = [];
|
|
723
|
+
parenNesting = 0;
|
|
724
|
+
postfixIncDec = false;
|
|
725
|
+
while (lastIndex < length) {
|
|
726
|
+
mode = stack[stack.length - 1];
|
|
727
|
+
switch (mode.tag) {
|
|
728
|
+
case "JS":
|
|
729
|
+
case "JSNonExpressionParen":
|
|
730
|
+
case "InterpolationInTemplate":
|
|
731
|
+
case "InterpolationInJSX":
|
|
732
|
+
if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
733
|
+
RegularExpressionLiteral.lastIndex = lastIndex;
|
|
734
|
+
if (match = RegularExpressionLiteral.exec(input)) {
|
|
735
|
+
lastIndex = RegularExpressionLiteral.lastIndex;
|
|
736
|
+
lastSignificantToken = match[0];
|
|
737
|
+
postfixIncDec = true;
|
|
738
|
+
yield {
|
|
739
|
+
type: "RegularExpressionLiteral",
|
|
740
|
+
value: match[0],
|
|
741
|
+
closed: match[1] !== void 0 && match[1] !== "\\"
|
|
742
|
+
};
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
Punctuator.lastIndex = lastIndex;
|
|
747
|
+
if (match = Punctuator.exec(input)) {
|
|
748
|
+
punctuator = match[0];
|
|
749
|
+
nextLastIndex = Punctuator.lastIndex;
|
|
750
|
+
nextLastSignificantToken = punctuator;
|
|
751
|
+
switch (punctuator) {
|
|
752
|
+
case "(":
|
|
753
|
+
if (lastSignificantToken === "?NonExpressionParenKeyword") {
|
|
754
|
+
stack.push({
|
|
755
|
+
tag: "JSNonExpressionParen",
|
|
756
|
+
nesting: parenNesting
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
parenNesting++;
|
|
760
|
+
postfixIncDec = false;
|
|
761
|
+
break;
|
|
762
|
+
case ")":
|
|
763
|
+
parenNesting--;
|
|
764
|
+
postfixIncDec = true;
|
|
765
|
+
if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
|
|
766
|
+
stack.pop();
|
|
767
|
+
nextLastSignificantToken = "?NonExpressionParenEnd";
|
|
768
|
+
postfixIncDec = false;
|
|
769
|
+
}
|
|
770
|
+
break;
|
|
771
|
+
case "{":
|
|
772
|
+
Punctuator.lastIndex = 0;
|
|
773
|
+
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
774
|
+
braces.push(isExpression);
|
|
775
|
+
postfixIncDec = false;
|
|
776
|
+
break;
|
|
777
|
+
case "}":
|
|
778
|
+
switch (mode.tag) {
|
|
779
|
+
case "InterpolationInTemplate":
|
|
780
|
+
if (braces.length === mode.nesting) {
|
|
781
|
+
Template.lastIndex = lastIndex;
|
|
782
|
+
match = Template.exec(input);
|
|
783
|
+
lastIndex = Template.lastIndex;
|
|
784
|
+
lastSignificantToken = match[0];
|
|
785
|
+
if (match[1] === "${") {
|
|
786
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
787
|
+
postfixIncDec = false;
|
|
788
|
+
yield {
|
|
789
|
+
type: "TemplateMiddle",
|
|
790
|
+
value: match[0]
|
|
791
|
+
};
|
|
792
|
+
} else {
|
|
793
|
+
stack.pop();
|
|
794
|
+
postfixIncDec = true;
|
|
795
|
+
yield {
|
|
796
|
+
type: "TemplateTail",
|
|
797
|
+
value: match[0],
|
|
798
|
+
closed: match[1] === "`"
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
break;
|
|
804
|
+
case "InterpolationInJSX":
|
|
805
|
+
if (braces.length === mode.nesting) {
|
|
806
|
+
stack.pop();
|
|
807
|
+
lastIndex += 1;
|
|
808
|
+
lastSignificantToken = "}";
|
|
809
|
+
yield {
|
|
810
|
+
type: "JSXPunctuator",
|
|
811
|
+
value: "}"
|
|
812
|
+
};
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
postfixIncDec = braces.pop();
|
|
817
|
+
nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
|
|
818
|
+
break;
|
|
819
|
+
case "]":
|
|
820
|
+
postfixIncDec = true;
|
|
821
|
+
break;
|
|
822
|
+
case "++":
|
|
823
|
+
case "--":
|
|
824
|
+
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
825
|
+
break;
|
|
826
|
+
case "<":
|
|
827
|
+
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
828
|
+
stack.push({ tag: "JSXTag" });
|
|
829
|
+
lastIndex += 1;
|
|
830
|
+
lastSignificantToken = "<";
|
|
831
|
+
yield {
|
|
832
|
+
type: "JSXPunctuator",
|
|
833
|
+
value: punctuator
|
|
834
|
+
};
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
postfixIncDec = false;
|
|
838
|
+
break;
|
|
839
|
+
default:
|
|
840
|
+
postfixIncDec = false;
|
|
841
|
+
}
|
|
842
|
+
lastIndex = nextLastIndex;
|
|
843
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
844
|
+
yield {
|
|
845
|
+
type: "Punctuator",
|
|
846
|
+
value: punctuator
|
|
847
|
+
};
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
Identifier.lastIndex = lastIndex;
|
|
851
|
+
if (match = Identifier.exec(input)) {
|
|
852
|
+
lastIndex = Identifier.lastIndex;
|
|
853
|
+
nextLastSignificantToken = match[0];
|
|
854
|
+
switch (match[0]) {
|
|
855
|
+
case "for":
|
|
856
|
+
case "if":
|
|
857
|
+
case "while":
|
|
858
|
+
case "with":
|
|
859
|
+
if (lastSignificantToken !== "." && lastSignificantToken !== "?.") {
|
|
860
|
+
nextLastSignificantToken = "?NonExpressionParenKeyword";
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
864
|
+
postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
|
|
865
|
+
yield {
|
|
866
|
+
type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
|
|
867
|
+
value: match[0]
|
|
868
|
+
};
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
StringLiteral.lastIndex = lastIndex;
|
|
872
|
+
if (match = StringLiteral.exec(input)) {
|
|
873
|
+
lastIndex = StringLiteral.lastIndex;
|
|
874
|
+
lastSignificantToken = match[0];
|
|
875
|
+
postfixIncDec = true;
|
|
876
|
+
yield {
|
|
877
|
+
type: "StringLiteral",
|
|
878
|
+
value: match[0],
|
|
879
|
+
closed: match[2] !== void 0
|
|
880
|
+
};
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
NumericLiteral.lastIndex = lastIndex;
|
|
884
|
+
if (match = NumericLiteral.exec(input)) {
|
|
885
|
+
lastIndex = NumericLiteral.lastIndex;
|
|
886
|
+
lastSignificantToken = match[0];
|
|
887
|
+
postfixIncDec = true;
|
|
888
|
+
yield {
|
|
889
|
+
type: "NumericLiteral",
|
|
890
|
+
value: match[0]
|
|
891
|
+
};
|
|
892
|
+
continue;
|
|
893
|
+
}
|
|
894
|
+
Template.lastIndex = lastIndex;
|
|
895
|
+
if (match = Template.exec(input)) {
|
|
896
|
+
lastIndex = Template.lastIndex;
|
|
897
|
+
lastSignificantToken = match[0];
|
|
898
|
+
if (match[1] === "${") {
|
|
899
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
900
|
+
stack.push({
|
|
901
|
+
tag: "InterpolationInTemplate",
|
|
902
|
+
nesting: braces.length
|
|
903
|
+
});
|
|
904
|
+
postfixIncDec = false;
|
|
905
|
+
yield {
|
|
906
|
+
type: "TemplateHead",
|
|
907
|
+
value: match[0]
|
|
908
|
+
};
|
|
909
|
+
} else {
|
|
910
|
+
postfixIncDec = true;
|
|
911
|
+
yield {
|
|
912
|
+
type: "NoSubstitutionTemplate",
|
|
913
|
+
value: match[0],
|
|
914
|
+
closed: match[1] === "`"
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
continue;
|
|
918
|
+
}
|
|
919
|
+
break;
|
|
920
|
+
case "JSXTag":
|
|
921
|
+
case "JSXTagEnd":
|
|
922
|
+
JSXPunctuator.lastIndex = lastIndex;
|
|
923
|
+
if (match = JSXPunctuator.exec(input)) {
|
|
924
|
+
lastIndex = JSXPunctuator.lastIndex;
|
|
925
|
+
nextLastSignificantToken = match[0];
|
|
926
|
+
switch (match[0]) {
|
|
927
|
+
case "<":
|
|
928
|
+
stack.push({ tag: "JSXTag" });
|
|
929
|
+
break;
|
|
930
|
+
case ">":
|
|
931
|
+
stack.pop();
|
|
932
|
+
if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
|
|
933
|
+
nextLastSignificantToken = "?JSX";
|
|
934
|
+
postfixIncDec = true;
|
|
935
|
+
} else {
|
|
936
|
+
stack.push({ tag: "JSXChildren" });
|
|
937
|
+
}
|
|
938
|
+
break;
|
|
939
|
+
case "{":
|
|
940
|
+
stack.push({
|
|
941
|
+
tag: "InterpolationInJSX",
|
|
942
|
+
nesting: braces.length
|
|
943
|
+
});
|
|
944
|
+
nextLastSignificantToken = "?InterpolationInJSX";
|
|
945
|
+
postfixIncDec = false;
|
|
946
|
+
break;
|
|
947
|
+
case "/":
|
|
948
|
+
if (lastSignificantToken === "<") {
|
|
949
|
+
stack.pop();
|
|
950
|
+
if (stack[stack.length - 1].tag === "JSXChildren") {
|
|
951
|
+
stack.pop();
|
|
952
|
+
}
|
|
953
|
+
stack.push({ tag: "JSXTagEnd" });
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
957
|
+
yield {
|
|
958
|
+
type: "JSXPunctuator",
|
|
959
|
+
value: match[0]
|
|
960
|
+
};
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
JSXIdentifier.lastIndex = lastIndex;
|
|
964
|
+
if (match = JSXIdentifier.exec(input)) {
|
|
965
|
+
lastIndex = JSXIdentifier.lastIndex;
|
|
966
|
+
lastSignificantToken = match[0];
|
|
967
|
+
yield {
|
|
968
|
+
type: "JSXIdentifier",
|
|
969
|
+
value: match[0]
|
|
970
|
+
};
|
|
971
|
+
continue;
|
|
972
|
+
}
|
|
973
|
+
JSXString.lastIndex = lastIndex;
|
|
974
|
+
if (match = JSXString.exec(input)) {
|
|
975
|
+
lastIndex = JSXString.lastIndex;
|
|
976
|
+
lastSignificantToken = match[0];
|
|
977
|
+
yield {
|
|
978
|
+
type: "JSXString",
|
|
979
|
+
value: match[0],
|
|
980
|
+
closed: match[2] !== void 0
|
|
981
|
+
};
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
984
|
+
break;
|
|
985
|
+
case "JSXChildren":
|
|
986
|
+
JSXText.lastIndex = lastIndex;
|
|
987
|
+
if (match = JSXText.exec(input)) {
|
|
988
|
+
lastIndex = JSXText.lastIndex;
|
|
989
|
+
lastSignificantToken = match[0];
|
|
990
|
+
yield {
|
|
991
|
+
type: "JSXText",
|
|
992
|
+
value: match[0]
|
|
993
|
+
};
|
|
994
|
+
continue;
|
|
995
|
+
}
|
|
996
|
+
switch (input[lastIndex]) {
|
|
997
|
+
case "<":
|
|
998
|
+
stack.push({ tag: "JSXTag" });
|
|
999
|
+
lastIndex++;
|
|
1000
|
+
lastSignificantToken = "<";
|
|
1001
|
+
yield {
|
|
1002
|
+
type: "JSXPunctuator",
|
|
1003
|
+
value: "<"
|
|
1004
|
+
};
|
|
1005
|
+
continue;
|
|
1006
|
+
case "{":
|
|
1007
|
+
stack.push({
|
|
1008
|
+
tag: "InterpolationInJSX",
|
|
1009
|
+
nesting: braces.length
|
|
1010
|
+
});
|
|
1011
|
+
lastIndex++;
|
|
1012
|
+
lastSignificantToken = "?InterpolationInJSX";
|
|
1013
|
+
postfixIncDec = false;
|
|
1014
|
+
yield {
|
|
1015
|
+
type: "JSXPunctuator",
|
|
1016
|
+
value: "{"
|
|
1017
|
+
};
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
WhiteSpace.lastIndex = lastIndex;
|
|
1022
|
+
if (match = WhiteSpace.exec(input)) {
|
|
1023
|
+
lastIndex = WhiteSpace.lastIndex;
|
|
1024
|
+
yield {
|
|
1025
|
+
type: "WhiteSpace",
|
|
1026
|
+
value: match[0]
|
|
1027
|
+
};
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
LineTerminatorSequence.lastIndex = lastIndex;
|
|
1031
|
+
if (match = LineTerminatorSequence.exec(input)) {
|
|
1032
|
+
lastIndex = LineTerminatorSequence.lastIndex;
|
|
1033
|
+
postfixIncDec = false;
|
|
1034
|
+
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
|
|
1035
|
+
lastSignificantToken = "?NoLineTerminatorHere";
|
|
1036
|
+
}
|
|
1037
|
+
yield {
|
|
1038
|
+
type: "LineTerminatorSequence",
|
|
1039
|
+
value: match[0]
|
|
1040
|
+
};
|
|
1041
|
+
continue;
|
|
1042
|
+
}
|
|
1043
|
+
MultiLineComment.lastIndex = lastIndex;
|
|
1044
|
+
if (match = MultiLineComment.exec(input)) {
|
|
1045
|
+
lastIndex = MultiLineComment.lastIndex;
|
|
1046
|
+
if (Newline.test(match[0])) {
|
|
1047
|
+
postfixIncDec = false;
|
|
1048
|
+
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
|
|
1049
|
+
lastSignificantToken = "?NoLineTerminatorHere";
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
yield {
|
|
1053
|
+
type: "MultiLineComment",
|
|
1054
|
+
value: match[0],
|
|
1055
|
+
closed: match[1] !== void 0
|
|
1056
|
+
};
|
|
1057
|
+
continue;
|
|
1058
|
+
}
|
|
1059
|
+
SingleLineComment.lastIndex = lastIndex;
|
|
1060
|
+
if (match = SingleLineComment.exec(input)) {
|
|
1061
|
+
lastIndex = SingleLineComment.lastIndex;
|
|
1062
|
+
postfixIncDec = false;
|
|
1063
|
+
yield {
|
|
1064
|
+
type: "SingleLineComment",
|
|
1065
|
+
value: match[0]
|
|
1066
|
+
};
|
|
1067
|
+
continue;
|
|
1068
|
+
}
|
|
1069
|
+
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
1070
|
+
lastIndex += firstCodePoint.length;
|
|
1071
|
+
lastSignificantToken = firstCodePoint;
|
|
1072
|
+
postfixIncDec = false;
|
|
1073
|
+
yield {
|
|
1074
|
+
type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
|
|
1075
|
+
value: firstCodePoint
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
return void 0;
|
|
1079
|
+
};
|
|
1080
|
+
return jsTokens_1;
|
|
1081
|
+
}
|
|
1082
|
+
requireJsTokens();
|
|
1083
|
+
var reservedWords = {
|
|
1084
|
+
keyword: [
|
|
1085
|
+
"break",
|
|
1086
|
+
"case",
|
|
1087
|
+
"catch",
|
|
1088
|
+
"continue",
|
|
1089
|
+
"debugger",
|
|
1090
|
+
"default",
|
|
1091
|
+
"do",
|
|
1092
|
+
"else",
|
|
1093
|
+
"finally",
|
|
1094
|
+
"for",
|
|
1095
|
+
"function",
|
|
1096
|
+
"if",
|
|
1097
|
+
"return",
|
|
1098
|
+
"switch",
|
|
1099
|
+
"throw",
|
|
1100
|
+
"try",
|
|
1101
|
+
"var",
|
|
1102
|
+
"const",
|
|
1103
|
+
"while",
|
|
1104
|
+
"with",
|
|
1105
|
+
"new",
|
|
1106
|
+
"this",
|
|
1107
|
+
"super",
|
|
1108
|
+
"class",
|
|
1109
|
+
"extends",
|
|
1110
|
+
"export",
|
|
1111
|
+
"import",
|
|
1112
|
+
"null",
|
|
1113
|
+
"true",
|
|
1114
|
+
"false",
|
|
1115
|
+
"in",
|
|
1116
|
+
"instanceof",
|
|
1117
|
+
"typeof",
|
|
1118
|
+
"void",
|
|
1119
|
+
"delete"
|
|
1120
|
+
],
|
|
1121
|
+
strict: [
|
|
1122
|
+
"implements",
|
|
1123
|
+
"interface",
|
|
1124
|
+
"let",
|
|
1125
|
+
"package",
|
|
1126
|
+
"private",
|
|
1127
|
+
"protected",
|
|
1128
|
+
"public",
|
|
1129
|
+
"static",
|
|
1130
|
+
"yield"
|
|
1131
|
+
]
|
|
1132
|
+
};
|
|
1133
|
+
new Set(reservedWords.keyword);
|
|
1134
|
+
new Set(reservedWords.strict);
|
|
1135
|
+
var f = {
|
|
1136
|
+
reset: [0, 0],
|
|
1137
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
1138
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
1139
|
+
italic: [3, 23],
|
|
1140
|
+
underline: [4, 24],
|
|
1141
|
+
inverse: [7, 27],
|
|
1142
|
+
hidden: [8, 28],
|
|
1143
|
+
strikethrough: [9, 29],
|
|
1144
|
+
black: [30, 39],
|
|
1145
|
+
red: [31, 39],
|
|
1146
|
+
green: [32, 39],
|
|
1147
|
+
yellow: [33, 39],
|
|
1148
|
+
blue: [34, 39],
|
|
1149
|
+
magenta: [35, 39],
|
|
1150
|
+
cyan: [36, 39],
|
|
1151
|
+
white: [37, 39],
|
|
1152
|
+
gray: [90, 39],
|
|
1153
|
+
bgBlack: [40, 49],
|
|
1154
|
+
bgRed: [41, 49],
|
|
1155
|
+
bgGreen: [42, 49],
|
|
1156
|
+
bgYellow: [43, 49],
|
|
1157
|
+
bgBlue: [44, 49],
|
|
1158
|
+
bgMagenta: [45, 49],
|
|
1159
|
+
bgCyan: [46, 49],
|
|
1160
|
+
bgWhite: [47, 49],
|
|
1161
|
+
blackBright: [90, 39],
|
|
1162
|
+
redBright: [91, 39],
|
|
1163
|
+
greenBright: [92, 39],
|
|
1164
|
+
yellowBright: [93, 39],
|
|
1165
|
+
blueBright: [94, 39],
|
|
1166
|
+
magentaBright: [95, 39],
|
|
1167
|
+
cyanBright: [96, 39],
|
|
1168
|
+
whiteBright: [97, 39],
|
|
1169
|
+
bgBlackBright: [100, 49],
|
|
1170
|
+
bgRedBright: [101, 49],
|
|
1171
|
+
bgGreenBright: [102, 49],
|
|
1172
|
+
bgYellowBright: [103, 49],
|
|
1173
|
+
bgBlueBright: [104, 49],
|
|
1174
|
+
bgMagentaBright: [105, 49],
|
|
1175
|
+
bgCyanBright: [106, 49],
|
|
1176
|
+
bgWhiteBright: [107, 49]
|
|
1177
|
+
}, h = Object.entries(f);
|
|
1178
|
+
function a(n) {
|
|
1179
|
+
return String(n);
|
|
1180
|
+
}
|
|
1181
|
+
a.open = "";
|
|
1182
|
+
a.close = "";
|
|
1183
|
+
function C(n = false) {
|
|
1184
|
+
let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
|
|
1185
|
+
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
|
|
1186
|
+
}
|
|
1187
|
+
function p(n = false) {
|
|
1188
|
+
let e = C(n), i = (r, t, c, o) => {
|
|
1189
|
+
let l = "", s = 0;
|
|
1190
|
+
do
|
|
1191
|
+
l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
|
|
1192
|
+
while (~o);
|
|
1193
|
+
return l + r.substring(s);
|
|
1194
|
+
}, g = (r, t, c = r) => {
|
|
1195
|
+
let o = (l) => {
|
|
1196
|
+
let s = String(l), b = s.indexOf(t, r.length);
|
|
1197
|
+
return ~b ? r + i(s, t, c, b) + t : r + s + t;
|
|
1198
|
+
};
|
|
1199
|
+
return o.open = r, o.close = t, o;
|
|
1200
|
+
}, u = {
|
|
1201
|
+
isColorSupported: e
|
|
1202
|
+
}, d = (r) => `\x1B[${r}m`;
|
|
1203
|
+
for (let [r, t] of h)
|
|
1204
|
+
u[r] = e ? g(
|
|
1205
|
+
d(t[0]),
|
|
1206
|
+
d(t[1]),
|
|
1207
|
+
t[2]
|
|
1208
|
+
) : a;
|
|
1209
|
+
return u;
|
|
1210
|
+
}
|
|
1211
|
+
p();
|
|
1212
|
+
const lineSplitRE = /\r?\n/;
|
|
1213
|
+
function positionToOffset(source, lineNumber, columnNumber) {
|
|
1214
|
+
const lines = source.split(lineSplitRE);
|
|
1215
|
+
const nl = /\r\n/.test(source) ? 2 : 1;
|
|
1216
|
+
let start = 0;
|
|
1217
|
+
if (lineNumber > lines.length) {
|
|
1218
|
+
return source.length;
|
|
1046
1219
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1220
|
+
for (let i = 0; i < lineNumber - 1; i++) {
|
|
1221
|
+
start += lines[i].length + nl;
|
|
1049
1222
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1223
|
+
return start + columnNumber;
|
|
1224
|
+
}
|
|
1225
|
+
function offsetToLineNumber(source, offset) {
|
|
1226
|
+
if (offset > source.length) {
|
|
1227
|
+
throw new Error(
|
|
1228
|
+
`offset is longer than source length! offset ${offset} > length ${source.length}`
|
|
1055
1229
|
);
|
|
1056
1230
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1231
|
+
const lines = source.split(lineSplitRE);
|
|
1232
|
+
const nl = /\r\n/.test(source) ? 2 : 1;
|
|
1233
|
+
let counted = 0;
|
|
1234
|
+
let line = 0;
|
|
1235
|
+
for (; line < lines.length; line++) {
|
|
1236
|
+
const lineLength = lines[line].length + nl;
|
|
1237
|
+
if (counted + lineLength >= offset) {
|
|
1238
|
+
break;
|
|
1239
|
+
}
|
|
1240
|
+
counted += lineLength;
|
|
1241
|
+
}
|
|
1242
|
+
return line + 1;
|
|
1059
1243
|
}
|
|
1060
1244
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
1061
|
-
const MagicString = (await Promise.resolve().then(() => require("../../../../../magic-string@0.30.
|
|
1245
|
+
const MagicString = (await Promise.resolve().then(() => require("../../../../../magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.cjs"))).default;
|
|
1062
1246
|
const files = new Set(snapshots.map((i) => i.file));
|
|
1063
1247
|
await Promise.all(
|
|
1064
1248
|
Array.from(files).map(async (file) => {
|
|
@@ -1210,43 +1394,285 @@ async function saveRawSnapshots(environment, snapshots) {
|
|
|
1210
1394
|
})
|
|
1211
1395
|
);
|
|
1212
1396
|
}
|
|
1397
|
+
var naturalCompare$1 = { exports: {} };
|
|
1398
|
+
var hasRequiredNaturalCompare;
|
|
1399
|
+
function requireNaturalCompare() {
|
|
1400
|
+
if (hasRequiredNaturalCompare) return naturalCompare$1.exports;
|
|
1401
|
+
hasRequiredNaturalCompare = 1;
|
|
1402
|
+
/*
|
|
1403
|
+
* @version 1.4.0
|
|
1404
|
+
* @date 2015-10-26
|
|
1405
|
+
* @stability 3 - Stable
|
|
1406
|
+
* @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
|
|
1407
|
+
* @license MIT License
|
|
1408
|
+
*/
|
|
1409
|
+
var naturalCompare2 = function(a2, b) {
|
|
1410
|
+
var i, codeA, codeB = 1, posA = 0, posB = 0, alphabet = String.alphabet;
|
|
1411
|
+
function getCode(str, pos, code) {
|
|
1412
|
+
if (code) {
|
|
1413
|
+
for (i = pos; code = getCode(str, i), code < 76 && code > 65; ) ++i;
|
|
1414
|
+
return +str.slice(pos - 1, i);
|
|
1415
|
+
}
|
|
1416
|
+
code = alphabet && alphabet.indexOf(str.charAt(pos));
|
|
1417
|
+
return code > -1 ? code + 76 : (code = str.charCodeAt(pos) || 0, code < 45 || code > 127) ? code : code < 46 ? 65 : code < 48 ? code - 1 : code < 58 ? code + 18 : code < 65 ? code - 11 : code < 91 ? code + 11 : code < 97 ? code - 37 : code < 123 ? code + 5 : code - 63;
|
|
1418
|
+
}
|
|
1419
|
+
if ((a2 += "") != (b += "")) for (; codeB; ) {
|
|
1420
|
+
codeA = getCode(a2, posA++);
|
|
1421
|
+
codeB = getCode(b, posB++);
|
|
1422
|
+
if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
|
|
1423
|
+
codeA = getCode(a2, posA, posA);
|
|
1424
|
+
codeB = getCode(b, posB, posA = i);
|
|
1425
|
+
posB = i;
|
|
1426
|
+
}
|
|
1427
|
+
if (codeA != codeB) return codeA < codeB ? -1 : 1;
|
|
1428
|
+
}
|
|
1429
|
+
return 0;
|
|
1430
|
+
};
|
|
1431
|
+
try {
|
|
1432
|
+
naturalCompare$1.exports = naturalCompare2;
|
|
1433
|
+
} catch (e) {
|
|
1434
|
+
String.naturalCompare = naturalCompare2;
|
|
1435
|
+
}
|
|
1436
|
+
return naturalCompare$1.exports;
|
|
1437
|
+
}
|
|
1438
|
+
var naturalCompareExports = requireNaturalCompare();
|
|
1439
|
+
var naturalCompare = /* @__PURE__ */ getDefaultExportFromCjs(naturalCompareExports);
|
|
1440
|
+
const serialize$1 = (val, config, indentation, depth, refs, printer) => {
|
|
1441
|
+
const name = val.getMockName();
|
|
1442
|
+
const nameString = name === "vi.fn()" ? "" : ` ${name}`;
|
|
1443
|
+
let callsString = "";
|
|
1444
|
+
if (val.mock.calls.length !== 0) {
|
|
1445
|
+
const indentationNext = indentation + config.indent;
|
|
1446
|
+
callsString = ` {${config.spacingOuter}${indentationNext}"calls": ${printer(
|
|
1447
|
+
val.mock.calls,
|
|
1448
|
+
config,
|
|
1449
|
+
indentationNext,
|
|
1450
|
+
depth,
|
|
1451
|
+
refs
|
|
1452
|
+
)}${config.min ? ", " : ","}${config.spacingOuter}${indentationNext}"results": ${printer(
|
|
1453
|
+
val.mock.results,
|
|
1454
|
+
config,
|
|
1455
|
+
indentationNext,
|
|
1456
|
+
depth,
|
|
1457
|
+
refs
|
|
1458
|
+
)}${config.min ? "" : ","}${config.spacingOuter}${indentation}}`;
|
|
1459
|
+
}
|
|
1460
|
+
return `[MockFunction${nameString}]${callsString}`;
|
|
1461
|
+
};
|
|
1462
|
+
const test = (val) => val && !!val._isMockFunction;
|
|
1463
|
+
const plugin = { serialize: serialize$1, test };
|
|
1464
|
+
const {
|
|
1465
|
+
DOMCollection,
|
|
1466
|
+
DOMElement,
|
|
1467
|
+
Immutable,
|
|
1468
|
+
ReactElement,
|
|
1469
|
+
ReactTestComponent,
|
|
1470
|
+
AsymmetricMatcher
|
|
1471
|
+
} = index.plugins;
|
|
1472
|
+
let PLUGINS = [
|
|
1473
|
+
ReactTestComponent,
|
|
1474
|
+
ReactElement,
|
|
1475
|
+
DOMElement,
|
|
1476
|
+
DOMCollection,
|
|
1477
|
+
Immutable,
|
|
1478
|
+
AsymmetricMatcher,
|
|
1479
|
+
plugin
|
|
1480
|
+
];
|
|
1481
|
+
function addSerializer(plugin2) {
|
|
1482
|
+
PLUGINS = [plugin2].concat(PLUGINS);
|
|
1483
|
+
}
|
|
1484
|
+
function getSerializers() {
|
|
1485
|
+
return PLUGINS;
|
|
1486
|
+
}
|
|
1487
|
+
function testNameToKey(testName, count) {
|
|
1488
|
+
return `${testName} ${count}`;
|
|
1489
|
+
}
|
|
1490
|
+
function keyToTestName(key) {
|
|
1491
|
+
if (!/ \d+$/.test(key)) {
|
|
1492
|
+
throw new Error("Snapshot keys must end with a number.");
|
|
1493
|
+
}
|
|
1494
|
+
return key.replace(/ \d+$/, "");
|
|
1495
|
+
}
|
|
1496
|
+
function getSnapshotData(content, options) {
|
|
1497
|
+
const update = options.updateSnapshot;
|
|
1498
|
+
const data = /* @__PURE__ */ Object.create(null);
|
|
1499
|
+
let snapshotContents = "";
|
|
1500
|
+
let dirty = false;
|
|
1501
|
+
if (content != null) {
|
|
1502
|
+
try {
|
|
1503
|
+
snapshotContents = content;
|
|
1504
|
+
const populate = new Function("exports", snapshotContents);
|
|
1505
|
+
populate(data);
|
|
1506
|
+
} catch {
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
const isInvalid = snapshotContents;
|
|
1510
|
+
if ((update === "all" || update === "new") && isInvalid) {
|
|
1511
|
+
dirty = true;
|
|
1512
|
+
}
|
|
1513
|
+
return { data, dirty };
|
|
1514
|
+
}
|
|
1515
|
+
function addExtraLineBreaks(string) {
|
|
1516
|
+
return string.includes("\n") ? `
|
|
1517
|
+
${string}
|
|
1518
|
+
` : string;
|
|
1519
|
+
}
|
|
1520
|
+
function removeExtraLineBreaks(string) {
|
|
1521
|
+
return string.length > 2 && string.startsWith("\n") && string.endsWith("\n") ? string.slice(1, -1) : string;
|
|
1522
|
+
}
|
|
1523
|
+
const escapeRegex = true;
|
|
1524
|
+
const printFunctionName = false;
|
|
1525
|
+
function serialize(val, indent = 2, formatOverrides = {}) {
|
|
1526
|
+
return normalizeNewlines(
|
|
1527
|
+
index.format(val, {
|
|
1528
|
+
escapeRegex,
|
|
1529
|
+
indent,
|
|
1530
|
+
plugins: getSerializers(),
|
|
1531
|
+
printFunctionName,
|
|
1532
|
+
...formatOverrides
|
|
1533
|
+
})
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
function escapeBacktickString(str) {
|
|
1537
|
+
return str.replace(/`|\\|\$\{/g, "\\$&");
|
|
1538
|
+
}
|
|
1539
|
+
function printBacktickString(str) {
|
|
1540
|
+
return `\`${escapeBacktickString(str)}\``;
|
|
1541
|
+
}
|
|
1542
|
+
function normalizeNewlines(string) {
|
|
1543
|
+
return string.replace(/\r\n|\r/g, "\n");
|
|
1544
|
+
}
|
|
1545
|
+
async function saveSnapshotFile(environment, snapshotData, snapshotPath) {
|
|
1546
|
+
const snapshots = Object.keys(snapshotData).sort(naturalCompare).map(
|
|
1547
|
+
(key) => `exports[${printBacktickString(key)}] = ${printBacktickString(
|
|
1548
|
+
normalizeNewlines(snapshotData[key])
|
|
1549
|
+
)};`
|
|
1550
|
+
);
|
|
1551
|
+
const content = `${environment.getHeader()}
|
|
1552
|
+
|
|
1553
|
+
${snapshots.join("\n\n")}
|
|
1554
|
+
`;
|
|
1555
|
+
const oldContent = await environment.readSnapshotFile(snapshotPath);
|
|
1556
|
+
const skipWriting = oldContent != null && oldContent === content;
|
|
1557
|
+
if (skipWriting) {
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
await environment.saveSnapshotFile(snapshotPath, content);
|
|
1561
|
+
}
|
|
1562
|
+
function prepareExpected(expected) {
|
|
1563
|
+
function findStartIndent() {
|
|
1564
|
+
var _a, _b;
|
|
1565
|
+
const matchObject = /^( +)\}\s+$/m.exec(expected || "");
|
|
1566
|
+
const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length;
|
|
1567
|
+
if (objectIndent) {
|
|
1568
|
+
return objectIndent;
|
|
1569
|
+
}
|
|
1570
|
+
const matchText = /^\n( +)"/.exec(expected || "");
|
|
1571
|
+
return ((_b = matchText == null ? void 0 : matchText[1]) == null ? void 0 : _b.length) || 0;
|
|
1572
|
+
}
|
|
1573
|
+
const startIndent = findStartIndent();
|
|
1574
|
+
let expectedTrimmed = expected == null ? void 0 : expected.trim();
|
|
1575
|
+
if (startIndent) {
|
|
1576
|
+
expectedTrimmed = expectedTrimmed == null ? void 0 : expectedTrimmed.replace(new RegExp(`^${" ".repeat(startIndent)}`, "gm"), "").replace(/ +\}$/, "}");
|
|
1577
|
+
}
|
|
1578
|
+
return expectedTrimmed;
|
|
1579
|
+
}
|
|
1580
|
+
function deepMergeArray(target = [], source = []) {
|
|
1581
|
+
const mergedOutput = Array.from(target);
|
|
1582
|
+
source.forEach((sourceElement, index2) => {
|
|
1583
|
+
const targetElement = mergedOutput[index2];
|
|
1584
|
+
if (Array.isArray(target[index2])) {
|
|
1585
|
+
mergedOutput[index2] = deepMergeArray(target[index2], sourceElement);
|
|
1586
|
+
} else if (isObject(targetElement)) {
|
|
1587
|
+
mergedOutput[index2] = deepMergeSnapshot(target[index2], sourceElement);
|
|
1588
|
+
} else {
|
|
1589
|
+
mergedOutput[index2] = sourceElement;
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
return mergedOutput;
|
|
1593
|
+
}
|
|
1594
|
+
function deepMergeSnapshot(target, source) {
|
|
1595
|
+
if (isObject(target) && isObject(source)) {
|
|
1596
|
+
const mergedOutput = { ...target };
|
|
1597
|
+
Object.keys(source).forEach((key) => {
|
|
1598
|
+
if (isObject(source[key]) && !source[key].$$typeof) {
|
|
1599
|
+
if (!(key in target)) {
|
|
1600
|
+
Object.assign(mergedOutput, { [key]: source[key] });
|
|
1601
|
+
} else {
|
|
1602
|
+
mergedOutput[key] = deepMergeSnapshot(target[key], source[key]);
|
|
1603
|
+
}
|
|
1604
|
+
} else if (Array.isArray(source[key])) {
|
|
1605
|
+
mergedOutput[key] = deepMergeArray(target[key], source[key]);
|
|
1606
|
+
} else {
|
|
1607
|
+
Object.assign(mergedOutput, { [key]: source[key] });
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
return mergedOutput;
|
|
1611
|
+
} else if (Array.isArray(target) && Array.isArray(source)) {
|
|
1612
|
+
return deepMergeArray(target, source);
|
|
1613
|
+
}
|
|
1614
|
+
return target;
|
|
1615
|
+
}
|
|
1616
|
+
class DefaultMap extends Map {
|
|
1617
|
+
constructor(defaultFn, entries) {
|
|
1618
|
+
super(entries);
|
|
1619
|
+
this.defaultFn = defaultFn;
|
|
1620
|
+
}
|
|
1621
|
+
get(key) {
|
|
1622
|
+
if (!this.has(key)) {
|
|
1623
|
+
this.set(key, this.defaultFn(key));
|
|
1624
|
+
}
|
|
1625
|
+
return super.get(key);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
class CounterMap extends DefaultMap {
|
|
1629
|
+
constructor() {
|
|
1630
|
+
super(() => 0);
|
|
1631
|
+
}
|
|
1632
|
+
increment(key) {
|
|
1633
|
+
this.set(key, this.get(key) + 1);
|
|
1634
|
+
}
|
|
1635
|
+
total() {
|
|
1636
|
+
let total = 0;
|
|
1637
|
+
for (const x of this.values()) {
|
|
1638
|
+
total += x;
|
|
1639
|
+
}
|
|
1640
|
+
return total;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1213
1643
|
class SnapshotState {
|
|
1214
1644
|
constructor(testFilePath, snapshotPath, snapshotContent, options) {
|
|
1215
|
-
__publicField(this, "_counters");
|
|
1645
|
+
__publicField(this, "_counters", new CounterMap());
|
|
1216
1646
|
__publicField(this, "_dirty");
|
|
1217
1647
|
__publicField(this, "_updateSnapshot");
|
|
1218
1648
|
__publicField(this, "_snapshotData");
|
|
1219
1649
|
__publicField(this, "_initialData");
|
|
1220
1650
|
__publicField(this, "_inlineSnapshots");
|
|
1221
1651
|
__publicField(this, "_inlineSnapshotStacks");
|
|
1652
|
+
__publicField(this, "_testIdToKeys", new DefaultMap(() => []));
|
|
1222
1653
|
__publicField(this, "_rawSnapshots");
|
|
1223
1654
|
__publicField(this, "_uncheckedKeys");
|
|
1224
1655
|
__publicField(this, "_snapshotFormat");
|
|
1225
1656
|
__publicField(this, "_environment");
|
|
1226
1657
|
__publicField(this, "_fileExists");
|
|
1227
|
-
__publicField(this, "added");
|
|
1658
|
+
__publicField(this, "added", new CounterMap());
|
|
1659
|
+
__publicField(this, "matched", new CounterMap());
|
|
1660
|
+
__publicField(this, "unmatched", new CounterMap());
|
|
1661
|
+
__publicField(this, "updated", new CounterMap());
|
|
1228
1662
|
__publicField(this, "expand");
|
|
1229
|
-
__publicField(this, "matched");
|
|
1230
|
-
__publicField(this, "unmatched");
|
|
1231
|
-
__publicField(this, "updated");
|
|
1232
1663
|
this.testFilePath = testFilePath;
|
|
1233
1664
|
this.snapshotPath = snapshotPath;
|
|
1234
1665
|
const { data, dirty } = getSnapshotData(snapshotContent, options);
|
|
1235
1666
|
this._fileExists = snapshotContent != null;
|
|
1236
|
-
this._initialData = data;
|
|
1237
|
-
this._snapshotData = data;
|
|
1667
|
+
this._initialData = { ...data };
|
|
1668
|
+
this._snapshotData = { ...data };
|
|
1238
1669
|
this._dirty = dirty;
|
|
1239
1670
|
this._inlineSnapshots = [];
|
|
1240
1671
|
this._inlineSnapshotStacks = [];
|
|
1241
1672
|
this._rawSnapshots = [];
|
|
1242
1673
|
this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
|
|
1243
|
-
this._counters = /* @__PURE__ */ new Map();
|
|
1244
1674
|
this.expand = options.expand || false;
|
|
1245
|
-
this.added = 0;
|
|
1246
|
-
this.matched = 0;
|
|
1247
|
-
this.unmatched = 0;
|
|
1248
1675
|
this._updateSnapshot = options.updateSnapshot;
|
|
1249
|
-
this.updated = 0;
|
|
1250
1676
|
this._snapshotFormat = {
|
|
1251
1677
|
printBasicPrototype: false,
|
|
1252
1678
|
escapeString: false,
|
|
@@ -1268,11 +1694,30 @@ class SnapshotState {
|
|
|
1268
1694
|
}
|
|
1269
1695
|
markSnapshotsAsCheckedForTest(testName) {
|
|
1270
1696
|
this._uncheckedKeys.forEach((uncheckedKey) => {
|
|
1271
|
-
if (
|
|
1697
|
+
if (/ \d+$| > /.test(uncheckedKey.slice(testName.length))) {
|
|
1272
1698
|
this._uncheckedKeys.delete(uncheckedKey);
|
|
1273
1699
|
}
|
|
1274
1700
|
});
|
|
1275
1701
|
}
|
|
1702
|
+
clearTest(testId) {
|
|
1703
|
+
this._inlineSnapshots = this._inlineSnapshots.filter((s) => s.testId !== testId);
|
|
1704
|
+
this._inlineSnapshotStacks = this._inlineSnapshotStacks.filter((s) => s.testId !== testId);
|
|
1705
|
+
for (const key of this._testIdToKeys.get(testId)) {
|
|
1706
|
+
const name = keyToTestName(key);
|
|
1707
|
+
const count = this._counters.get(name);
|
|
1708
|
+
if (count > 0) {
|
|
1709
|
+
if (key in this._snapshotData || key in this._initialData) {
|
|
1710
|
+
this._snapshotData[key] = this._initialData[key];
|
|
1711
|
+
}
|
|
1712
|
+
this._counters.set(name, count - 1);
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
this._testIdToKeys.delete(testId);
|
|
1716
|
+
this.added.delete(testId);
|
|
1717
|
+
this.updated.delete(testId);
|
|
1718
|
+
this.matched.delete(testId);
|
|
1719
|
+
this.unmatched.delete(testId);
|
|
1720
|
+
}
|
|
1276
1721
|
_inferInlineSnapshotStack(stacks) {
|
|
1277
1722
|
const promiseIndex = stacks.findIndex(
|
|
1278
1723
|
(i) => i.method.match(/__VITEST_(RESOLVES|REJECTS)__/)
|
|
@@ -1290,6 +1735,7 @@ class SnapshotState {
|
|
|
1290
1735
|
if (options.stack) {
|
|
1291
1736
|
this._inlineSnapshots.push({
|
|
1292
1737
|
snapshot: receivedSerialized,
|
|
1738
|
+
testId: options.testId,
|
|
1293
1739
|
...options.stack
|
|
1294
1740
|
});
|
|
1295
1741
|
} else if (options.rawSnapshot) {
|
|
@@ -1301,15 +1747,6 @@ class SnapshotState {
|
|
|
1301
1747
|
this._snapshotData[key] = receivedSerialized;
|
|
1302
1748
|
}
|
|
1303
1749
|
}
|
|
1304
|
-
clear() {
|
|
1305
|
-
this._snapshotData = this._initialData;
|
|
1306
|
-
this._counters = /* @__PURE__ */ new Map();
|
|
1307
|
-
this.added = 0;
|
|
1308
|
-
this.matched = 0;
|
|
1309
|
-
this.unmatched = 0;
|
|
1310
|
-
this.updated = 0;
|
|
1311
|
-
this._dirty = false;
|
|
1312
|
-
}
|
|
1313
1750
|
async save() {
|
|
1314
1751
|
const hasExternalSnapshots = Object.keys(this._snapshotData).length;
|
|
1315
1752
|
const hasInlineSnapshots = this._inlineSnapshots.length;
|
|
@@ -1358,6 +1795,7 @@ class SnapshotState {
|
|
|
1358
1795
|
}
|
|
1359
1796
|
}
|
|
1360
1797
|
match({
|
|
1798
|
+
testId,
|
|
1361
1799
|
testName,
|
|
1362
1800
|
received,
|
|
1363
1801
|
key,
|
|
@@ -1367,11 +1805,12 @@ class SnapshotState {
|
|
|
1367
1805
|
rawSnapshot
|
|
1368
1806
|
}) {
|
|
1369
1807
|
var _a, _b;
|
|
1370
|
-
this._counters.
|
|
1371
|
-
const count =
|
|
1808
|
+
this._counters.increment(testName);
|
|
1809
|
+
const count = this._counters.get(testName);
|
|
1372
1810
|
if (!key) {
|
|
1373
1811
|
key = testNameToKey(testName, count);
|
|
1374
1812
|
}
|
|
1813
|
+
this._testIdToKeys.get(testId).push(key);
|
|
1375
1814
|
if (!(isInline && this._snapshotData[key] !== void 0)) {
|
|
1376
1815
|
this._uncheckedKeys.delete(key);
|
|
1377
1816
|
}
|
|
@@ -1385,8 +1824,8 @@ class SnapshotState {
|
|
|
1385
1824
|
}
|
|
1386
1825
|
}
|
|
1387
1826
|
const expected = isInline ? inlineSnapshot : rawSnapshot ? rawSnapshot.content : this._snapshotData[key];
|
|
1388
|
-
const expectedTrimmed = prepareExpected(expected);
|
|
1389
|
-
const pass = expectedTrimmed === prepareExpected(receivedSerialized);
|
|
1827
|
+
const expectedTrimmed = rawSnapshot ? expected : prepareExpected(expected);
|
|
1828
|
+
const pass = expectedTrimmed === (rawSnapshot ? receivedSerialized : prepareExpected(receivedSerialized));
|
|
1390
1829
|
const hasSnapshot = expected !== void 0;
|
|
1391
1830
|
const snapshotIsPersisted = isInline || this._fileExists || rawSnapshot && rawSnapshot.content != null;
|
|
1392
1831
|
if (pass && !isInline && !rawSnapshot) {
|
|
@@ -1413,29 +1852,31 @@ ${JSON.stringify(
|
|
|
1413
1852
|
this._inlineSnapshots = this._inlineSnapshots.filter((s) => !(s.file === stack.file && s.line === stack.line && s.column === stack.column));
|
|
1414
1853
|
throw new Error("toMatchInlineSnapshot cannot be called multiple times at the same location.");
|
|
1415
1854
|
}
|
|
1416
|
-
this._inlineSnapshotStacks.push(stack);
|
|
1855
|
+
this._inlineSnapshotStacks.push({ ...stack, testId });
|
|
1417
1856
|
}
|
|
1418
1857
|
if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
|
|
1419
1858
|
if (this._updateSnapshot === "all") {
|
|
1420
1859
|
if (!pass) {
|
|
1421
1860
|
if (hasSnapshot) {
|
|
1422
|
-
this.updated
|
|
1861
|
+
this.updated.increment(testId);
|
|
1423
1862
|
} else {
|
|
1424
|
-
this.added
|
|
1863
|
+
this.added.increment(testId);
|
|
1425
1864
|
}
|
|
1426
1865
|
this._addSnapshot(key, receivedSerialized, {
|
|
1427
1866
|
stack,
|
|
1867
|
+
testId,
|
|
1428
1868
|
rawSnapshot
|
|
1429
1869
|
});
|
|
1430
1870
|
} else {
|
|
1431
|
-
this.matched
|
|
1871
|
+
this.matched.increment(testId);
|
|
1432
1872
|
}
|
|
1433
1873
|
} else {
|
|
1434
1874
|
this._addSnapshot(key, receivedSerialized, {
|
|
1435
1875
|
stack,
|
|
1876
|
+
testId,
|
|
1436
1877
|
rawSnapshot
|
|
1437
1878
|
});
|
|
1438
|
-
this.added
|
|
1879
|
+
this.added.increment(testId);
|
|
1439
1880
|
}
|
|
1440
1881
|
return {
|
|
1441
1882
|
actual: "",
|
|
@@ -1446,16 +1887,16 @@ ${JSON.stringify(
|
|
|
1446
1887
|
};
|
|
1447
1888
|
} else {
|
|
1448
1889
|
if (!pass) {
|
|
1449
|
-
this.unmatched
|
|
1890
|
+
this.unmatched.increment(testId);
|
|
1450
1891
|
return {
|
|
1451
|
-
actual: removeExtraLineBreaks(receivedSerialized),
|
|
1892
|
+
actual: rawSnapshot ? receivedSerialized : removeExtraLineBreaks(receivedSerialized),
|
|
1452
1893
|
count,
|
|
1453
|
-
expected: expectedTrimmed !== void 0 ? removeExtraLineBreaks(expectedTrimmed) : void 0,
|
|
1894
|
+
expected: expectedTrimmed !== void 0 ? rawSnapshot ? expectedTrimmed : removeExtraLineBreaks(expectedTrimmed) : void 0,
|
|
1454
1895
|
key,
|
|
1455
1896
|
pass: false
|
|
1456
1897
|
};
|
|
1457
1898
|
} else {
|
|
1458
|
-
this.matched
|
|
1899
|
+
this.matched.increment(testId);
|
|
1459
1900
|
return {
|
|
1460
1901
|
actual: "",
|
|
1461
1902
|
count,
|
|
@@ -1484,10 +1925,10 @@ ${JSON.stringify(
|
|
|
1484
1925
|
}
|
|
1485
1926
|
const status = await this.save();
|
|
1486
1927
|
snapshot.fileDeleted = status.deleted;
|
|
1487
|
-
snapshot.added = this.added;
|
|
1488
|
-
snapshot.matched = this.matched;
|
|
1489
|
-
snapshot.unmatched = this.unmatched;
|
|
1490
|
-
snapshot.updated = this.updated;
|
|
1928
|
+
snapshot.added = this.added.total();
|
|
1929
|
+
snapshot.matched = this.matched.total();
|
|
1930
|
+
snapshot.unmatched = this.unmatched.total();
|
|
1931
|
+
snapshot.updated = this.updated.total();
|
|
1491
1932
|
snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
|
|
1492
1933
|
snapshot.uncheckedKeys = Array.from(uncheckedKeys);
|
|
1493
1934
|
return snapshot;
|
|
@@ -1512,43 +1953,47 @@ function createMismatchError(message, expand, actual, expected) {
|
|
|
1512
1953
|
}
|
|
1513
1954
|
class SnapshotClient {
|
|
1514
1955
|
constructor(options = {}) {
|
|
1515
|
-
__publicField(this, "filepath");
|
|
1516
|
-
__publicField(this, "name");
|
|
1517
|
-
__publicField(this, "snapshotState");
|
|
1518
1956
|
__publicField(this, "snapshotStateMap", /* @__PURE__ */ new Map());
|
|
1519
1957
|
this.options = options;
|
|
1520
1958
|
}
|
|
1521
|
-
async
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
this.name = name;
|
|
1525
|
-
if (((_a = this.snapshotState) == null ? void 0 : _a.testFilePath) !== filepath) {
|
|
1526
|
-
await this.finishCurrentRun();
|
|
1527
|
-
if (!this.getSnapshotState(filepath)) {
|
|
1528
|
-
this.snapshotStateMap.set(
|
|
1529
|
-
filepath,
|
|
1530
|
-
await SnapshotState.create(filepath, options)
|
|
1531
|
-
);
|
|
1532
|
-
}
|
|
1533
|
-
this.snapshotState = this.getSnapshotState(filepath);
|
|
1959
|
+
async setup(filepath, options) {
|
|
1960
|
+
if (this.snapshotStateMap.has(filepath)) {
|
|
1961
|
+
return;
|
|
1534
1962
|
}
|
|
1963
|
+
this.snapshotStateMap.set(
|
|
1964
|
+
filepath,
|
|
1965
|
+
await SnapshotState.create(filepath, options)
|
|
1966
|
+
);
|
|
1535
1967
|
}
|
|
1536
|
-
|
|
1537
|
-
|
|
1968
|
+
async finish(filepath) {
|
|
1969
|
+
const state = this.getSnapshotState(filepath);
|
|
1970
|
+
const result = await state.pack();
|
|
1971
|
+
this.snapshotStateMap.delete(filepath);
|
|
1972
|
+
return result;
|
|
1538
1973
|
}
|
|
1539
|
-
|
|
1540
|
-
this.filepath
|
|
1541
|
-
|
|
1974
|
+
skipTest(filepath, testName) {
|
|
1975
|
+
const state = this.getSnapshotState(filepath);
|
|
1976
|
+
state.markSnapshotsAsCheckedForTest(testName);
|
|
1542
1977
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1978
|
+
clearTest(filepath, testId) {
|
|
1979
|
+
const state = this.getSnapshotState(filepath);
|
|
1980
|
+
state.clearTest(testId);
|
|
1981
|
+
}
|
|
1982
|
+
getSnapshotState(filepath) {
|
|
1983
|
+
const state = this.snapshotStateMap.get(filepath);
|
|
1984
|
+
if (!state) {
|
|
1985
|
+
throw new Error(
|
|
1986
|
+
`The snapshot state for '${filepath}' is not found. Did you call 'SnapshotClient.setup()'?`
|
|
1987
|
+
);
|
|
1988
|
+
}
|
|
1989
|
+
return state;
|
|
1546
1990
|
}
|
|
1547
1991
|
assert(options) {
|
|
1548
|
-
var _a, _b
|
|
1992
|
+
var _a, _b;
|
|
1549
1993
|
const {
|
|
1550
|
-
filepath
|
|
1551
|
-
name
|
|
1994
|
+
filepath,
|
|
1995
|
+
name,
|
|
1996
|
+
testId = name,
|
|
1552
1997
|
message,
|
|
1553
1998
|
isInline = false,
|
|
1554
1999
|
properties,
|
|
@@ -1561,6 +2006,7 @@ class SnapshotClient {
|
|
|
1561
2006
|
if (!filepath) {
|
|
1562
2007
|
throw new Error("Snapshot cannot be used outside of test");
|
|
1563
2008
|
}
|
|
2009
|
+
const snapshotState = this.getSnapshotState(filepath);
|
|
1564
2010
|
if (typeof properties === "object") {
|
|
1565
2011
|
if (typeof received !== "object" || !received) {
|
|
1566
2012
|
throw new Error(
|
|
@@ -1572,7 +2018,7 @@ class SnapshotClient {
|
|
|
1572
2018
|
if (!pass2) {
|
|
1573
2019
|
throw createMismatchError(
|
|
1574
2020
|
"Snapshot properties mismatched",
|
|
1575
|
-
|
|
2021
|
+
snapshotState.expand,
|
|
1576
2022
|
received,
|
|
1577
2023
|
properties
|
|
1578
2024
|
);
|
|
@@ -1585,8 +2031,8 @@ class SnapshotClient {
|
|
|
1585
2031
|
}
|
|
1586
2032
|
}
|
|
1587
2033
|
const testName = [name, ...message ? [message] : []].join(" > ");
|
|
1588
|
-
const snapshotState = this.getSnapshotState(filepath);
|
|
1589
2034
|
const { actual, expected, key, pass } = snapshotState.match({
|
|
2035
|
+
testId,
|
|
1590
2036
|
testName,
|
|
1591
2037
|
received,
|
|
1592
2038
|
isInline,
|
|
@@ -1597,9 +2043,9 @@ class SnapshotClient {
|
|
|
1597
2043
|
if (!pass) {
|
|
1598
2044
|
throw createMismatchError(
|
|
1599
2045
|
`Snapshot \`${key || "unknown"}\` mismatched`,
|
|
1600
|
-
|
|
1601
|
-
actual == null ? void 0 : actual.trim(),
|
|
1602
|
-
expected == null ? void 0 : expected.trim()
|
|
2046
|
+
snapshotState.expand,
|
|
2047
|
+
rawSnapshot ? actual : actual == null ? void 0 : actual.trim(),
|
|
2048
|
+
rawSnapshot ? expected : expected == null ? void 0 : expected.trim()
|
|
1603
2049
|
);
|
|
1604
2050
|
}
|
|
1605
2051
|
}
|
|
@@ -1607,7 +2053,7 @@ class SnapshotClient {
|
|
|
1607
2053
|
if (!options.rawSnapshot) {
|
|
1608
2054
|
throw new Error("Raw snapshot is required");
|
|
1609
2055
|
}
|
|
1610
|
-
const { filepath
|
|
2056
|
+
const { filepath, rawSnapshot } = options;
|
|
1611
2057
|
if (rawSnapshot.content == null) {
|
|
1612
2058
|
if (!filepath) {
|
|
1613
2059
|
throw new Error("Snapshot cannot be used outside of test");
|
|
@@ -1622,14 +2068,6 @@ class SnapshotClient {
|
|
|
1622
2068
|
}
|
|
1623
2069
|
return this.assert(options);
|
|
1624
2070
|
}
|
|
1625
|
-
async finishCurrentRun() {
|
|
1626
|
-
if (!this.snapshotState) {
|
|
1627
|
-
return null;
|
|
1628
|
-
}
|
|
1629
|
-
const result = await this.snapshotState.pack();
|
|
1630
|
-
this.snapshotState = void 0;
|
|
1631
|
-
return result;
|
|
1632
|
-
}
|
|
1633
2071
|
clear() {
|
|
1634
2072
|
this.snapshotStateMap.clear();
|
|
1635
2073
|
}
|