trilean 1.13.3 → 1.13.5
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/dist/{dist-DOoOT9vq.cjs → dist-DO_3oafK.cjs} +210 -120
- package/dist/{dist-DKhCurgc.js → dist-Dn-LI_AV.js} +210 -120
- package/dist/evaluator-indeterminacy-helpers.cjs +3 -3
- package/dist/evaluator-indeterminacy-helpers.js +1 -1
- package/dist/evaluator-test-helpers.cjs +4 -4
- package/dist/evaluator-test-helpers.js +1 -1
- package/dist/{index.C4tKZ0yW-BXgPC7yz.cjs → index.CZzC1gGg-C3tq-f5f.cjs} +800 -540
- package/dist/{index.C4tKZ0yW-D6D25qxM.js → index.CZzC1gGg-DVgiC1Nq.js} +675 -415
- package/dist-cli/trilean.mjs +1 -1
- package/package.json +4 -4
- package/schemas/trilean.schema.json +1 -1
|
@@ -1,90 +1,92 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
2
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
3
3
|
//#endregion
|
|
4
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
4
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/tinyrainbow.Do8I1XRG.js
|
|
5
|
+
var d$1 = (e) => String(e);
|
|
6
|
+
d$1.open = d$1.close = "";
|
|
7
|
+
var i$1 = () => d$1;
|
|
8
|
+
var t$1 = "\x1B[39m";
|
|
9
|
+
var o = "\x1B[49m";
|
|
10
|
+
var F = (e, r, a, n, l) => {
|
|
11
|
+
let m = "", g = 0;
|
|
12
|
+
do
|
|
13
|
+
m += e.substring(g, n) + a, g = n + l, n = e.indexOf(r, g);
|
|
14
|
+
while (~n);
|
|
15
|
+
return m + e.substring(g);
|
|
16
|
+
};
|
|
17
|
+
var u$1 = (e, r, a = e, n = e.length) => {
|
|
18
|
+
let l = r.length, m = (g) => {
|
|
19
|
+
let s = g + "", x = s.indexOf(r, n);
|
|
20
|
+
return ~x ? e + F(s, r, a, x, l) + r : e + s + r;
|
|
21
|
+
};
|
|
22
|
+
return m.open = e, m.close = r, m;
|
|
23
|
+
};
|
|
24
|
+
var B = (e, r) => u$1(e, r, e, 5);
|
|
25
|
+
var c = (e) => {
|
|
26
|
+
let r = e.charCodeAt(0) === 35 ? e.slice(1) : e, a = parseInt(r, 16) || 0;
|
|
27
|
+
return r.length < 6 ? `${(a >> 8 & 15) * 17};${(a >> 4 & 15) * 17};${(a & 15) * 17}` : `${a >> 16 & 255};${a >> 8 & 255};${a & 255}`;
|
|
28
|
+
};
|
|
29
|
+
function y$1(e) {
|
|
30
|
+
let r = e ? u$1 : i$1;
|
|
31
|
+
return {
|
|
32
|
+
isColorSupported: e,
|
|
33
|
+
reset: r("\x1B[0m", "\x1B[0m"),
|
|
34
|
+
bold: r("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
35
|
+
dim: r("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
36
|
+
italic: r("\x1B[3m", "\x1B[23m"),
|
|
37
|
+
underline: r("\x1B[4m", "\x1B[24m"),
|
|
38
|
+
inverse: r("\x1B[7m", "\x1B[27m"),
|
|
39
|
+
hidden: r("\x1B[8m", "\x1B[28m"),
|
|
40
|
+
strikethrough: r("\x1B[9m", "\x1B[29m"),
|
|
41
|
+
black: r("\x1B[30m", t$1),
|
|
42
|
+
red: r("\x1B[31m", t$1),
|
|
43
|
+
green: r("\x1B[32m", t$1),
|
|
44
|
+
yellow: r("\x1B[33m", t$1),
|
|
45
|
+
blue: r("\x1B[34m", t$1),
|
|
46
|
+
magenta: r("\x1B[35m", t$1),
|
|
47
|
+
cyan: r("\x1B[36m", t$1),
|
|
48
|
+
white: r("\x1B[37m", t$1),
|
|
49
|
+
gray: r("\x1B[90m", t$1),
|
|
50
|
+
bgBlack: r("\x1B[40m", o),
|
|
51
|
+
bgRed: r("\x1B[41m", o),
|
|
52
|
+
bgGreen: r("\x1B[42m", o),
|
|
53
|
+
bgYellow: r("\x1B[43m", o),
|
|
54
|
+
bgBlue: r("\x1B[44m", o),
|
|
55
|
+
bgMagenta: r("\x1B[45m", o),
|
|
56
|
+
bgCyan: r("\x1B[46m", o),
|
|
57
|
+
bgWhite: r("\x1B[47m", o),
|
|
58
|
+
blackBright: r("\x1B[90m", t$1),
|
|
59
|
+
redBright: r("\x1B[91m", t$1),
|
|
60
|
+
greenBright: r("\x1B[92m", t$1),
|
|
61
|
+
yellowBright: r("\x1B[93m", t$1),
|
|
62
|
+
blueBright: r("\x1B[94m", t$1),
|
|
63
|
+
magentaBright: r("\x1B[95m", t$1),
|
|
64
|
+
cyanBright: r("\x1B[96m", t$1),
|
|
65
|
+
whiteBright: r("\x1B[97m", t$1),
|
|
66
|
+
bgBlackBright: r("\x1B[100m", o),
|
|
67
|
+
bgRedBright: r("\x1B[101m", o),
|
|
68
|
+
bgGreenBright: r("\x1B[102m", o),
|
|
69
|
+
bgYellowBright: r("\x1B[103m", o),
|
|
70
|
+
bgBlueBright: r("\x1B[104m", o),
|
|
71
|
+
bgMagentaBright: r("\x1B[105m", o),
|
|
72
|
+
bgCyanBright: r("\x1B[106m", o),
|
|
73
|
+
bgWhiteBright: r("\x1B[107m", o),
|
|
74
|
+
rgb: e ? (n, l, m) => B(`\x1B[38;2;${n};${l};${m}m`, t$1) : i$1,
|
|
75
|
+
bgRgb: e ? (n, l, m) => B(`\x1B[48;2;${n};${l};${m}m`, o) : i$1,
|
|
76
|
+
hex: e ? (n) => B(`\x1B[38;2;${c(n)}m`, t$1) : i$1,
|
|
77
|
+
bgHex: e ? (n) => B(`\x1B[48;2;${c(n)}m`, o) : i$1
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function C$1() {
|
|
81
|
+
let e = typeof process != "undefined" ? process : void 0, r = (e == null ? void 0 : e.env) || {}, a = r.FORCE_TTY !== "false", n = (e == null ? void 0 : e.argv) || [];
|
|
82
|
+
return !("NO_COLOR" in r || n.includes("--no-color")) && ("FORCE_COLOR" in r || n.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && r.TERM !== "dumb" || "CI" in r) || typeof window != "undefined" && !!window.chrome;
|
|
83
|
+
}
|
|
84
|
+
function h$1({ force: e } = {}) {
|
|
85
|
+
return y$1(e || C$1());
|
|
86
|
+
}
|
|
87
|
+
var $ = h$1();
|
|
86
88
|
//#endregion
|
|
87
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
89
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/index.D0heQG4v.js
|
|
88
90
|
function _mergeNamespaces(n, m) {
|
|
89
91
|
m.forEach(function(e) {
|
|
90
92
|
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
@@ -526,7 +528,7 @@ function requireReactIs_production() {
|
|
|
526
528
|
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
527
529
|
};
|
|
528
530
|
reactIs_production.isValidElementType = function(type) {
|
|
529
|
-
return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
|
|
531
|
+
return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_VIEW_TRANSITION_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
|
|
530
532
|
};
|
|
531
533
|
reactIs_production.typeOf = typeOf;
|
|
532
534
|
return reactIs_production;
|
|
@@ -620,7 +622,7 @@ function requireReactIs_development$1() {
|
|
|
620
622
|
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
621
623
|
};
|
|
622
624
|
reactIs_development$1.isValidElementType = function(type) {
|
|
623
|
-
return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
|
|
625
|
+
return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_VIEW_TRANSITION_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
|
|
624
626
|
};
|
|
625
627
|
reactIs_development$1.typeOf = typeOf;
|
|
626
628
|
})();
|
|
@@ -1020,7 +1022,7 @@ function printFunction(val, printFunctionName) {
|
|
|
1020
1022
|
return `[Function ${val.name || "anonymous"}]`;
|
|
1021
1023
|
}
|
|
1022
1024
|
function printSymbol(val) {
|
|
1023
|
-
return
|
|
1025
|
+
return Symbol.prototype.toString.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
1024
1026
|
}
|
|
1025
1027
|
function printError(val) {
|
|
1026
1028
|
return `[${errorToString.call(val)}]`;
|
|
@@ -1173,7 +1175,7 @@ function validateOptions$1(options) {
|
|
|
1173
1175
|
function getColorsHighlight() {
|
|
1174
1176
|
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1175
1177
|
const value = DEFAULT_THEME[key];
|
|
1176
|
-
const color = value &&
|
|
1178
|
+
const color = value && $[value];
|
|
1177
1179
|
if (color && typeof color.close === "string" && typeof color.open === "string") colors[key] = color;
|
|
1178
1180
|
else throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
1179
1181
|
return colors;
|
|
@@ -1247,7 +1249,7 @@ const plugins = {
|
|
|
1247
1249
|
Error: ErrorPlugin
|
|
1248
1250
|
};
|
|
1249
1251
|
//#endregion
|
|
1250
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
1252
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/display.BlTmubjj.js
|
|
1251
1253
|
const { AsymmetricMatcher: AsymmetricMatcher$3, DOMCollection: DOMCollection$2, DOMElement: DOMElement$2, Immutable: Immutable$2, ReactElement: ReactElement$2, ReactTestComponent: ReactTestComponent$2 } = plugins;
|
|
1252
1254
|
const PLUGINS$2 = [
|
|
1253
1255
|
ReactTestComponent$2,
|
|
@@ -1487,11 +1489,13 @@ function filterOutComments(s) {
|
|
|
1487
1489
|
if (s[i] === "\n") commentState = "none";
|
|
1488
1490
|
} else if (commentState === "multiline") {
|
|
1489
1491
|
if (s[i - 1] === "*" && s[i] === "/") commentState = "none";
|
|
1490
|
-
} else if (commentState === "none")
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1492
|
+
} else if (commentState === "none") {
|
|
1493
|
+
if (s[i] === "/" && s[i + 1] === "/") commentState = "singleline";
|
|
1494
|
+
else if (s[i] === "/" && s[i + 1] === "*") {
|
|
1495
|
+
commentState = "multiline";
|
|
1496
|
+
i += 2;
|
|
1497
|
+
} else result.push(s[i]);
|
|
1498
|
+
}
|
|
1495
1499
|
return result.join("");
|
|
1496
1500
|
}
|
|
1497
1501
|
function toArray(array) {
|
|
@@ -1708,7 +1712,7 @@ const isAbsolute = function(p) {
|
|
|
1708
1712
|
return _IS_ABSOLUTE_RE.test(p);
|
|
1709
1713
|
};
|
|
1710
1714
|
//#endregion
|
|
1711
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
1715
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/source-map.DakdQc29.js
|
|
1712
1716
|
var build = {};
|
|
1713
1717
|
var hasRequiredBuild;
|
|
1714
1718
|
function requireBuild() {
|
|
@@ -2120,7 +2124,7 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
2120
2124
|
intToChar[i] = c;
|
|
2121
2125
|
charToInt[c] = i;
|
|
2122
2126
|
}
|
|
2123
|
-
function decodeInteger(reader
|
|
2127
|
+
function decodeInteger(reader) {
|
|
2124
2128
|
let value = 0;
|
|
2125
2129
|
let shift = 0;
|
|
2126
2130
|
let integer = 0;
|
|
@@ -2129,10 +2133,10 @@ function decodeInteger(reader, relative) {
|
|
|
2129
2133
|
value |= (integer & 31) << shift;
|
|
2130
2134
|
shift += 5;
|
|
2131
2135
|
} while (integer & 32);
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
return
|
|
2136
|
+
return value;
|
|
2137
|
+
}
|
|
2138
|
+
function decodeSign(num) {
|
|
2139
|
+
return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
2136
2140
|
}
|
|
2137
2141
|
function hasMoreVlq(reader, max) {
|
|
2138
2142
|
if (reader.pos >= max) return false;
|
|
@@ -2172,15 +2176,15 @@ function decode(mappings) {
|
|
|
2172
2176
|
genColumn = 0;
|
|
2173
2177
|
while (reader.pos < semi) {
|
|
2174
2178
|
let seg;
|
|
2175
|
-
genColumn
|
|
2179
|
+
genColumn += decodeSign(decodeInteger(reader));
|
|
2176
2180
|
if (genColumn < lastCol) sorted = false;
|
|
2177
2181
|
lastCol = genColumn;
|
|
2178
2182
|
if (hasMoreVlq(reader, semi)) {
|
|
2179
|
-
sourcesIndex
|
|
2180
|
-
sourceLine
|
|
2181
|
-
sourceColumn
|
|
2183
|
+
sourcesIndex += decodeSign(decodeInteger(reader));
|
|
2184
|
+
sourceLine += decodeSign(decodeInteger(reader));
|
|
2185
|
+
sourceColumn += decodeSign(decodeInteger(reader));
|
|
2182
2186
|
if (hasMoreVlq(reader, semi)) {
|
|
2183
|
-
namesIndex
|
|
2187
|
+
namesIndex += decodeSign(decodeInteger(reader));
|
|
2184
2188
|
seg = [
|
|
2185
2189
|
genColumn,
|
|
2186
2190
|
sourcesIndex,
|
|
@@ -2335,7 +2339,7 @@ function extractLocation(urlLike) {
|
|
|
2335
2339
|
const urlObj = new URL(url);
|
|
2336
2340
|
urlObj.searchParams.delete("import");
|
|
2337
2341
|
urlObj.searchParams.delete("browserv");
|
|
2338
|
-
url = urlObj.pathname + urlObj.hash + urlObj.search;
|
|
2342
|
+
url = tryDecode(urlObj.pathname, decodeURI) + urlObj.hash + urlObj.search;
|
|
2339
2343
|
}
|
|
2340
2344
|
if (url.startsWith("/@fs/")) {
|
|
2341
2345
|
const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
|
|
@@ -2348,6 +2352,13 @@ function extractLocation(urlLike) {
|
|
|
2348
2352
|
parts[3] || void 0
|
|
2349
2353
|
];
|
|
2350
2354
|
}
|
|
2355
|
+
function tryDecode(value, decode) {
|
|
2356
|
+
try {
|
|
2357
|
+
return decode(value);
|
|
2358
|
+
} catch {
|
|
2359
|
+
return value;
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2351
2362
|
function parseSingleFFOrSafariStack(raw) {
|
|
2352
2363
|
let line = raw.trim();
|
|
2353
2364
|
if (SAFARI_NATIVE_CODE_REGEXP.test(line)) return null;
|
|
@@ -2392,7 +2403,7 @@ function parseSingleV8Stack(raw) {
|
|
|
2392
2403
|
let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
|
|
2393
2404
|
if (!file || !lineNumber || !columnNumber) return null;
|
|
2394
2405
|
if (method.startsWith("async ")) method = method.slice(6);
|
|
2395
|
-
if (file.startsWith("file://")) file = file.slice(7);
|
|
2406
|
+
if (file.startsWith("file://")) file = tryDecode(file.slice(7), decodeURIComponent);
|
|
2396
2407
|
file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
|
|
2397
2408
|
if (method) method = method.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
|
|
2398
2409
|
return {
|
|
@@ -2407,29 +2418,37 @@ function parseStacktrace(stack, options = {}) {
|
|
|
2407
2418
|
let stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
|
|
2408
2419
|
const helperIndex = stacks.findLastIndex((s) => s.method.includes("__VITEST_HELPER__"));
|
|
2409
2420
|
if (helperIndex >= 0) stacks = stacks.slice(helperIndex + 1);
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2421
|
+
if (options.firstOnly) {
|
|
2422
|
+
for (const stack of stacks) {
|
|
2423
|
+
const mapped = mapStackFrame(stack, options, ignoreStackEntries);
|
|
2424
|
+
if (mapped) return [mapped];
|
|
2425
|
+
}
|
|
2426
|
+
return [];
|
|
2427
|
+
}
|
|
2428
|
+
return stacks.map((stack) => mapStackFrame(stack, options, ignoreStackEntries)).filter((s) => s != null);
|
|
2429
|
+
}
|
|
2430
|
+
function mapStackFrame(stack, options, ignoreStackEntries) {
|
|
2431
|
+
if (options.getUrlId) stack.file = options.getUrlId(stack.file);
|
|
2432
|
+
const map = options.getSourceMap?.(stack.file);
|
|
2433
|
+
if (!map || typeof map !== "object" || !map.version) return shouldFilter(ignoreStackEntries, stack.file) ? null : stack;
|
|
2434
|
+
const traceMap = new DecodedMap(map, stack.file);
|
|
2435
|
+
if (stack.line <= 0 || stack.column <= 0) return stack;
|
|
2436
|
+
const position = getOriginalPosition(traceMap, {
|
|
2437
|
+
line: stack.line,
|
|
2438
|
+
column: stack.column - 1
|
|
2439
|
+
});
|
|
2440
|
+
if (!position) return stack;
|
|
2441
|
+
const { line, column, source, name } = position;
|
|
2442
|
+
let file = source || stack.file;
|
|
2443
|
+
if (/\/\w:\//.test(file)) file = file.slice(1);
|
|
2444
|
+
if (shouldFilter(ignoreStackEntries, file)) return null;
|
|
2445
|
+
if (line != null && column != null) return {
|
|
2446
|
+
line,
|
|
2447
|
+
column: column + 1,
|
|
2448
|
+
file,
|
|
2449
|
+
method: name || stack.method
|
|
2450
|
+
};
|
|
2451
|
+
return stack;
|
|
2433
2452
|
}
|
|
2434
2453
|
function shouldFilter(ignoreStackEntries, file) {
|
|
2435
2454
|
return ignoreStackEntries.some((p) => file.match(p));
|
|
@@ -2487,7 +2506,7 @@ function getOriginalPosition(map, needle) {
|
|
|
2487
2506
|
return result;
|
|
2488
2507
|
}
|
|
2489
2508
|
//#endregion
|
|
2490
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
2509
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/task-utils.js
|
|
2491
2510
|
/* @__NO_SIDE_EFFECTS__ */
|
|
2492
2511
|
function getNames(task) {
|
|
2493
2512
|
const names = [task.name];
|
|
@@ -2504,7 +2523,7 @@ function createTaskName(names, separator = " > ") {
|
|
|
2504
2523
|
return names.filter((name) => name !== void 0).join(separator);
|
|
2505
2524
|
}
|
|
2506
2525
|
//#endregion
|
|
2507
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
2526
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/run.CjdgFZiW.js
|
|
2508
2527
|
/**
|
|
2509
2528
|
* Diff Match and Patch
|
|
2510
2529
|
* Copyright 2018 The diff-match-patch Authors.
|
|
@@ -2911,22 +2930,24 @@ function joinAlignedDiffsNoExpand(diffs, options) {
|
|
|
2911
2930
|
while (i !== iLength) {
|
|
2912
2931
|
const iStart = i;
|
|
2913
2932
|
while (i !== iLength && diffs[i][0] === DIFF_EQUAL) i += 1;
|
|
2914
|
-
if (iStart !== i)
|
|
2915
|
-
if (
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2933
|
+
if (iStart !== i) {
|
|
2934
|
+
if (iStart === 0) {
|
|
2935
|
+
if (i > nContextLines) {
|
|
2936
|
+
jLength -= i - nContextLines;
|
|
2937
|
+
hasExcessAtStartOrEnd = true;
|
|
2938
|
+
}
|
|
2939
|
+
} else if (i === iLength) {
|
|
2940
|
+
const n = i - iStart;
|
|
2941
|
+
if (n > nContextLines) {
|
|
2942
|
+
jLength -= n - nContextLines;
|
|
2943
|
+
hasExcessAtStartOrEnd = true;
|
|
2944
|
+
}
|
|
2945
|
+
} else {
|
|
2946
|
+
const n = i - iStart;
|
|
2947
|
+
if (n > nContextLines2) {
|
|
2948
|
+
jLength -= n - nContextLines2;
|
|
2949
|
+
nExcessesBetweenChanges += 1;
|
|
2950
|
+
}
|
|
2930
2951
|
}
|
|
2931
2952
|
}
|
|
2932
2953
|
while (i !== iLength && diffs[i][0] !== DIFF_EQUAL) i += 1;
|
|
@@ -2962,33 +2983,35 @@ function joinAlignedDiffsNoExpand(diffs, options) {
|
|
|
2962
2983
|
while (i !== iLength) {
|
|
2963
2984
|
let iStart = i;
|
|
2964
2985
|
while (i !== iLength && diffs[i][0] === DIFF_EQUAL) i += 1;
|
|
2965
|
-
if (iStart !== i)
|
|
2966
|
-
if (
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
} else {
|
|
2978
|
-
const nCommon = i - iStart;
|
|
2979
|
-
if (nCommon > nContextLines2) {
|
|
2980
|
-
const iEnd = iStart + nContextLines;
|
|
2986
|
+
if (iStart !== i) {
|
|
2987
|
+
if (iStart === 0) {
|
|
2988
|
+
if (i > nContextLines) {
|
|
2989
|
+
iStart = i - nContextLines;
|
|
2990
|
+
aStart = iStart;
|
|
2991
|
+
bStart = iStart;
|
|
2992
|
+
aEnd = aStart;
|
|
2993
|
+
bEnd = bStart;
|
|
2994
|
+
}
|
|
2995
|
+
for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
2996
|
+
} else if (i === iLength) {
|
|
2997
|
+
const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i;
|
|
2981
2998
|
for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2999
|
+
} else {
|
|
3000
|
+
const nCommon = i - iStart;
|
|
3001
|
+
if (nCommon > nContextLines2) {
|
|
3002
|
+
const iEnd = iStart + nContextLines;
|
|
3003
|
+
for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
3004
|
+
lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options);
|
|
3005
|
+
jPatchMark = lines.length;
|
|
3006
|
+
lines.push("");
|
|
3007
|
+
const nOmit = nCommon - nContextLines2;
|
|
3008
|
+
aStart = aEnd + nOmit;
|
|
3009
|
+
bStart = bEnd + nOmit;
|
|
3010
|
+
aEnd = aStart;
|
|
3011
|
+
bEnd = bStart;
|
|
3012
|
+
for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
3013
|
+
} else for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
3014
|
+
}
|
|
2992
3015
|
}
|
|
2993
3016
|
while (i !== iLength && diffs[i][0] === DIFF_DELETE) {
|
|
2994
3017
|
pushDeleteLine(diffs[i][1]);
|
|
@@ -3019,14 +3042,14 @@ const DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
|
|
|
3019
3042
|
function getDefaultOptions() {
|
|
3020
3043
|
return {
|
|
3021
3044
|
aAnnotation: "Expected",
|
|
3022
|
-
aColor:
|
|
3045
|
+
aColor: $.green,
|
|
3023
3046
|
aIndicator: "-",
|
|
3024
3047
|
bAnnotation: "Received",
|
|
3025
|
-
bColor:
|
|
3048
|
+
bColor: $.red,
|
|
3026
3049
|
bIndicator: "+",
|
|
3027
|
-
changeColor:
|
|
3050
|
+
changeColor: $.inverse,
|
|
3028
3051
|
changeLineTrailingSpaceColor: noColor,
|
|
3029
|
-
commonColor:
|
|
3052
|
+
commonColor: $.dim,
|
|
3030
3053
|
commonIndicator: " ",
|
|
3031
3054
|
commonLineTrailingSpaceColor: noColor,
|
|
3032
3055
|
compareKeys: void 0,
|
|
@@ -3035,7 +3058,7 @@ function getDefaultOptions() {
|
|
|
3035
3058
|
expand: false,
|
|
3036
3059
|
includeChangeCounts: false,
|
|
3037
3060
|
omitAnnotationLines: false,
|
|
3038
|
-
patchColor:
|
|
3061
|
+
patchColor: $.yellow,
|
|
3039
3062
|
printBasicPrototype: false,
|
|
3040
3063
|
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
|
|
3041
3064
|
truncateAnnotation: "... Diff result is truncated",
|
|
@@ -3540,13 +3563,13 @@ function replaceTrailingSpaces$1(text) {
|
|
|
3540
3563
|
return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL$1.repeat(spaces.length));
|
|
3541
3564
|
}
|
|
3542
3565
|
function printReceived$1(object) {
|
|
3543
|
-
return
|
|
3566
|
+
return $.red(replaceTrailingSpaces$1(stringify(object)));
|
|
3544
3567
|
}
|
|
3545
3568
|
function printExpected$1(value) {
|
|
3546
|
-
return
|
|
3569
|
+
return $.green(replaceTrailingSpaces$1(stringify(value)));
|
|
3547
3570
|
}
|
|
3548
3571
|
function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff) {
|
|
3549
|
-
return diffs.reduce((reduced, diff) => reduced + (diff[0] === DIFF_EQUAL ? diff[1] : diff[0] === op ? hasCommonDiff ?
|
|
3572
|
+
return diffs.reduce((reduced, diff) => reduced + (diff[0] === DIFF_EQUAL ? diff[1] : diff[0] === op ? hasCommonDiff ? $.inverse(diff[1]) : diff[1] : ""), "");
|
|
3550
3573
|
}
|
|
3551
3574
|
function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
|
|
3552
3575
|
if (!_err || typeof _err !== "object") return { message: String(_err) };
|
|
@@ -3808,8 +3831,12 @@ function withFixtures(fn, options) {
|
|
|
3808
3831
|
for (const fixture of pendingFixtures) if (fixture.scope === "test") {
|
|
3809
3832
|
if (cachedFixtures.has(fixture)) continue;
|
|
3810
3833
|
cachedFixtures.add(fixture);
|
|
3811
|
-
|
|
3812
|
-
|
|
3834
|
+
try {
|
|
3835
|
+
context[fixture.name] = await resolveTestFixtureValue(fixture, context, cleanupFnArray);
|
|
3836
|
+
} catch (error) {
|
|
3837
|
+
cachedFixtures.delete(fixture);
|
|
3838
|
+
throw error;
|
|
3839
|
+
}
|
|
3813
3840
|
cleanupFnArray.push(() => {
|
|
3814
3841
|
cachedFixtures.delete(fixture);
|
|
3815
3842
|
});
|
|
@@ -3850,8 +3877,9 @@ async function resolveScopeFixtureValue(fixtures, suite, fixture) {
|
|
|
3850
3877
|
...fileContext
|
|
3851
3878
|
} : fixtureContext, cleanupFnFileArray).then((value) => {
|
|
3852
3879
|
fixtureContext[fixture.name] = value;
|
|
3853
|
-
scopedFixturePromiseCache.delete(fixture);
|
|
3854
3880
|
return value;
|
|
3881
|
+
}).finally(() => {
|
|
3882
|
+
scopedFixturePromiseCache.delete(fixture);
|
|
3855
3883
|
});
|
|
3856
3884
|
scopedFixturePromiseCache.set(fixture, promise);
|
|
3857
3885
|
return promise;
|
|
@@ -3891,8 +3919,10 @@ function resolveDeps(usedFixtures, registrations, depSet = /* @__PURE__ */ new S
|
|
|
3891
3919
|
pendingFixtures.push(fixture);
|
|
3892
3920
|
return;
|
|
3893
3921
|
}
|
|
3894
|
-
if (depSet.has(fixture))
|
|
3895
|
-
|
|
3922
|
+
if (depSet.has(fixture)) {
|
|
3923
|
+
if (fixture.parent) fixture = fixture.parent;
|
|
3924
|
+
else throw new Error(`Circular fixture dependency detected: ${fixture.name} <- ${[...depSet].reverse().map((d) => d.name).join(" <- ")}`);
|
|
3925
|
+
}
|
|
3896
3926
|
depSet.add(fixture);
|
|
3897
3927
|
resolveDeps(Array.from(fixture.deps, (n) => n === fixture.name ? fixture.parent : registrations.get(n)).filter((n) => !!n), registrations, depSet, pendingFixtures);
|
|
3898
3928
|
pendingFixtures.push(fixture);
|
|
@@ -3979,6 +4009,10 @@ function createChainable(keys, fn, context) {
|
|
|
3979
4009
|
Object.defineProperty(chain, kChainableContext, {
|
|
3980
4010
|
value: {
|
|
3981
4011
|
withContext: () => chain.bind(context),
|
|
4012
|
+
extendContext: (ctx) => create({
|
|
4013
|
+
...context,
|
|
4014
|
+
...ctx
|
|
4015
|
+
}),
|
|
3982
4016
|
getFixtures: () => context.fixtures,
|
|
3983
4017
|
setContext: (key, value) => {
|
|
3984
4018
|
context[key] = value;
|
|
@@ -4301,6 +4335,10 @@ function createSuiteHooks() {
|
|
|
4301
4335
|
};
|
|
4302
4336
|
}
|
|
4303
4337
|
const POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
|
4338
|
+
function assignDefined(target, source) {
|
|
4339
|
+
for (const key in source) if (source[key] !== void 0) target[key] = source[key];
|
|
4340
|
+
return target;
|
|
4341
|
+
}
|
|
4304
4342
|
function parseArguments(optionsOrFn, timeoutOrTest) {
|
|
4305
4343
|
if (timeoutOrTest != null && typeof timeoutOrTest === "object") throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
|
|
4306
4344
|
let options = {};
|
|
@@ -4329,16 +4367,16 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
4329
4367
|
return tagDefinition;
|
|
4330
4368
|
}).filter((r) => r != null).sort((tag1, tag2) => (tag2.priority ?? POSITIVE_INFINITY) - (tag1.priority ?? POSITIVE_INFINITY)).reduce((acc, tag) => {
|
|
4331
4369
|
const { name, description, priority, meta, ...options } = tag;
|
|
4332
|
-
|
|
4370
|
+
assignDefined(acc, options);
|
|
4333
4371
|
if (meta) acc.meta = Object.assign(acc.meta ?? Object.create(null), meta);
|
|
4334
4372
|
return acc;
|
|
4335
4373
|
}, {});
|
|
4336
4374
|
const testOwnMeta = options.meta;
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
...
|
|
4340
|
-
...
|
|
4341
|
-
};
|
|
4375
|
+
const parentOptions = collectorContext.currentSuite?.options;
|
|
4376
|
+
options = assignDefined({
|
|
4377
|
+
...parentOptions,
|
|
4378
|
+
...tagsOptions
|
|
4379
|
+
}, options);
|
|
4342
4380
|
const timeout = options.timeout ?? runner.config.testTimeout;
|
|
4343
4381
|
const parentMeta = currentSuite?.meta;
|
|
4344
4382
|
const tagMeta = tagsOptions.meta;
|
|
@@ -4397,8 +4435,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
4397
4435
|
const concurrent = this.concurrent ?? options?.concurrent;
|
|
4398
4436
|
if (concurrent != null) options.concurrent = concurrent;
|
|
4399
4437
|
const test = task(formatName(name), {
|
|
4400
|
-
...this,
|
|
4401
|
-
...options,
|
|
4438
|
+
...assignDefined({ ...this }, options),
|
|
4402
4439
|
handler
|
|
4403
4440
|
});
|
|
4404
4441
|
test.type = "test";
|
|
@@ -4483,10 +4520,7 @@ function createSuite() {
|
|
|
4483
4520
|
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
4484
4521
|
let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
|
|
4485
4522
|
const { meta: parentMeta, ...parentOptions } = currentSuite?.options || {};
|
|
4486
|
-
options = {
|
|
4487
|
-
...parentOptions,
|
|
4488
|
-
...options
|
|
4489
|
-
};
|
|
4523
|
+
options = assignDefined({ ...parentOptions }, options);
|
|
4490
4524
|
const shuffle = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ?? void 0;
|
|
4491
4525
|
if (shuffle != null) options.shuffle = shuffle;
|
|
4492
4526
|
let mode = this.only ?? options.only ? "only" : this.skip ?? options.skip ? "skip" : this.todo ?? options.todo ? "todo" : "run";
|
|
@@ -4508,9 +4542,10 @@ function createSuite() {
|
|
|
4508
4542
|
const fnFirst = typeof optionsOrFn === "function";
|
|
4509
4543
|
cases.forEach((i, idx) => {
|
|
4510
4544
|
const items = Array.isArray(i) ? i : [i];
|
|
4511
|
-
if (fnFirst)
|
|
4512
|
-
|
|
4513
|
-
|
|
4545
|
+
if (fnFirst) {
|
|
4546
|
+
if (arrayOnlyCases) suite(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
4547
|
+
else suite(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
|
|
4548
|
+
} else if (arrayOnlyCases) suite(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
4514
4549
|
else suite(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
|
|
4515
4550
|
});
|
|
4516
4551
|
context.setContext("each", void 0);
|
|
@@ -4551,9 +4586,10 @@ function createTaskCollector(fn) {
|
|
|
4551
4586
|
const fnFirst = typeof optionsOrFn === "function";
|
|
4552
4587
|
cases.forEach((i, idx) => {
|
|
4553
4588
|
const items = Array.isArray(i) ? i : [i];
|
|
4554
|
-
if (fnFirst)
|
|
4555
|
-
|
|
4556
|
-
|
|
4589
|
+
if (fnFirst) {
|
|
4590
|
+
if (arrayOnlyCases) test(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
4591
|
+
else test(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
|
|
4592
|
+
} else if (arrayOnlyCases) test(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
4557
4593
|
else test(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
|
|
4558
4594
|
});
|
|
4559
4595
|
context.setContext("each", void 0);
|
|
@@ -4576,10 +4612,10 @@ function createTaskCollector(fn) {
|
|
|
4576
4612
|
};
|
|
4577
4613
|
};
|
|
4578
4614
|
taskFn.skipIf = function(condition) {
|
|
4579
|
-
return
|
|
4615
|
+
return getChainableContext(this).extendContext({ skip: !!condition });
|
|
4580
4616
|
};
|
|
4581
4617
|
taskFn.runIf = function(condition) {
|
|
4582
|
-
return
|
|
4618
|
+
return getChainableContext(this).extendContext({ skip: !condition });
|
|
4583
4619
|
};
|
|
4584
4620
|
/**
|
|
4585
4621
|
* Parse builder pattern arguments into a fixtures object.
|
|
@@ -4678,7 +4714,7 @@ function formatTitle(template, items, idx) {
|
|
|
4678
4714
|
if (!isObjectItem && !isArrayKey) return `$${key}`;
|
|
4679
4715
|
const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
|
|
4680
4716
|
const value = isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement;
|
|
4681
|
-
if (typeof value === "string") return truncateString(value, inspectOptions.truncate);
|
|
4717
|
+
if (typeof value === "string") return inspectOptions.truncate ? truncateString(value, inspectOptions.truncate) : value;
|
|
4682
4718
|
return inspect$1(value, inspectOptions);
|
|
4683
4719
|
});
|
|
4684
4720
|
}
|
|
@@ -5072,7 +5108,7 @@ async function finishSendTasksUpdate(runner) {
|
|
|
5072
5108
|
await Promise.all(pendingTasksUpdates);
|
|
5073
5109
|
}
|
|
5074
5110
|
//#endregion
|
|
5075
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
5111
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/utils.DYj33du9.js
|
|
5076
5112
|
const NAME_WORKER_STATE = "__vitest_worker__";
|
|
5077
5113
|
function getWorkerState() {
|
|
5078
5114
|
const workerState = globalThis[NAME_WORKER_STATE];
|
|
@@ -5098,19 +5134,41 @@ function resetModules(modules, resetMocks = false) {
|
|
|
5098
5134
|
});
|
|
5099
5135
|
}
|
|
5100
5136
|
//#endregion
|
|
5101
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
5137
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/spy.DDMXghXv.js
|
|
5102
5138
|
function isMockFunction(fn) {
|
|
5103
5139
|
return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true;
|
|
5104
5140
|
}
|
|
5105
5141
|
const MOCK_RESTORE = /* @__PURE__ */ new Set();
|
|
5106
5142
|
const DIRTY_MOCK_STATES = /* @__PURE__ */ new Set();
|
|
5107
|
-
const
|
|
5108
|
-
const
|
|
5143
|
+
const DIRTY_MOCK_CONFIGS = /* @__PURE__ */ new Set();
|
|
5144
|
+
const addToSet = Set.prototype.add;
|
|
5145
|
+
const MOCK_REFS = /* @__PURE__ */ new WeakMap();
|
|
5109
5146
|
const MOCK_FINALIZER = new FinalizationRegistry((ref) => {
|
|
5110
|
-
|
|
5147
|
+
DIRTY_MOCK_STATES.delete(ref);
|
|
5148
|
+
DIRTY_MOCK_CONFIGS.delete(ref);
|
|
5111
5149
|
});
|
|
5112
5150
|
const MOCK_CONFIGS = /* @__PURE__ */ new WeakMap();
|
|
5113
5151
|
const MOCKS_BY_STATE = /* @__PURE__ */ new WeakMap();
|
|
5152
|
+
function markDirty(set, mock) {
|
|
5153
|
+
let ref = MOCK_REFS.get(mock);
|
|
5154
|
+
if (!ref) {
|
|
5155
|
+
ref = new WeakRef(mock);
|
|
5156
|
+
MOCK_REFS.set(mock, ref);
|
|
5157
|
+
MOCK_FINALIZER.register(mock, ref);
|
|
5158
|
+
}
|
|
5159
|
+
addToSet.call(set, ref);
|
|
5160
|
+
}
|
|
5161
|
+
function unmarkDirty(set, mock) {
|
|
5162
|
+
const ref = MOCK_REFS.get(mock);
|
|
5163
|
+
if (ref) set.delete(ref);
|
|
5164
|
+
}
|
|
5165
|
+
function forEachDirty(set, fn) {
|
|
5166
|
+
for (const ref of set) {
|
|
5167
|
+
const mock = ref.deref();
|
|
5168
|
+
if (mock) fn(mock);
|
|
5169
|
+
else set.delete(ref);
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5114
5172
|
function createMockInstance(options = {}) {
|
|
5115
5173
|
const { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options;
|
|
5116
5174
|
if (restore) MOCK_RESTORE.add(restore);
|
|
@@ -5131,9 +5189,6 @@ function createMockInstance(options = {}) {
|
|
|
5131
5189
|
if (resetToMockName) config.mockName = mock.name || "vi.fn()";
|
|
5132
5190
|
MOCK_CONFIGS.set(mock, config);
|
|
5133
5191
|
MOCKS_BY_STATE.set(state, mock);
|
|
5134
|
-
const ref = new WeakRef(mock);
|
|
5135
|
-
REGISTERED_MOCKS.add(ref);
|
|
5136
|
-
MOCK_FINALIZER.register(mock, ref);
|
|
5137
5192
|
mock._isMockFunction = true;
|
|
5138
5193
|
mock.getMockImplementation = () => {
|
|
5139
5194
|
return config.onceMockImplementations[0] || config.mockImplementation;
|
|
@@ -5148,21 +5203,25 @@ function createMockInstance(options = {}) {
|
|
|
5148
5203
|
value: state
|
|
5149
5204
|
});
|
|
5150
5205
|
mock.mockImplementation = function mockImplementation(implementation) {
|
|
5206
|
+
markDirty(DIRTY_MOCK_CONFIGS, mock);
|
|
5151
5207
|
config.mockImplementation = implementation;
|
|
5152
5208
|
updateMockPrototype();
|
|
5153
5209
|
return mock;
|
|
5154
5210
|
};
|
|
5155
5211
|
mock.mockImplementationOnce = function mockImplementationOnce(implementation) {
|
|
5212
|
+
markDirty(DIRTY_MOCK_CONFIGS, mock);
|
|
5156
5213
|
config.onceMockImplementations.push(implementation);
|
|
5157
5214
|
updateMockPrototype();
|
|
5158
5215
|
return mock;
|
|
5159
5216
|
};
|
|
5160
5217
|
mock.withImplementation = function withImplementation(implementation, callback) {
|
|
5218
|
+
markDirty(DIRTY_MOCK_CONFIGS, mock);
|
|
5161
5219
|
const previousImplementation = config.mockImplementation;
|
|
5162
5220
|
const previousOnceImplementations = config.onceMockImplementations;
|
|
5163
5221
|
const reset = () => {
|
|
5164
5222
|
config.mockImplementation = previousImplementation;
|
|
5165
5223
|
config.onceMockImplementations = previousOnceImplementations;
|
|
5224
|
+
markDirty(DIRTY_MOCK_CONFIGS, mock);
|
|
5166
5225
|
updateMockPrototype();
|
|
5167
5226
|
};
|
|
5168
5227
|
config.mockImplementation = implementation;
|
|
@@ -5234,7 +5293,7 @@ function createMockInstance(options = {}) {
|
|
|
5234
5293
|
state.invocationCallOrder = [];
|
|
5235
5294
|
state.results = [];
|
|
5236
5295
|
state.settledResults = [];
|
|
5237
|
-
DIRTY_MOCK_STATES
|
|
5296
|
+
unmarkDirty(DIRTY_MOCK_STATES, mock);
|
|
5238
5297
|
return mock;
|
|
5239
5298
|
};
|
|
5240
5299
|
mock.mockReset = function mockReset() {
|
|
@@ -5242,6 +5301,7 @@ function createMockInstance(options = {}) {
|
|
|
5242
5301
|
config.mockImplementation = resetToMockImplementation ? mockImplementation : void 0;
|
|
5243
5302
|
config.mockName = resetToMockName ? mock.name || "vi.fn()" : "vi.fn()";
|
|
5244
5303
|
config.onceMockImplementations = [];
|
|
5304
|
+
unmarkDirty(DIRTY_MOCK_CONFIGS, mock);
|
|
5245
5305
|
updateMockPrototype();
|
|
5246
5306
|
return mock;
|
|
5247
5307
|
};
|
|
@@ -5250,7 +5310,10 @@ function createMockInstance(options = {}) {
|
|
|
5250
5310
|
return restore?.();
|
|
5251
5311
|
};
|
|
5252
5312
|
mock.mockName = function mockName(name) {
|
|
5253
|
-
if (typeof name === "string")
|
|
5313
|
+
if (typeof name === "string") {
|
|
5314
|
+
markDirty(DIRTY_MOCK_CONFIGS, mock);
|
|
5315
|
+
config.mockName = name;
|
|
5316
|
+
}
|
|
5254
5317
|
return mock;
|
|
5255
5318
|
};
|
|
5256
5319
|
mock.getMockName = function getMockName() {
|
|
@@ -5337,8 +5400,8 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
|
|
|
5337
5400
|
const noopImplementation = function() {};
|
|
5338
5401
|
const prototypeMock = prototypeState && MOCKS_BY_STATE.get(prototypeState);
|
|
5339
5402
|
const namedObject = { [name]: function(...args) {
|
|
5340
|
-
|
|
5341
|
-
if (prototypeMock)
|
|
5403
|
+
markDirty(DIRTY_MOCK_STATES, namedObject[name]);
|
|
5404
|
+
if (prototypeMock) markDirty(DIRTY_MOCK_STATES, prototypeMock);
|
|
5342
5405
|
registerCalls(args, state, prototypeState);
|
|
5343
5406
|
registerInvocationOrder(invocationCallCounter++, state, prototypeState);
|
|
5344
5407
|
const result = {
|
|
@@ -5502,20 +5565,17 @@ function restoreAllMocks() {
|
|
|
5502
5565
|
MOCK_RESTORE.clear();
|
|
5503
5566
|
}
|
|
5504
5567
|
function clearAllMocks() {
|
|
5505
|
-
|
|
5568
|
+
forEachDirty(DIRTY_MOCK_STATES, (mock) => mock.mockClear());
|
|
5506
5569
|
}
|
|
5507
5570
|
function resetAllMocks() {
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
if (mock) mock.mockReset();
|
|
5511
|
-
else REGISTERED_MOCKS.delete(ref);
|
|
5512
|
-
}
|
|
5571
|
+
forEachDirty(DIRTY_MOCK_STATES, (mock) => mock.mockReset());
|
|
5572
|
+
forEachDirty(DIRTY_MOCK_CONFIGS, (mock) => mock.mockReset());
|
|
5513
5573
|
}
|
|
5514
5574
|
function throwConstructorError(shorthand) {
|
|
5515
5575
|
throw new TypeError(`Cannot use \`${shorthand}\` when called with \`new\`. Use \`mockImplementation\` with a \`class\` keyword instead. See https://vitest.dev/api/mock#class-support for more information.`);
|
|
5516
5576
|
}
|
|
5517
5577
|
//#endregion
|
|
5518
|
-
//#region ../../node_modules/.pnpm/chai@6.
|
|
5578
|
+
//#region ../../node_modules/.pnpm/chai@6.3.0/node_modules/chai/index.js
|
|
5519
5579
|
var __defProp = Object.defineProperty;
|
|
5520
5580
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
5521
5581
|
enumerable: true,
|
|
@@ -5596,6 +5656,7 @@ function compatibleConstructor(thrown, errorLike) {
|
|
|
5596
5656
|
__name(compatibleConstructor, "compatibleConstructor");
|
|
5597
5657
|
function compatibleMessage(thrown, errMatcher) {
|
|
5598
5658
|
const comparisonString = typeof thrown === "string" ? thrown : thrown.message;
|
|
5659
|
+
if (comparisonString === void 0) return false;
|
|
5599
5660
|
if (isRegExp(errMatcher)) return errMatcher.test(comparisonString);
|
|
5600
5661
|
else if (typeof errMatcher === "string") return comparisonString.indexOf(errMatcher) !== -1;
|
|
5601
5662
|
return false;
|
|
@@ -6253,8 +6314,10 @@ __name(inspect2, "inspect");
|
|
|
6253
6314
|
function objDisplay(obj) {
|
|
6254
6315
|
let str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
|
|
6255
6316
|
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
|
6256
|
-
if (type3 === "[object Function]")
|
|
6257
|
-
|
|
6317
|
+
if (type3 === "[object Function]") {
|
|
6318
|
+
const objAsFunction = obj;
|
|
6319
|
+
return !objAsFunction.name || objAsFunction.name === "" ? "[Function]" : "[Function: " + objAsFunction.name + "]";
|
|
6320
|
+
} else if (type3 === "[object Array]") return "[ Array(" + obj.length + ") ]";
|
|
6258
6321
|
else if (type3 === "[object Object]") {
|
|
6259
6322
|
let keys = Object.keys(obj);
|
|
6260
6323
|
return "{ Object (" + (keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ")) + ") }";
|
|
@@ -6267,25 +6330,24 @@ function getMessage2(obj, args) {
|
|
|
6267
6330
|
let val = flag(obj, "object");
|
|
6268
6331
|
let expected = args[3];
|
|
6269
6332
|
let actual = getActual(obj, args);
|
|
6270
|
-
let
|
|
6333
|
+
let rawMsg = negate ? args[2] : args[1];
|
|
6271
6334
|
let flagMsg = flag(obj, "message");
|
|
6272
|
-
if (typeof
|
|
6273
|
-
msg =
|
|
6274
|
-
|
|
6275
|
-
return objDisplay(
|
|
6276
|
-
}).replace(/#\{act\}/g, function() {
|
|
6277
|
-
return objDisplay(actual);
|
|
6278
|
-
}).replace(/#\{exp\}/g, function() {
|
|
6335
|
+
if (typeof rawMsg === "function") rawMsg = rawMsg();
|
|
6336
|
+
const msg = (rawMsg || "").replace(/#\{(this|act|exp)\}/g, function(_, tag) {
|
|
6337
|
+
if (tag === "this") return objDisplay(val);
|
|
6338
|
+
if (tag === "act") return objDisplay(actual);
|
|
6279
6339
|
return objDisplay(expected);
|
|
6280
6340
|
});
|
|
6281
6341
|
return flagMsg ? flagMsg + ": " + msg : msg;
|
|
6282
6342
|
}
|
|
6283
6343
|
__name(getMessage2, "getMessage");
|
|
6284
|
-
function transferFlags(
|
|
6285
|
-
|
|
6286
|
-
|
|
6344
|
+
function transferFlags(source, object, includeAll) {
|
|
6345
|
+
const sourceWithFlags = source;
|
|
6346
|
+
const objWithFlags = object;
|
|
6347
|
+
let flags = sourceWithFlags.__flags || (sourceWithFlags.__flags = /* @__PURE__ */ Object.create(null));
|
|
6348
|
+
const objFlags = objWithFlags.__flags || (objWithFlags.__flags = /* @__PURE__ */ Object.create(null));
|
|
6287
6349
|
includeAll = arguments.length === 3 ? includeAll : true;
|
|
6288
|
-
for (let flag3 in flags) if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message")
|
|
6350
|
+
for (let flag3 in flags) if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") objFlags[flag3] = flags[flag3];
|
|
6289
6351
|
}
|
|
6290
6352
|
__name(transferFlags, "transferFlags");
|
|
6291
6353
|
function type2(obj) {
|
|
@@ -6612,9 +6674,9 @@ var _Assertion = class _Assertion {
|
|
|
6612
6674
|
* - `eql`: This flag contains the deepEqual function to be used by the assertion.
|
|
6613
6675
|
*
|
|
6614
6676
|
* @param {unknown} obj target of the assertion
|
|
6615
|
-
* @param {string}
|
|
6616
|
-
* @param {Function}
|
|
6617
|
-
* @param {boolean}
|
|
6677
|
+
* @param {string=} msg (optional) custom error message
|
|
6678
|
+
* @param {Function=} ssfi (optional) starting point for removing stack frames
|
|
6679
|
+
* @param {boolean=} lockSsfi (optional) whether or not the ssfi flag is locked
|
|
6618
6680
|
*/
|
|
6619
6681
|
constructor(obj, msg, ssfi, lockSsfi) {
|
|
6620
6682
|
/** @type {{}} */
|
|
@@ -6648,44 +6710,44 @@ var _Assertion = class _Assertion {
|
|
|
6648
6710
|
}
|
|
6649
6711
|
/**
|
|
6650
6712
|
* @param {string} name
|
|
6651
|
-
* @param {
|
|
6713
|
+
* @param {(...args: never) => unknown} fn
|
|
6652
6714
|
*/
|
|
6653
6715
|
static addProperty(name, fn) {
|
|
6654
6716
|
addProperty(this.prototype, name, fn);
|
|
6655
6717
|
}
|
|
6656
6718
|
/**
|
|
6657
6719
|
* @param {string} name
|
|
6658
|
-
* @param {
|
|
6720
|
+
* @param {(...args: never) => unknown} fn
|
|
6659
6721
|
*/
|
|
6660
6722
|
static addMethod(name, fn) {
|
|
6661
6723
|
addMethod(this.prototype, name, fn);
|
|
6662
6724
|
}
|
|
6663
6725
|
/**
|
|
6664
6726
|
* @param {string} name
|
|
6665
|
-
* @param {
|
|
6666
|
-
* @param {
|
|
6727
|
+
* @param {(...args: never) => unknown} fn
|
|
6728
|
+
* @param {(...args: never) => unknown} chainingBehavior
|
|
6667
6729
|
*/
|
|
6668
6730
|
static addChainableMethod(name, fn, chainingBehavior) {
|
|
6669
6731
|
addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
6670
6732
|
}
|
|
6671
6733
|
/**
|
|
6672
6734
|
* @param {string} name
|
|
6673
|
-
* @param {
|
|
6735
|
+
* @param {(...args: never) => unknown} fn
|
|
6674
6736
|
*/
|
|
6675
6737
|
static overwriteProperty(name, fn) {
|
|
6676
6738
|
overwriteProperty(this.prototype, name, fn);
|
|
6677
6739
|
}
|
|
6678
6740
|
/**
|
|
6679
6741
|
* @param {string} name
|
|
6680
|
-
* @param {
|
|
6742
|
+
* @param {(...args: never) => unknown} fn
|
|
6681
6743
|
*/
|
|
6682
6744
|
static overwriteMethod(name, fn) {
|
|
6683
6745
|
overwriteMethod(this.prototype, name, fn);
|
|
6684
6746
|
}
|
|
6685
6747
|
/**
|
|
6686
6748
|
* @param {string} name
|
|
6687
|
-
* @param {
|
|
6688
|
-
* @param {
|
|
6749
|
+
* @param {(...args: never) => unknown} fn
|
|
6750
|
+
* @param {(...args: never) => unknown} chainingBehavior
|
|
6689
6751
|
*/
|
|
6690
6752
|
static overwriteChainableMethod(name, fn, chainingBehavior) {
|
|
6691
6753
|
overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
@@ -6742,6 +6804,11 @@ __name(_Assertion, "Assertion");
|
|
|
6742
6804
|
var Assertion = _Assertion;
|
|
6743
6805
|
var events = new EventTarget();
|
|
6744
6806
|
var _PluginEvent = class _PluginEvent extends Event {
|
|
6807
|
+
/**
|
|
6808
|
+
* @param {string} type
|
|
6809
|
+
* @param {string} name
|
|
6810
|
+
* @param {Function} fn
|
|
6811
|
+
*/
|
|
6745
6812
|
constructor(type3, name, fn) {
|
|
6746
6813
|
super(type3);
|
|
6747
6814
|
this.name = String(name);
|
|
@@ -6772,7 +6839,7 @@ function addProperty(ctx, name, getter) {
|
|
|
6772
6839
|
__name(addProperty, "addProperty");
|
|
6773
6840
|
var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {}, "length");
|
|
6774
6841
|
function addLengthGuard(fn, assertionName, isChainable) {
|
|
6775
|
-
if (!fnLengthDesc
|
|
6842
|
+
if (!fnLengthDesc?.configurable) return fn;
|
|
6776
6843
|
Object.defineProperty(fn, "length", { get: /* @__PURE__ */ __name(function() {
|
|
6777
6844
|
if (isChainable) throw Error("Invalid Chai property: " + assertionName + ".length. Due to a compatibility issue, \"length\" cannot directly follow \"" + assertionName + "\". Use \"" + assertionName + ".lengthOf\" instead.");
|
|
6778
6845
|
throw Error("Invalid Chai property: " + assertionName + ".length. See docs for proper usage of \"" + assertionName + "\".");
|
|
@@ -6804,7 +6871,7 @@ function proxify(obj, nonChainableMethodName) {
|
|
|
6804
6871
|
if (!isProxyEnabled()) return obj;
|
|
6805
6872
|
return new Proxy(obj, { get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
|
|
6806
6873
|
if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
|
|
6807
|
-
if (nonChainableMethodName) throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + ". See docs for proper usage of \"" + nonChainableMethodName + "\".");
|
|
6874
|
+
if (nonChainableMethodName) throw Error("Invalid Chai property: " + String(nonChainableMethodName) + "." + property + ". See docs for proper usage of \"" + String(nonChainableMethodName) + "\".");
|
|
6808
6875
|
let suggestion = null;
|
|
6809
6876
|
let suggestionDistance = 4;
|
|
6810
6877
|
getProperties(target).forEach(function(prop) {
|
|
@@ -6860,7 +6927,8 @@ function addMethod(ctx, name, method) {
|
|
|
6860
6927
|
}
|
|
6861
6928
|
__name(addMethod, "addMethod");
|
|
6862
6929
|
function overwriteProperty(ctx, name, getter) {
|
|
6863
|
-
let _get = Object.getOwnPropertyDescriptor(ctx, name)
|
|
6930
|
+
let _get = Object.getOwnPropertyDescriptor(ctx, name);
|
|
6931
|
+
let _super = /* @__PURE__ */ __name(function() {}, "_super");
|
|
6864
6932
|
if (_get && "function" === typeof _get.get) _super = _get.get;
|
|
6865
6933
|
Object.defineProperty(ctx, name, {
|
|
6866
6934
|
get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
|
|
@@ -6879,11 +6947,12 @@ function overwriteProperty(ctx, name, getter) {
|
|
|
6879
6947
|
}
|
|
6880
6948
|
__name(overwriteProperty, "overwriteProperty");
|
|
6881
6949
|
function overwriteMethod(ctx, name, method) {
|
|
6882
|
-
let _method = ctx[name]
|
|
6883
|
-
|
|
6950
|
+
let _method = ctx[name];
|
|
6951
|
+
let _super = /* @__PURE__ */ __name(function() {
|
|
6952
|
+
throw new Error(String(name) + " is not a function");
|
|
6884
6953
|
}, "_super");
|
|
6885
6954
|
if (_method && "function" === typeof _method) _super = _method;
|
|
6886
|
-
|
|
6955
|
+
function overwritingMethodWrapper() {
|
|
6887
6956
|
if (!flag(this, "lockSsfi")) flag(this, "ssfi", overwritingMethodWrapper);
|
|
6888
6957
|
let origLockSsfi = flag(this, "lockSsfi");
|
|
6889
6958
|
flag(this, "lockSsfi", true);
|
|
@@ -6893,8 +6962,9 @@ function overwriteMethod(ctx, name, method) {
|
|
|
6893
6962
|
let newAssertion = new Assertion();
|
|
6894
6963
|
transferFlags(this, newAssertion);
|
|
6895
6964
|
return newAssertion;
|
|
6896
|
-
}
|
|
6897
|
-
|
|
6965
|
+
}
|
|
6966
|
+
__name(overwritingMethodWrapper, "overwritingMethodWrapper");
|
|
6967
|
+
addLengthGuard(overwritingMethodWrapper, String(name), false);
|
|
6898
6968
|
ctx[name] = proxify(overwritingMethodWrapper, name);
|
|
6899
6969
|
}
|
|
6900
6970
|
__name(overwriteMethod, "overwriteMethod");
|
|
@@ -6908,6 +6978,12 @@ var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
|
|
|
6908
6978
|
var call = Function.prototype.call;
|
|
6909
6979
|
var apply = Function.prototype.apply;
|
|
6910
6980
|
var _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent extends PluginEvent {
|
|
6981
|
+
/**
|
|
6982
|
+
* @param {string} type
|
|
6983
|
+
* @param {string} name
|
|
6984
|
+
* @param {Function} fn
|
|
6985
|
+
* @param {Function} chainingBehavior
|
|
6986
|
+
*/
|
|
6911
6987
|
constructor(type3, name, fn, chainingBehavior) {
|
|
6912
6988
|
super(type3, name, fn);
|
|
6913
6989
|
this.chainingBehavior = chainingBehavior;
|
|
@@ -6916,24 +6992,26 @@ var _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent extend
|
|
|
6916
6992
|
__name(_PluginAddChainableMethodEvent, "PluginAddChainableMethodEvent");
|
|
6917
6993
|
var PluginAddChainableMethodEvent = _PluginAddChainableMethodEvent;
|
|
6918
6994
|
function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
6995
|
+
const ctxChainable = ctx;
|
|
6919
6996
|
if (typeof chainingBehavior !== "function") chainingBehavior = /* @__PURE__ */ __name(function() {}, "chainingBehavior");
|
|
6920
6997
|
let chainableBehavior = {
|
|
6921
6998
|
method,
|
|
6922
6999
|
chainingBehavior
|
|
6923
7000
|
};
|
|
6924
|
-
if (!
|
|
6925
|
-
|
|
7001
|
+
if (!ctxChainable.__methods) ctxChainable.__methods = {};
|
|
7002
|
+
ctxChainable.__methods[name] = chainableBehavior;
|
|
6926
7003
|
Object.defineProperty(ctx, name, {
|
|
6927
7004
|
get: /* @__PURE__ */ __name(function chainableMethodGetter() {
|
|
6928
7005
|
chainableBehavior.chainingBehavior.call(this);
|
|
6929
|
-
|
|
7006
|
+
function chainableMethodWrapper(...args) {
|
|
6930
7007
|
if (!flag(this, "lockSsfi")) flag(this, "ssfi", chainableMethodWrapper);
|
|
6931
|
-
let result = chainableBehavior.method.apply(this,
|
|
7008
|
+
let result = chainableBehavior.method.apply(this, args);
|
|
6932
7009
|
if (result !== void 0) return result;
|
|
6933
7010
|
let newAssertion = new Assertion();
|
|
6934
7011
|
transferFlags(this, newAssertion);
|
|
6935
7012
|
return newAssertion;
|
|
6936
|
-
}
|
|
7013
|
+
}
|
|
7014
|
+
__name(chainableMethodWrapper, "chainableMethodWrapper");
|
|
6937
7015
|
addLengthGuard(chainableMethodWrapper, name, true);
|
|
6938
7016
|
if (canSetPrototype) {
|
|
6939
7017
|
let prototype = Object.create(this);
|
|
@@ -6943,7 +7021,7 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
|
6943
7021
|
} else Object.getOwnPropertyNames(ctx).forEach(function(asserterName) {
|
|
6944
7022
|
if (excludeNames.indexOf(asserterName) !== -1) return;
|
|
6945
7023
|
let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
|
6946
|
-
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
|
7024
|
+
if (pd) Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
|
6947
7025
|
});
|
|
6948
7026
|
transferFlags(this, chainableMethodWrapper);
|
|
6949
7027
|
return proxify(chainableMethodWrapper);
|
|
@@ -6980,7 +7058,7 @@ __name(compareByInspect, "compareByInspect");
|
|
|
6980
7058
|
function getOwnEnumerablePropertySymbols(obj) {
|
|
6981
7059
|
if (typeof Object.getOwnPropertySymbols !== "function") return [];
|
|
6982
7060
|
return Object.getOwnPropertySymbols(obj).filter(function(sym) {
|
|
6983
|
-
return Object.getOwnPropertyDescriptor(obj, sym)
|
|
7061
|
+
return Object.getOwnPropertyDescriptor(obj, sym)?.enumerable;
|
|
6984
7062
|
});
|
|
6985
7063
|
}
|
|
6986
7064
|
__name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols");
|
|
@@ -7003,13 +7081,14 @@ function getOperator(obj, args) {
|
|
|
7003
7081
|
let negate = flag(obj, "negate");
|
|
7004
7082
|
let expected = args[3];
|
|
7005
7083
|
let msg = negate ? args[2] : args[1];
|
|
7006
|
-
if (operator) return operator;
|
|
7084
|
+
if (operator) return String(operator);
|
|
7007
7085
|
if (typeof msg === "function") msg = msg();
|
|
7008
7086
|
msg = msg || "";
|
|
7009
7087
|
if (!msg) return;
|
|
7010
|
-
|
|
7088
|
+
const msgString = String(msg);
|
|
7089
|
+
if (/\shave\s/.test(msgString)) return;
|
|
7011
7090
|
let isObject = isObjectType(expected);
|
|
7012
|
-
if (/\snot\s/.test(
|
|
7091
|
+
if (/\snot\s/.test(msgString)) return isObject ? "notDeepStrictEqual" : "notStrictEqual";
|
|
7013
7092
|
return isObject ? "deepStrictEqual" : "strictEqual";
|
|
7014
7093
|
}
|
|
7015
7094
|
__name(getOperator, "getOperator");
|
|
@@ -7513,18 +7592,19 @@ function assertKeys(keys) {
|
|
|
7513
7592
|
if (!keys.length) throw new AssertionError(flagMsg + "keys required", void 0, ssfi);
|
|
7514
7593
|
let len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
|
|
7515
7594
|
if (!any && !all) all = true;
|
|
7516
|
-
|
|
7595
|
+
const uniqueExpected = [...new Set(expected)];
|
|
7596
|
+
if (any) ok = uniqueExpected.some(function(expectedKey) {
|
|
7517
7597
|
return actual.some(function(actualKey) {
|
|
7518
7598
|
return isEql(expectedKey, actualKey);
|
|
7519
7599
|
});
|
|
7520
7600
|
});
|
|
7521
7601
|
if (all) {
|
|
7522
|
-
ok =
|
|
7602
|
+
ok = uniqueExpected.every(function(expectedKey) {
|
|
7523
7603
|
return actual.some(function(actualKey) {
|
|
7524
7604
|
return isEql(expectedKey, actualKey);
|
|
7525
7605
|
});
|
|
7526
7606
|
});
|
|
7527
|
-
if (!flag2(this, "contains")) ok = ok &&
|
|
7607
|
+
if (!flag2(this, "contains")) ok = ok && uniqueExpected.length == actual.length;
|
|
7528
7608
|
}
|
|
7529
7609
|
if (len > 1) {
|
|
7530
7610
|
keys = keys.map(function(key) {
|
|
@@ -7682,28 +7762,32 @@ Assertion.addMethod("members", function(subset, msg) {
|
|
|
7682
7762
|
Assertion.addProperty("iterable", function(msg) {
|
|
7683
7763
|
if (msg) flag2(this, "message", msg);
|
|
7684
7764
|
let obj = flag2(this, "object");
|
|
7685
|
-
this.assert(obj != void 0 && obj[Symbol.iterator], "expected #{this} to be an iterable", "expected #{this} to not be an iterable", obj);
|
|
7765
|
+
this.assert(obj != void 0 && typeof obj[Symbol.iterator] === "function", "expected #{this} to be an iterable", "expected #{this} to not be an iterable", obj);
|
|
7686
7766
|
});
|
|
7687
7767
|
function oneOf(list, msg) {
|
|
7688
7768
|
if (msg) flag2(this, "message", msg);
|
|
7689
7769
|
let expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
|
|
7690
7770
|
new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
|
|
7691
7771
|
if (contains) this.assert(list.some(function(possibility) {
|
|
7692
|
-
return expected.indexOf(possibility) > -1
|
|
7693
|
-
|
|
7772
|
+
return expected.indexOf(possibility) > -1 || isDeep && Array.isArray(expected) && expected.some(function(item) {
|
|
7773
|
+
return eql(item, possibility);
|
|
7774
|
+
});
|
|
7775
|
+
}), "expected #{this} to " + (isDeep ? "deeply " : "") + "contain one of #{exp}", "expected #{this} to not " + (isDeep ? "deeply " : "") + "contain one of #{exp}", list, expected);
|
|
7694
7776
|
else if (isDeep) this.assert(list.some(function(possibility) {
|
|
7695
7777
|
return eql(expected, possibility);
|
|
7696
|
-
}), "expected #{this} to deeply equal one of #{exp}", "expected #{this} to deeply equal one of #{exp}", list, expected);
|
|
7778
|
+
}), "expected #{this} to deeply equal one of #{exp}", "expected #{this} to not deeply equal one of #{exp}", list, expected);
|
|
7697
7779
|
else this.assert(list.indexOf(expected) > -1, "expected #{this} to be one of #{exp}", "expected #{this} to not be one of #{exp}", list, expected);
|
|
7698
7780
|
}
|
|
7699
7781
|
__name(oneOf, "oneOf");
|
|
7700
7782
|
Assertion.addMethod("oneOf", oneOf);
|
|
7701
7783
|
function assertChanges(subject, prop, msg) {
|
|
7702
7784
|
if (msg) flag2(this, "message", msg);
|
|
7703
|
-
|
|
7785
|
+
const fn = flag2(this, "object");
|
|
7786
|
+
const flagMsg = flag2(this, "message");
|
|
7787
|
+
const ssfi = flag2(this, "ssfi");
|
|
7704
7788
|
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
7705
7789
|
let initial;
|
|
7706
|
-
if (
|
|
7790
|
+
if (prop === null || prop === void 0) {
|
|
7707
7791
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
7708
7792
|
initial = subject();
|
|
7709
7793
|
} else {
|
|
@@ -7711,7 +7795,9 @@ function assertChanges(subject, prop, msg) {
|
|
|
7711
7795
|
initial = subject[prop];
|
|
7712
7796
|
}
|
|
7713
7797
|
fn();
|
|
7714
|
-
let final = prop === void 0 || prop === null ? subject() :
|
|
7798
|
+
let final = prop === void 0 || prop === null ? subject() :
|
|
7799
|
+
/** @type {Record<PropertyKey, unknown>} */
|
|
7800
|
+
subject[prop];
|
|
7715
7801
|
let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
7716
7802
|
flag2(this, "deltaMsgObj", msgObj);
|
|
7717
7803
|
flag2(this, "initialDeltaValue", initial);
|
|
@@ -7725,10 +7811,12 @@ Assertion.addMethod("change", assertChanges);
|
|
|
7725
7811
|
Assertion.addMethod("changes", assertChanges);
|
|
7726
7812
|
function assertIncreases(subject, prop, msg) {
|
|
7727
7813
|
if (msg) flag2(this, "message", msg);
|
|
7728
|
-
|
|
7814
|
+
const fn = flag2(this, "object");
|
|
7815
|
+
const flagMsg = flag2(this, "message");
|
|
7816
|
+
const ssfi = flag2(this, "ssfi");
|
|
7729
7817
|
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
7730
7818
|
let initial;
|
|
7731
|
-
if (
|
|
7819
|
+
if (prop === null || prop === void 0) {
|
|
7732
7820
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
7733
7821
|
initial = subject();
|
|
7734
7822
|
} else {
|
|
@@ -7737,7 +7825,9 @@ function assertIncreases(subject, prop, msg) {
|
|
|
7737
7825
|
}
|
|
7738
7826
|
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
7739
7827
|
fn();
|
|
7740
|
-
let final = prop === void 0 || prop === null ? subject() :
|
|
7828
|
+
let final = prop === void 0 || prop === null ? subject() :
|
|
7829
|
+
/** @type {Record<PropertyKey, number>} */
|
|
7830
|
+
subject[prop];
|
|
7741
7831
|
let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
7742
7832
|
flag2(this, "deltaMsgObj", msgObj);
|
|
7743
7833
|
flag2(this, "initialDeltaValue", initial);
|
|
@@ -7751,10 +7841,12 @@ Assertion.addMethod("increase", assertIncreases);
|
|
|
7751
7841
|
Assertion.addMethod("increases", assertIncreases);
|
|
7752
7842
|
function assertDecreases(subject, prop, msg) {
|
|
7753
7843
|
if (msg) flag2(this, "message", msg);
|
|
7754
|
-
|
|
7844
|
+
const fn = flag2(this, "object");
|
|
7845
|
+
const flagMsg = flag2(this, "message");
|
|
7846
|
+
const ssfi = flag2(this, "ssfi");
|
|
7755
7847
|
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
7756
7848
|
let initial;
|
|
7757
|
-
if (
|
|
7849
|
+
if (prop === null || prop === void 0) {
|
|
7758
7850
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
7759
7851
|
initial = subject();
|
|
7760
7852
|
} else {
|
|
@@ -7763,7 +7855,9 @@ function assertDecreases(subject, prop, msg) {
|
|
|
7763
7855
|
}
|
|
7764
7856
|
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
7765
7857
|
fn();
|
|
7766
|
-
let final = prop === void 0 || prop === null ? subject() :
|
|
7858
|
+
let final = prop === void 0 || prop === null ? subject() :
|
|
7859
|
+
/** @type {Record<PropertyKey, number>} */
|
|
7860
|
+
subject[prop];
|
|
7767
7861
|
let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
7768
7862
|
flag2(this, "deltaMsgObj", msgObj);
|
|
7769
7863
|
flag2(this, "initialDeltaValue", initial);
|
|
@@ -7844,12 +7938,12 @@ function expect(val, message) {
|
|
|
7844
7938
|
}
|
|
7845
7939
|
__name(expect, "expect");
|
|
7846
7940
|
expect.fail = function(actual, expected, message, operator) {
|
|
7941
|
+
let msg = message;
|
|
7847
7942
|
if (arguments.length < 2) {
|
|
7848
|
-
|
|
7943
|
+
msg = actual;
|
|
7849
7944
|
actual = void 0;
|
|
7850
7945
|
}
|
|
7851
|
-
|
|
7852
|
-
throw new AssertionError(message, {
|
|
7946
|
+
throw new AssertionError(msg || "expect.fail()", {
|
|
7853
7947
|
actual,
|
|
7854
7948
|
expected,
|
|
7855
7949
|
operator
|
|
@@ -8301,7 +8395,7 @@ assert.oneOf = function(inList, list, msg) {
|
|
|
8301
8395
|
new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
|
|
8302
8396
|
};
|
|
8303
8397
|
assert.isIterable = function(obj, msg) {
|
|
8304
|
-
if (obj == void 0 ||
|
|
8398
|
+
if (obj == void 0 || typeof obj[Symbol.iterator] !== "function") {
|
|
8305
8399
|
msg = msg ? `${msg} expected ${inspect2(obj)} to be an iterable` : `expected ${inspect2(obj)} to be an iterable`;
|
|
8306
8400
|
throw new AssertionError(msg, void 0, assert.isIterable);
|
|
8307
8401
|
}
|
|
@@ -8495,7 +8589,7 @@ function use(fn) {
|
|
|
8495
8589
|
}
|
|
8496
8590
|
__name(use, "use");
|
|
8497
8591
|
//#endregion
|
|
8498
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
8592
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/plugins.DPQHVT0p.js
|
|
8499
8593
|
const serialize$1 = (val, config, indentation, depth, refs, printer) => {
|
|
8500
8594
|
const name = val.getMockName();
|
|
8501
8595
|
const nameString = name === "vi.fn()" ? "" : ` ${name}`;
|
|
@@ -8528,7 +8622,7 @@ function getSerializers() {
|
|
|
8528
8622
|
return PLUGINS;
|
|
8529
8623
|
}
|
|
8530
8624
|
//#endregion
|
|
8531
|
-
//#region ../../node_modules/.pnpm/vitest@5.
|
|
8625
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/offset.Dy-5Fdfn.js
|
|
8532
8626
|
const lineSplitRE = /\r?\n/;
|
|
8533
8627
|
function positionToOffset(source, lineNumber, columnNumber) {
|
|
8534
8628
|
const lines = source.split(lineSplitRE);
|
|
@@ -8551,150 +8645,8 @@ function offsetToLineNumber(source, offset) {
|
|
|
8551
8645
|
}
|
|
8552
8646
|
return line + 1;
|
|
8553
8647
|
}
|
|
8554
|
-
Object.freeze(() => {});
|
|
8555
|
-
globalThis.Event;
|
|
8556
|
-
function r(e = globalThis) {
|
|
8557
|
-
let t = "unknown", n = "unknown";
|
|
8558
|
-
return e.Bun || e.process && e.process.versions?.bun ? (t = "bun", n = e.Bun.version || "unknown") : e.Deno ? (t = "deno", n = e.Deno.version?.deno ?? "unknown") : e.process && e.process.release?.name === "node" ? (t = "node", n = e.process.versions?.node ?? "unknown") : e.HermesInternal ? (t = "hermes", n = e.HermesInternal.getRuntimeProperties?.()["OSS Release Version"] ?? "unknown") : i(e) && e.navigator.userAgent === "Cloudflare-Workers" ? t = "workerd" : i(e) && e.navigator.userAgent.toLowerCase().startsWith("quickjs-ng") ? (t = "quickjs-ng", n = e.navigator.userAgent.split("/")[1] ?? "unknown") : typeof e.Netlify == "object" ? t = "netlify" : typeof e.EdgeRuntime == "string" ? t = "edge-light" : e.__lagon__ ? t = "lagon" : e.fastly ? t = "fastly" : e.$262 && e.lockdown && e.AsyncDisposableStack ? t = "moddable" : e.d8 ? (t = "v8", n = typeof e.version == "function" ? e.version() : "unknown") : e.inIon && e.performance && e.performance.mozMemory ? t = "spidermonkey" : typeof e.$ == "object" && e.$ !== null && "IsHTMLDDA" in e.$ ? t = "jsc" : e.window && e.navigator && (t = "browser"), {
|
|
8559
|
-
runtime: t,
|
|
8560
|
-
version: n
|
|
8561
|
-
};
|
|
8562
|
-
}
|
|
8563
|
-
function i(e = globalThis) {
|
|
8564
|
-
return typeof e.navigator == "object" && e.navigator !== null && typeof e.navigator.userAgent == "string";
|
|
8565
|
-
}
|
|
8566
|
-
const { runtime: a, version: o } = r();
|
|
8567
|
-
(async () => {}).constructor;
|
|
8568
|
-
globalThis.performance.now.bind(globalThis.performance);
|
|
8569
|
-
globalThis.process?.hrtime?.bigint.bind(globalThis.process?.hrtime);
|
|
8570
|
-
globalThis.Bun?.nanoseconds;
|
|
8571
|
-
//#endregion
|
|
8572
|
-
//#region ../../node_modules/.pnpm/expect-type@1.4.0/node_modules/expect-type/dist/branding.js
|
|
8573
|
-
var require_branding = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8574
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8575
|
-
}));
|
|
8576
|
-
//#endregion
|
|
8577
|
-
//#region ../../node_modules/.pnpm/expect-type@1.4.0/node_modules/expect-type/dist/messages.js
|
|
8578
|
-
var require_messages = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8579
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8580
|
-
}));
|
|
8581
8648
|
//#endregion
|
|
8582
|
-
//#region ../../node_modules/.pnpm/
|
|
8583
|
-
var require_overloads = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8584
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8585
|
-
}));
|
|
8586
|
-
//#endregion
|
|
8587
|
-
//#region ../../node_modules/.pnpm/expect-type@1.4.0/node_modules/expect-type/dist/utils.js
|
|
8588
|
-
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8589
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8590
|
-
}));
|
|
8591
|
-
(/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8592
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
8593
|
-
if (k2 === void 0) k2 = k;
|
|
8594
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8595
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
8596
|
-
enumerable: true,
|
|
8597
|
-
get: function() {
|
|
8598
|
-
return m[k];
|
|
8599
|
-
}
|
|
8600
|
-
};
|
|
8601
|
-
Object.defineProperty(o, k2, desc);
|
|
8602
|
-
}) : (function(o, m, k, k2) {
|
|
8603
|
-
if (k2 === void 0) k2 = k;
|
|
8604
|
-
o[k2] = m[k];
|
|
8605
|
-
}));
|
|
8606
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
|
|
8607
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
|
|
8608
|
-
};
|
|
8609
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8610
|
-
exports.expectTypeOf = void 0;
|
|
8611
|
-
__exportStar(require_branding(), exports);
|
|
8612
|
-
__exportStar(require_messages(), exports);
|
|
8613
|
-
__exportStar(require_overloads(), exports);
|
|
8614
|
-
__exportStar(require_utils(), exports);
|
|
8615
|
-
const fn = () => true;
|
|
8616
|
-
/**
|
|
8617
|
-
* Similar to Jest's `expect`, but with type-awareness.
|
|
8618
|
-
* Gives you access to a number of type-matchers that let you make assertions about the
|
|
8619
|
-
* form of a reference or generic type parameter.
|
|
8620
|
-
*
|
|
8621
|
-
* @example
|
|
8622
|
-
* ```ts
|
|
8623
|
-
* import { foo, bar } from '../foo'
|
|
8624
|
-
* import { expectTypeOf } from 'expect-type'
|
|
8625
|
-
*
|
|
8626
|
-
* test('foo types', () => {
|
|
8627
|
-
* // make sure `foo` has type { a: number }
|
|
8628
|
-
* expectTypeOf(foo).toMatchTypeOf({ a: 1 })
|
|
8629
|
-
* expectTypeOf(foo).toHaveProperty('a').toBeNumber()
|
|
8630
|
-
*
|
|
8631
|
-
* // make sure `bar` is a function taking a string:
|
|
8632
|
-
* expectTypeOf(bar).parameter(0).toBeString()
|
|
8633
|
-
* expectTypeOf(bar).returns.not.toBeAny()
|
|
8634
|
-
* })
|
|
8635
|
-
* ```
|
|
8636
|
-
*
|
|
8637
|
-
* @description
|
|
8638
|
-
* See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
|
|
8639
|
-
*/
|
|
8640
|
-
const expectTypeOf = (_actual) => {
|
|
8641
|
-
const nonFunctionProperties = [
|
|
8642
|
-
"parameters",
|
|
8643
|
-
"returns",
|
|
8644
|
-
"resolves",
|
|
8645
|
-
"not",
|
|
8646
|
-
"items",
|
|
8647
|
-
"constructorParameters",
|
|
8648
|
-
"thisParameter",
|
|
8649
|
-
"instance",
|
|
8650
|
-
"guards",
|
|
8651
|
-
"asserts"
|
|
8652
|
-
];
|
|
8653
|
-
function createBranded() {
|
|
8654
|
-
return {
|
|
8655
|
-
inspect: () => true,
|
|
8656
|
-
configure: () => createBranded(),
|
|
8657
|
-
toEqualTypeOf: fn
|
|
8658
|
-
};
|
|
8659
|
-
}
|
|
8660
|
-
const obj = {
|
|
8661
|
-
toBeAny: fn,
|
|
8662
|
-
toBeUnknown: fn,
|
|
8663
|
-
toBeNever: fn,
|
|
8664
|
-
toBeFunction: fn,
|
|
8665
|
-
toBeObject: fn,
|
|
8666
|
-
toBeArray: fn,
|
|
8667
|
-
toBeString: fn,
|
|
8668
|
-
toBeNumber: fn,
|
|
8669
|
-
toBeBoolean: fn,
|
|
8670
|
-
toBeVoid: fn,
|
|
8671
|
-
toBeSymbol: fn,
|
|
8672
|
-
toBeNull: fn,
|
|
8673
|
-
toBeUndefined: fn,
|
|
8674
|
-
toBeNullable: fn,
|
|
8675
|
-
toBeBigInt: fn,
|
|
8676
|
-
toMatchTypeOf: fn,
|
|
8677
|
-
toEqualTypeOf: fn,
|
|
8678
|
-
toBeConstructibleWith: fn,
|
|
8679
|
-
toMatchObjectType: fn,
|
|
8680
|
-
toExtend: fn,
|
|
8681
|
-
map: exports.expectTypeOf,
|
|
8682
|
-
toBeCallableWith: exports.expectTypeOf,
|
|
8683
|
-
extract: exports.expectTypeOf,
|
|
8684
|
-
exclude: exports.expectTypeOf,
|
|
8685
|
-
pick: exports.expectTypeOf,
|
|
8686
|
-
omit: exports.expectTypeOf,
|
|
8687
|
-
toHaveProperty: exports.expectTypeOf,
|
|
8688
|
-
parameter: exports.expectTypeOf,
|
|
8689
|
-
get branded() {
|
|
8690
|
-
return createBranded();
|
|
8691
|
-
}
|
|
8692
|
-
};
|
|
8693
|
-
nonFunctionProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
|
|
8694
|
-
return obj;
|
|
8695
|
-
};
|
|
8696
|
-
exports.expectTypeOf = expectTypeOf;
|
|
8697
|
-
})))();
|
|
8649
|
+
//#region ../../node_modules/.pnpm/vitest@5.1.0_@types+node@26.6.5_@vitest+coverage-v8@5.0.4_vite@8.2.2_@types+node@26.6.5_4fc92309849883ad11a836cad05c50d8/node_modules/vitest/dist/chunks/rawSnapshot.DqSiqIEx.js
|
|
8698
8650
|
var naturalCompare$1 = { exports: {} };
|
|
8699
8651
|
var hasRequiredNaturalCompare;
|
|
8700
8652
|
function requireNaturalCompare() {
|
|
@@ -8771,7 +8723,7 @@ function serialize(val, indent = 2, formatOverrides = {}) {
|
|
|
8771
8723
|
}));
|
|
8772
8724
|
}
|
|
8773
8725
|
function escapeBacktickString(str) {
|
|
8774
|
-
return str.replace(/`|\\|\$\{/g, "\\$&");
|
|
8726
|
+
return str.replace(/`|\\|\$\{/g, "\\$&").replace(/\r/g, "\\r");
|
|
8775
8727
|
}
|
|
8776
8728
|
function printBacktickString(str) {
|
|
8777
8729
|
return `\`${escapeBacktickString(str)}\``;
|
|
@@ -8812,9 +8764,10 @@ function deepMergeSnapshot(target, source) {
|
|
|
8812
8764
|
if (isObject(target) && isObject(source)) {
|
|
8813
8765
|
const mergedOutput = { ...target };
|
|
8814
8766
|
Object.keys(source).forEach((key) => {
|
|
8815
|
-
if (isObject(source[key]) && !source[key].$$typeof)
|
|
8816
|
-
|
|
8817
|
-
|
|
8767
|
+
if (isObject(source[key]) && !source[key].$$typeof) {
|
|
8768
|
+
if (!(key in target)) Object.assign(mergedOutput, { [key]: source[key] });
|
|
8769
|
+
else mergedOutput[key] = deepMergeSnapshot(target[key], source[key]);
|
|
8770
|
+
} else if (Array.isArray(source[key])) mergedOutput[key] = deepMergeArray(target[key], source[key]);
|
|
8818
8771
|
else Object.assign(mergedOutput, { [key]: source[key] });
|
|
8819
8772
|
});
|
|
8820
8773
|
return mergedOutput;
|
|
@@ -8860,7 +8813,7 @@ function memo(fn) {
|
|
|
8860
8813
|
};
|
|
8861
8814
|
}
|
|
8862
8815
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
8863
|
-
const MagicString = (await Promise.resolve().then(() => require("./dist-
|
|
8816
|
+
const MagicString = (await Promise.resolve().then(() => require("./dist-DO_3oafK.cjs"))).default;
|
|
8864
8817
|
const files = new Set(snapshots.map((i) => i.file));
|
|
8865
8818
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
8866
8819
|
const snaps = snapshots.filter((i) => i.file === file);
|
|
@@ -8972,6 +8925,159 @@ async function saveRawSnapshots(environment, snapshots) {
|
|
|
8972
8925
|
if (!snap.readonly) await environment.saveSnapshotFile(snap.file, snap.snapshot);
|
|
8973
8926
|
}));
|
|
8974
8927
|
}
|
|
8928
|
+
Object.freeze(() => {});
|
|
8929
|
+
globalThis.Event;
|
|
8930
|
+
(async () => {}).constructor;
|
|
8931
|
+
function p(e = globalThis) {
|
|
8932
|
+
let t = "unknown", n = "unknown";
|
|
8933
|
+
if (e.Bun || e.process && e.process.versions?.bun) {
|
|
8934
|
+
t = "bun";
|
|
8935
|
+
let r = e.Bun?.version;
|
|
8936
|
+
if (r) n = r;
|
|
8937
|
+
else {
|
|
8938
|
+
let t = e.process?.versions?.bun;
|
|
8939
|
+
t && (n = t);
|
|
8940
|
+
}
|
|
8941
|
+
} else e.Deno ? (t = "deno", n = e.Deno.version?.deno ?? "unknown") : e.process && e.process.release?.name === "node" ? (t = "node", n = e.process.versions?.node ?? "unknown") : e.HermesInternal ? (t = "hermes", n = e.HermesInternal.getRuntimeProperties?.()["OSS Release Version"] ?? "unknown") : m(e) && e.navigator.userAgent === "Cloudflare-Workers" ? t = "workerd" : m(e) && e.navigator.userAgent.toLowerCase().startsWith("quickjs-ng") ? (t = "quickjs-ng", n = e.navigator.userAgent.split("/")[1] ?? "unknown") : typeof e.Netlify == "object" ? t = "netlify" : typeof e.EdgeRuntime == "string" ? t = "edge-light" : e.__lagon__ ? t = "lagon" : e.fastly ? t = "fastly" : e.$262 && e.lockdown && e.AsyncDisposableStack ? t = "moddable" : e.d8 ? (t = "v8", n = typeof e.version == "function" ? e.version() : "unknown") : e.inIon && e.performance && e.performance.mozMemory ? t = "spidermonkey" : typeof e.$ == "object" && e.$ !== null && "IsHTMLDDA" in e.$ ? t = "jsc" : e.window && e.navigator && (t = "browser");
|
|
8942
|
+
return {
|
|
8943
|
+
runtime: t,
|
|
8944
|
+
version: n
|
|
8945
|
+
};
|
|
8946
|
+
}
|
|
8947
|
+
function m(e = globalThis) {
|
|
8948
|
+
return typeof e.navigator == "object" && e.navigator !== null && typeof e.navigator.userAgent == "string";
|
|
8949
|
+
}
|
|
8950
|
+
const { runtime: h, version: g } = p();
|
|
8951
|
+
globalThis.performance.now.bind(globalThis.performance);
|
|
8952
|
+
globalThis.process?.hrtime?.bigint.bind(globalThis.process?.hrtime);
|
|
8953
|
+
globalThis.Bun?.nanoseconds;
|
|
8954
|
+
//#endregion
|
|
8955
|
+
//#region ../../node_modules/.pnpm/expect-type@1.4.0/node_modules/expect-type/dist/branding.js
|
|
8956
|
+
var require_branding = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8957
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8958
|
+
}));
|
|
8959
|
+
//#endregion
|
|
8960
|
+
//#region ../../node_modules/.pnpm/expect-type@1.4.0/node_modules/expect-type/dist/messages.js
|
|
8961
|
+
var require_messages = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8962
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8963
|
+
}));
|
|
8964
|
+
//#endregion
|
|
8965
|
+
//#region ../../node_modules/.pnpm/expect-type@1.4.0/node_modules/expect-type/dist/overloads.js
|
|
8966
|
+
var require_overloads = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8967
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8968
|
+
}));
|
|
8969
|
+
//#endregion
|
|
8970
|
+
//#region ../../node_modules/.pnpm/expect-type@1.4.0/node_modules/expect-type/dist/utils.js
|
|
8971
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8972
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8973
|
+
}));
|
|
8974
|
+
(/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8975
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
8976
|
+
if (k2 === void 0) k2 = k;
|
|
8977
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8978
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
8979
|
+
enumerable: true,
|
|
8980
|
+
get: function() {
|
|
8981
|
+
return m[k];
|
|
8982
|
+
}
|
|
8983
|
+
};
|
|
8984
|
+
Object.defineProperty(o, k2, desc);
|
|
8985
|
+
}) : (function(o, m, k, k2) {
|
|
8986
|
+
if (k2 === void 0) k2 = k;
|
|
8987
|
+
o[k2] = m[k];
|
|
8988
|
+
}));
|
|
8989
|
+
var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
|
|
8990
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
|
|
8991
|
+
};
|
|
8992
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8993
|
+
exports.expectTypeOf = void 0;
|
|
8994
|
+
__exportStar(require_branding(), exports);
|
|
8995
|
+
__exportStar(require_messages(), exports);
|
|
8996
|
+
__exportStar(require_overloads(), exports);
|
|
8997
|
+
__exportStar(require_utils(), exports);
|
|
8998
|
+
const fn = () => true;
|
|
8999
|
+
/**
|
|
9000
|
+
* Similar to Jest's `expect`, but with type-awareness.
|
|
9001
|
+
* Gives you access to a number of type-matchers that let you make assertions about the
|
|
9002
|
+
* form of a reference or generic type parameter.
|
|
9003
|
+
*
|
|
9004
|
+
* @example
|
|
9005
|
+
* ```ts
|
|
9006
|
+
* import { foo, bar } from '../foo'
|
|
9007
|
+
* import { expectTypeOf } from 'expect-type'
|
|
9008
|
+
*
|
|
9009
|
+
* test('foo types', () => {
|
|
9010
|
+
* // make sure `foo` has type { a: number }
|
|
9011
|
+
* expectTypeOf(foo).toMatchTypeOf({ a: 1 })
|
|
9012
|
+
* expectTypeOf(foo).toHaveProperty('a').toBeNumber()
|
|
9013
|
+
*
|
|
9014
|
+
* // make sure `bar` is a function taking a string:
|
|
9015
|
+
* expectTypeOf(bar).parameter(0).toBeString()
|
|
9016
|
+
* expectTypeOf(bar).returns.not.toBeAny()
|
|
9017
|
+
* })
|
|
9018
|
+
* ```
|
|
9019
|
+
*
|
|
9020
|
+
* @description
|
|
9021
|
+
* See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
|
|
9022
|
+
*/
|
|
9023
|
+
const expectTypeOf = (_actual) => {
|
|
9024
|
+
const nonFunctionProperties = [
|
|
9025
|
+
"parameters",
|
|
9026
|
+
"returns",
|
|
9027
|
+
"resolves",
|
|
9028
|
+
"not",
|
|
9029
|
+
"items",
|
|
9030
|
+
"constructorParameters",
|
|
9031
|
+
"thisParameter",
|
|
9032
|
+
"instance",
|
|
9033
|
+
"guards",
|
|
9034
|
+
"asserts"
|
|
9035
|
+
];
|
|
9036
|
+
function createBranded() {
|
|
9037
|
+
return {
|
|
9038
|
+
inspect: () => true,
|
|
9039
|
+
configure: () => createBranded(),
|
|
9040
|
+
toEqualTypeOf: fn
|
|
9041
|
+
};
|
|
9042
|
+
}
|
|
9043
|
+
const obj = {
|
|
9044
|
+
toBeAny: fn,
|
|
9045
|
+
toBeUnknown: fn,
|
|
9046
|
+
toBeNever: fn,
|
|
9047
|
+
toBeFunction: fn,
|
|
9048
|
+
toBeObject: fn,
|
|
9049
|
+
toBeArray: fn,
|
|
9050
|
+
toBeString: fn,
|
|
9051
|
+
toBeNumber: fn,
|
|
9052
|
+
toBeBoolean: fn,
|
|
9053
|
+
toBeVoid: fn,
|
|
9054
|
+
toBeSymbol: fn,
|
|
9055
|
+
toBeNull: fn,
|
|
9056
|
+
toBeUndefined: fn,
|
|
9057
|
+
toBeNullable: fn,
|
|
9058
|
+
toBeBigInt: fn,
|
|
9059
|
+
toMatchTypeOf: fn,
|
|
9060
|
+
toEqualTypeOf: fn,
|
|
9061
|
+
toBeConstructibleWith: fn,
|
|
9062
|
+
toMatchObjectType: fn,
|
|
9063
|
+
toExtend: fn,
|
|
9064
|
+
map: exports.expectTypeOf,
|
|
9065
|
+
toBeCallableWith: exports.expectTypeOf,
|
|
9066
|
+
extract: exports.expectTypeOf,
|
|
9067
|
+
exclude: exports.expectTypeOf,
|
|
9068
|
+
pick: exports.expectTypeOf,
|
|
9069
|
+
omit: exports.expectTypeOf,
|
|
9070
|
+
toHaveProperty: exports.expectTypeOf,
|
|
9071
|
+
parameter: exports.expectTypeOf,
|
|
9072
|
+
get branded() {
|
|
9073
|
+
return createBranded();
|
|
9074
|
+
}
|
|
9075
|
+
};
|
|
9076
|
+
nonFunctionProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
|
|
9077
|
+
return obj;
|
|
9078
|
+
};
|
|
9079
|
+
exports.expectTypeOf = expectTypeOf;
|
|
9080
|
+
})))();
|
|
8975
9081
|
function isSameStackPosition(x, y) {
|
|
8976
9082
|
return x.file === y.file && x.column === y.column && x.line === y.line;
|
|
8977
9083
|
}
|
|
@@ -8987,6 +9093,7 @@ var SnapshotState = class SnapshotState {
|
|
|
8987
9093
|
_inlineSnapshotStacks;
|
|
8988
9094
|
_testIdToKeys = new DefaultMap(() => []);
|
|
8989
9095
|
_rawSnapshots;
|
|
9096
|
+
_rawSnapshotFiles = /* @__PURE__ */ new Set();
|
|
8990
9097
|
_uncheckedKeys;
|
|
8991
9098
|
_snapshotFormat;
|
|
8992
9099
|
_environment;
|
|
@@ -9149,17 +9256,18 @@ var SnapshotState = class SnapshotState {
|
|
|
9149
9256
|
}
|
|
9150
9257
|
_reconcile(opts) {
|
|
9151
9258
|
if (opts.hasSnapshot && this._updateSnapshot === "all" || (!opts.hasSnapshot || !opts.snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
|
|
9152
|
-
if (this._updateSnapshot === "all")
|
|
9153
|
-
if (opts.
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9259
|
+
if (this._updateSnapshot === "all") {
|
|
9260
|
+
if (!opts.pass) {
|
|
9261
|
+
if (opts.hasSnapshot) this.updated.increment(opts.testId);
|
|
9262
|
+
else this.added.increment(opts.testId);
|
|
9263
|
+
this._addSnapshot(opts.key, opts.addValue, {
|
|
9264
|
+
stack: opts.stack,
|
|
9265
|
+
testId: opts.testId,
|
|
9266
|
+
rawSnapshot: opts.rawSnapshot,
|
|
9267
|
+
assertionName: opts.assertionName
|
|
9268
|
+
});
|
|
9269
|
+
} else this.matched.increment(opts.testId);
|
|
9270
|
+
} else {
|
|
9163
9271
|
this._addSnapshot(opts.key, opts.addValue, {
|
|
9164
9272
|
stack: opts.stack,
|
|
9165
9273
|
testId: opts.testId,
|
|
@@ -9182,7 +9290,8 @@ var SnapshotState = class SnapshotState {
|
|
|
9182
9290
|
count: opts.count,
|
|
9183
9291
|
expected: opts.expectedDisplay,
|
|
9184
9292
|
key: opts.key,
|
|
9185
|
-
pass: false
|
|
9293
|
+
pass: false,
|
|
9294
|
+
update: this._createUpdate(opts)
|
|
9186
9295
|
};
|
|
9187
9296
|
} else {
|
|
9188
9297
|
this.matched.increment(opts.testId);
|
|
@@ -9195,6 +9304,29 @@ var SnapshotState = class SnapshotState {
|
|
|
9195
9304
|
};
|
|
9196
9305
|
}
|
|
9197
9306
|
}
|
|
9307
|
+
_createUpdate(opts) {
|
|
9308
|
+
if (opts.stack) return {
|
|
9309
|
+
type: "inline",
|
|
9310
|
+
file: opts.stack.file,
|
|
9311
|
+
line: opts.stack.line,
|
|
9312
|
+
column: opts.stack.column,
|
|
9313
|
+
snapshot: opts.addValue,
|
|
9314
|
+
testId: opts.testId,
|
|
9315
|
+
assertionName: opts.assertionName
|
|
9316
|
+
};
|
|
9317
|
+
if (opts.rawSnapshot) return {
|
|
9318
|
+
type: "raw",
|
|
9319
|
+
file: opts.rawSnapshot.file,
|
|
9320
|
+
readonly: opts.rawSnapshot.readonly,
|
|
9321
|
+
snapshot: opts.addValue
|
|
9322
|
+
};
|
|
9323
|
+
return {
|
|
9324
|
+
type: "file",
|
|
9325
|
+
file: this.snapshotPath,
|
|
9326
|
+
key: opts.key,
|
|
9327
|
+
snapshot: opts.addValue
|
|
9328
|
+
};
|
|
9329
|
+
}
|
|
9198
9330
|
async save() {
|
|
9199
9331
|
const hasExternalSnapshots = Object.keys(this._snapshotData).length;
|
|
9200
9332
|
const hasInlineSnapshots = this._inlineSnapshots.length;
|
|
@@ -9256,6 +9388,7 @@ var SnapshotState = class SnapshotState {
|
|
|
9256
9388
|
let receivedSerialized = rawSnapshot && typeof received === "string" ? received : serialize(received, void 0, this._snapshotFormat);
|
|
9257
9389
|
if (!rawSnapshot) receivedSerialized = addExtraLineBreaks(receivedSerialized);
|
|
9258
9390
|
if (rawSnapshot) {
|
|
9391
|
+
this._rawSnapshotFiles.add(rawSnapshot.file);
|
|
9259
9392
|
if (rawSnapshot.content && /\r\n/.test(rawSnapshot.content) && !/\r\n/.test(receivedSerialized)) rawSnapshot.content = normalizeNewlines(rawSnapshot.content);
|
|
9260
9393
|
}
|
|
9261
9394
|
const expected = isInline ? inlineSnapshot : rawSnapshot ? rawSnapshot.content : this._snapshotData[key];
|
|
@@ -9308,6 +9441,14 @@ var SnapshotState = class SnapshotState {
|
|
|
9308
9441
|
assertionName
|
|
9309
9442
|
});
|
|
9310
9443
|
}
|
|
9444
|
+
/**
|
|
9445
|
+
* The snapshot file, if the test file stores snapshots in it, and every asserted file snapshot.
|
|
9446
|
+
*/
|
|
9447
|
+
getSnapshotFiles() {
|
|
9448
|
+
const files = Array.from(this._rawSnapshotFiles);
|
|
9449
|
+
if (this._fileExists || Object.keys(this._snapshotData).length) files.unshift(this.snapshotPath);
|
|
9450
|
+
return files;
|
|
9451
|
+
}
|
|
9311
9452
|
async pack() {
|
|
9312
9453
|
const snapshot = {
|
|
9313
9454
|
filepath: this.testFilePath,
|
|
@@ -9412,7 +9553,7 @@ var SnapshotClient = class {
|
|
|
9412
9553
|
}
|
|
9413
9554
|
received = deepMergeSnapshot(received, properties);
|
|
9414
9555
|
}
|
|
9415
|
-
const { actual, expected, key, pass } = snapshotState.match({
|
|
9556
|
+
const { actual, expected, key, pass, update } = snapshotState.match({
|
|
9416
9557
|
testId,
|
|
9417
9558
|
testName,
|
|
9418
9559
|
received,
|
|
@@ -9426,7 +9567,8 @@ var SnapshotClient = class {
|
|
|
9426
9567
|
pass,
|
|
9427
9568
|
message: () => `Snapshot \`${key || "unknown"}\` mismatched`,
|
|
9428
9569
|
actual: rawSnapshot ? actual : actual?.trim(),
|
|
9429
|
-
expected: rawSnapshot ? expected : expected?.trim()
|
|
9570
|
+
expected: rawSnapshot ? expected : expected?.trim(),
|
|
9571
|
+
meta: createMatchMeta(key, update)
|
|
9430
9572
|
};
|
|
9431
9573
|
}
|
|
9432
9574
|
assert(options) {
|
|
@@ -9437,7 +9579,7 @@ var SnapshotClient = class {
|
|
|
9437
9579
|
}
|
|
9438
9580
|
}
|
|
9439
9581
|
matchDomain(options) {
|
|
9440
|
-
const { received, filepath, name, testId = name, message, adapter, isInline = false, inlineSnapshot, error } = options;
|
|
9582
|
+
const { received, filepath, name, testId = name, message, adapter, isInline = false, inlineSnapshot, error, assertionName } = options;
|
|
9441
9583
|
if (!filepath) throw new Error("Snapshot cannot be used outside of test");
|
|
9442
9584
|
const captured = adapter.capture(received);
|
|
9443
9585
|
const rendered = adapter.render(captured);
|
|
@@ -9451,24 +9593,25 @@ var SnapshotClient = class {
|
|
|
9451
9593
|
});
|
|
9452
9594
|
expectedSnapshot.markAsChecked();
|
|
9453
9595
|
const matchResult = expectedSnapshot.data !== void 0 ? adapter.match(captured, adapter.parseExpected(expectedSnapshot.data)) : void 0;
|
|
9454
|
-
const { actual, expected, key, pass } = snapshotState.processDomainSnapshot({
|
|
9596
|
+
const { actual, expected, key, pass, update } = snapshotState.processDomainSnapshot({
|
|
9455
9597
|
testId,
|
|
9456
9598
|
received: rendered,
|
|
9457
9599
|
expectedSnapshot,
|
|
9458
9600
|
matchResult,
|
|
9459
9601
|
isInline,
|
|
9460
9602
|
error,
|
|
9461
|
-
assertionName
|
|
9603
|
+
assertionName
|
|
9462
9604
|
});
|
|
9463
9605
|
return {
|
|
9464
9606
|
pass,
|
|
9465
9607
|
message: () => `Snapshot \`${key}\` mismatched`,
|
|
9466
9608
|
actual: actual?.trim(),
|
|
9467
|
-
expected: expected?.trim()
|
|
9609
|
+
expected: expected?.trim(),
|
|
9610
|
+
meta: createMatchMeta(key, update)
|
|
9468
9611
|
};
|
|
9469
9612
|
}
|
|
9470
9613
|
async pollMatchDomain(options) {
|
|
9471
|
-
const { poll, filepath, name, testId = name, message, adapter, isInline = false, inlineSnapshot, error, timeout = 1e3, interval = 50 } = options;
|
|
9614
|
+
const { poll, filepath, name, testId = name, message, adapter, isInline = false, inlineSnapshot, error, timeout = 1e3, interval = 50, assertionName } = options;
|
|
9472
9615
|
if (!filepath) throw new Error("Snapshot cannot be used outside of test");
|
|
9473
9616
|
const snapshotState = this.getSnapshotState(filepath);
|
|
9474
9617
|
const testName = [name, ...message ? [message] : []].join(" > ");
|
|
@@ -9499,20 +9642,21 @@ var SnapshotClient = class {
|
|
|
9499
9642
|
};
|
|
9500
9643
|
}
|
|
9501
9644
|
const matchResult = expectedSnapshot.data !== void 0 ? adapter.match(stableResult.captured, adapter.parseExpected(expectedSnapshot.data)) : void 0;
|
|
9502
|
-
const { actual, expected, key, pass } = snapshotState.processDomainSnapshot({
|
|
9645
|
+
const { actual, expected, key, pass, update } = snapshotState.processDomainSnapshot({
|
|
9503
9646
|
testId,
|
|
9504
9647
|
received: stableResult.rendered,
|
|
9505
9648
|
expectedSnapshot,
|
|
9506
9649
|
matchResult,
|
|
9507
9650
|
isInline,
|
|
9508
9651
|
error,
|
|
9509
|
-
assertionName
|
|
9652
|
+
assertionName
|
|
9510
9653
|
});
|
|
9511
9654
|
return {
|
|
9512
9655
|
pass,
|
|
9513
9656
|
message: () => `Snapshot \`${key}\` mismatched`,
|
|
9514
9657
|
actual: actual?.trim(),
|
|
9515
|
-
expected: expected?.trim()
|
|
9658
|
+
expected: expected?.trim(),
|
|
9659
|
+
meta: createMatchMeta(key, update)
|
|
9516
9660
|
};
|
|
9517
9661
|
}
|
|
9518
9662
|
async assertRaw(options) {
|
|
@@ -9585,6 +9729,13 @@ function raceWith$1(promise, other) {
|
|
|
9585
9729
|
value
|
|
9586
9730
|
}))]);
|
|
9587
9731
|
}
|
|
9732
|
+
function createMatchMeta(key, update) {
|
|
9733
|
+
return update && {
|
|
9734
|
+
type: "snapshot",
|
|
9735
|
+
key,
|
|
9736
|
+
update
|
|
9737
|
+
};
|
|
9738
|
+
}
|
|
9588
9739
|
const ChaiStyleAssertions = (chai, utils) => {
|
|
9589
9740
|
function defProperty(name, delegateTo) {
|
|
9590
9741
|
utils.addProperty(chai.Assertion.prototype, name, function() {
|
|
@@ -9616,7 +9767,7 @@ const ChaiStyleAssertions = (chai, utils) => {
|
|
|
9616
9767
|
defMethod("calledOnceWith", "toHaveBeenCalledExactlyOnceWith");
|
|
9617
9768
|
defMethod("lastCalledWith", "toHaveBeenLastCalledWith");
|
|
9618
9769
|
defMethod("nthCalledWith", "toHaveBeenNthCalledWith");
|
|
9619
|
-
defMethod("returned", "
|
|
9770
|
+
defMethod("returned", "toHaveReturnedWith");
|
|
9620
9771
|
defMethod("returnedWith", "toHaveReturnedWith");
|
|
9621
9772
|
defMethod("returnedTimes", "toHaveReturnedTimes");
|
|
9622
9773
|
defMethod("lastReturnedWith", "toHaveLastReturnedWith");
|
|
@@ -9652,10 +9803,11 @@ ${printReceived(actual)}`
|
|
|
9652
9803
|
},
|
|
9653
9804
|
toBeOneOf(actual, expected) {
|
|
9654
9805
|
const { equals, customTesters } = this;
|
|
9655
|
-
const { printReceived, printExpected, matcherHint } = this.utils;
|
|
9806
|
+
const { printReceived, printExpected, matcherHint, iterableEquality } = this.utils;
|
|
9807
|
+
const testers = [...customTesters, iterableEquality];
|
|
9656
9808
|
let pass;
|
|
9657
|
-
if (Array.isArray(expected)) pass = expected.length === 0 || expected.some((item) => equals(item, actual,
|
|
9658
|
-
else if (expected instanceof Set) pass = expected.size === 0 || expected.has(actual) || [...expected].some((item) => equals(item, actual,
|
|
9809
|
+
if (Array.isArray(expected)) pass = expected.length === 0 || expected.some((item) => equals(item, actual, testers));
|
|
9810
|
+
else if (expected instanceof Set) pass = expected.size === 0 || expected.has(actual) || [...expected].some((item) => equals(item, actual, testers));
|
|
9659
9811
|
else throw new TypeError(`You must provide an array or set to ${matcherHint(".toBeOneOf")}, not '${typeof expected}'.`);
|
|
9660
9812
|
return {
|
|
9661
9813
|
pass,
|
|
@@ -9676,11 +9828,11 @@ ${printReceived(actual)}`
|
|
|
9676
9828
|
};
|
|
9677
9829
|
}
|
|
9678
9830
|
};
|
|
9679
|
-
const EXPECTED_COLOR =
|
|
9680
|
-
const RECEIVED_COLOR =
|
|
9681
|
-
const INVERTED_COLOR =
|
|
9682
|
-
const BOLD_WEIGHT =
|
|
9683
|
-
const DIM_COLOR =
|
|
9831
|
+
const EXPECTED_COLOR = $.green;
|
|
9832
|
+
const RECEIVED_COLOR = $.red;
|
|
9833
|
+
const INVERTED_COLOR = $.inverse;
|
|
9834
|
+
const BOLD_WEIGHT = $.bold;
|
|
9835
|
+
const DIM_COLOR = $.dim;
|
|
9684
9836
|
function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
|
|
9685
9837
|
const { comment = "", isDirectExpectCall = false, isNot = false, promise = "", secondArgument = "", expectedColor = EXPECTED_COLOR, receivedColor = RECEIVED_COLOR, secondArgumentColor = EXPECTED_COLOR } = options;
|
|
9686
9838
|
let hint = "";
|
|
@@ -9895,6 +10047,12 @@ const IteratorSymbol = Symbol.iterator;
|
|
|
9895
10047
|
function hasIterator(object) {
|
|
9896
10048
|
return !!(object != null && object[IteratorSymbol]);
|
|
9897
10049
|
}
|
|
10050
|
+
function isTypedArray(value) {
|
|
10051
|
+
return ArrayBuffer.isView(value);
|
|
10052
|
+
}
|
|
10053
|
+
function getNonIndexEntries(typedArray) {
|
|
10054
|
+
return Object.keys(typedArray).slice(typedArray.length).map((key) => [key, Reflect.get(typedArray, key)]);
|
|
10055
|
+
}
|
|
9898
10056
|
function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) {
|
|
9899
10057
|
if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) return;
|
|
9900
10058
|
if (a.constructor !== b.constructor) return false;
|
|
@@ -9941,6 +10099,14 @@ function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) {
|
|
|
9941
10099
|
return allFound;
|
|
9942
10100
|
}
|
|
9943
10101
|
}
|
|
10102
|
+
if (isTypedArray(a) && isTypedArray(b)) {
|
|
10103
|
+
if (a.length !== b.length) return false;
|
|
10104
|
+
for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i]) && !equals(a[i], b[i], filteredCustomTesters)) return false;
|
|
10105
|
+
if (!equals(getNonIndexEntries(a), getNonIndexEntries(b), filteredCustomTesters)) return false;
|
|
10106
|
+
aStack.pop();
|
|
10107
|
+
bStack.pop();
|
|
10108
|
+
return true;
|
|
10109
|
+
}
|
|
9944
10110
|
const bIterator = b[IteratorSymbol]();
|
|
9945
10111
|
for (const aValue of a) {
|
|
9946
10112
|
const nextB = bIterator.next();
|
|
@@ -10391,7 +10557,7 @@ function handleTestError(test, err) {
|
|
|
10391
10557
|
function wrapAssertion(utils, name, fn) {
|
|
10392
10558
|
return function(...args) {
|
|
10393
10559
|
if (name !== "withTest") utils.flag(this, "_name", name);
|
|
10394
|
-
if (!utils.flag(this, "soft")) try {
|
|
10560
|
+
if (!(utils.flag(this, "soft") && !utils.flag(this, "promise"))) try {
|
|
10395
10561
|
return fn.apply(this, args);
|
|
10396
10562
|
} finally {}
|
|
10397
10563
|
const test = utils.flag(this, "vitest-test");
|
|
@@ -10432,10 +10598,12 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10432
10598
|
if (promise === "rejects") utils.flag(this, "object", () => {
|
|
10433
10599
|
throw object;
|
|
10434
10600
|
});
|
|
10435
|
-
else if (promise === "resolves" && typeof object !== "function")
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10601
|
+
else if (promise === "resolves" && typeof object !== "function") {
|
|
10602
|
+
if (!isNot) {
|
|
10603
|
+
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
10604
|
+
throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
|
|
10605
|
+
} else return;
|
|
10606
|
+
}
|
|
10439
10607
|
_super.apply(this, args);
|
|
10440
10608
|
};
|
|
10441
10609
|
});
|
|
@@ -10525,7 +10693,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10525
10693
|
def("toContainEqual", function(expected) {
|
|
10526
10694
|
const obj = utils.flag(this, "object");
|
|
10527
10695
|
const index = Array.from(obj).findIndex((item) => {
|
|
10528
|
-
return equals(item, expected, customTesters);
|
|
10696
|
+
return equals(item, expected, [...customTesters, iterableEquality]);
|
|
10529
10697
|
});
|
|
10530
10698
|
this.assert(index !== -1, "expected #{this} to deep equally contain #{exp}", "expected #{this} to not deep equally contain #{exp}", expected);
|
|
10531
10699
|
});
|
|
@@ -10605,7 +10773,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10605
10773
|
return utils.getPathInfo(actual, propertyName);
|
|
10606
10774
|
};
|
|
10607
10775
|
const { value, exists } = getValue();
|
|
10608
|
-
const pass = exists && (args.length === 1 || equals(expected, value, customTesters));
|
|
10776
|
+
const pass = exists && (args.length === 1 || equals(expected, value, [...customTesters, iterableEquality]));
|
|
10609
10777
|
const valueString = args.length === 1 ? "" : ` with value ${inspect$1(expected, { truncate: 40 })}`;
|
|
10610
10778
|
return this.assert(pass, `expected #{this} to have property "${propertyName}"${valueString}`, `expected #{this} to not have property "${propertyName}"${valueString}`, expected, exists ? value : void 0);
|
|
10611
10779
|
});
|
|
@@ -10733,11 +10901,12 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10733
10901
|
const isNot = utils.flag(this, "negate");
|
|
10734
10902
|
let thrown = null;
|
|
10735
10903
|
if (promise === "rejects") thrown = obj;
|
|
10736
|
-
else if (promise === "resolves" && typeof obj !== "function")
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10904
|
+
else if (promise === "resolves" && typeof obj !== "function") {
|
|
10905
|
+
if (!isNot) {
|
|
10906
|
+
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
10907
|
+
throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
|
|
10908
|
+
} else return;
|
|
10909
|
+
} else {
|
|
10741
10910
|
let isThrow = false;
|
|
10742
10911
|
try {
|
|
10743
10912
|
obj();
|
|
@@ -10760,7 +10929,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10760
10929
|
}
|
|
10761
10930
|
if (typeof expected === "object" && "asymmetricMatch" in expected && typeof expected.asymmetricMatch === "function") {
|
|
10762
10931
|
const matcher = expected;
|
|
10763
|
-
return this.assert(thrown && matcher.asymmetricMatch(thrown), "expected error to match asymmetric matcher", "expected error not to match asymmetric matcher", matcher, thrown);
|
|
10932
|
+
return this.assert(thrown && matcher.asymmetricMatch(thrown, [...customTesters, iterableEquality]), "expected error to match asymmetric matcher", "expected error not to match asymmetric matcher", matcher, thrown);
|
|
10764
10933
|
}
|
|
10765
10934
|
const equal = equals(thrown, expected, [...customTesters, iterableEquality]);
|
|
10766
10935
|
return this.assert(equal, "expected a thrown value to equal #{exp}", "expected a thrown value not to equal #{exp}", expected, thrown);
|
|
@@ -10799,11 +10968,11 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10799
10968
|
});
|
|
10800
10969
|
[{
|
|
10801
10970
|
name: "toHaveResolvedWith",
|
|
10802
|
-
condition: (spy, value) => spy.mock.settledResults.some(({ type, value: result }) => type === "fulfilled" && equals(value, result)),
|
|
10971
|
+
condition: (spy, value) => spy.mock.settledResults.some(({ type, value: result }) => type === "fulfilled" && equals(value, result, [...customTesters, iterableEquality])),
|
|
10803
10972
|
action: "resolve"
|
|
10804
10973
|
}, {
|
|
10805
10974
|
name: ["toHaveReturnedWith", "toReturnWith"],
|
|
10806
|
-
condition: (spy, value) => spy.mock.results.some(({ type, value: result }) => type === "return" && equals(value, result)),
|
|
10975
|
+
condition: (spy, value) => spy.mock.results.some(({ type, value: result }) => type === "return" && equals(value, result, [...customTesters, iterableEquality])),
|
|
10807
10976
|
action: "return"
|
|
10808
10977
|
}].forEach(({ name, condition, action }) => {
|
|
10809
10978
|
def(name, function(value) {
|
|
@@ -10827,14 +10996,14 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10827
10996
|
name: "toHaveLastResolvedWith",
|
|
10828
10997
|
condition: (spy, value) => {
|
|
10829
10998
|
const result = spy.mock.settledResults.at(-1);
|
|
10830
|
-
return Boolean(result && result.type === "fulfilled" && equals(result.value, value));
|
|
10999
|
+
return Boolean(result && result.type === "fulfilled" && equals(result.value, value, [...customTesters, iterableEquality]));
|
|
10831
11000
|
},
|
|
10832
11001
|
action: "resolve"
|
|
10833
11002
|
}, {
|
|
10834
11003
|
name: "toHaveLastReturnedWith",
|
|
10835
11004
|
condition: (spy, value) => {
|
|
10836
11005
|
const result = spy.mock.results.at(-1);
|
|
10837
|
-
return Boolean(result && result.type === "return" && equals(result.value, value));
|
|
11006
|
+
return Boolean(result && result.type === "return" && equals(result.value, value, [...customTesters, iterableEquality]));
|
|
10838
11007
|
},
|
|
10839
11008
|
action: "return"
|
|
10840
11009
|
}].forEach(({ name, condition, action }) => {
|
|
@@ -10849,14 +11018,14 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10849
11018
|
name: "toHaveNthResolvedWith",
|
|
10850
11019
|
condition: (spy, index, value) => {
|
|
10851
11020
|
const result = spy.mock.settledResults[index - 1];
|
|
10852
|
-
return result && result.type === "fulfilled" && equals(result.value, value);
|
|
11021
|
+
return result && result.type === "fulfilled" && equals(result.value, value, [...customTesters, iterableEquality]);
|
|
10853
11022
|
},
|
|
10854
11023
|
action: "resolve"
|
|
10855
11024
|
}, {
|
|
10856
11025
|
name: "toHaveNthReturnedWith",
|
|
10857
11026
|
condition: (spy, index, value) => {
|
|
10858
11027
|
const result = spy.mock.results[index - 1];
|
|
10859
|
-
return result && result.type === "return" && equals(result.value, value);
|
|
11028
|
+
return result && result.type === "return" && equals(result.value, value, [...customTesters, iterableEquality]);
|
|
10860
11029
|
},
|
|
10861
11030
|
action: "return"
|
|
10862
11031
|
}].forEach(({ name, condition, action }) => {
|
|
@@ -10935,25 +11104,25 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
10935
11104
|
});
|
|
10936
11105
|
};
|
|
10937
11106
|
function formatCalls(spy, msg, showActualCall) {
|
|
10938
|
-
if (spy.mock.calls.length) msg +=
|
|
10939
|
-
let methodCall =
|
|
11107
|
+
if (spy.mock.calls.length) msg += $.gray(`\n\nReceived:\n\n${spy.mock.calls.map((callArg, i) => {
|
|
11108
|
+
let methodCall = $.bold(` ${ordinal(i + 1)} ${spy.getMockName()} call:\n\n`);
|
|
10940
11109
|
if (showActualCall) methodCall += diff(showActualCall, callArg, { omitAnnotationLines: true });
|
|
10941
11110
|
else methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n");
|
|
10942
11111
|
methodCall += "\n";
|
|
10943
11112
|
return methodCall;
|
|
10944
11113
|
}).join("\n")}`);
|
|
10945
|
-
msg +=
|
|
11114
|
+
msg += $.gray(`\n\nNumber of calls: ${$.bold(spy.mock.calls.length)}\n`);
|
|
10946
11115
|
return msg;
|
|
10947
11116
|
}
|
|
10948
11117
|
function formatReturns(spy, results, msg, showActualReturn) {
|
|
10949
|
-
if (results.length) msg +=
|
|
10950
|
-
let methodCall =
|
|
11118
|
+
if (results.length) msg += $.gray(`\n\nReceived:\n\n${results.map((callReturn, i) => {
|
|
11119
|
+
let methodCall = $.bold(` ${ordinal(i + 1)} ${spy.getMockName()} call return:\n\n`);
|
|
10951
11120
|
if (showActualReturn) methodCall += diff(showActualReturn, callReturn.value, { omitAnnotationLines: true });
|
|
10952
11121
|
else methodCall += stringify(callReturn).split("\n").map((line) => ` ${line}`).join("\n");
|
|
10953
11122
|
methodCall += "\n";
|
|
10954
11123
|
return methodCall;
|
|
10955
11124
|
}).join("\n")}`);
|
|
10956
|
-
msg +=
|
|
11125
|
+
msg += $.gray(`\n\nNumber of calls: ${$.bold(spy.mock.calls.length)}\n`);
|
|
10957
11126
|
return msg;
|
|
10958
11127
|
}
|
|
10959
11128
|
function getMatcherState(assertion, expect) {
|
|
@@ -11118,6 +11287,38 @@ const benchMatchers = {
|
|
|
11118
11287
|
};
|
|
11119
11288
|
}
|
|
11120
11289
|
};
|
|
11290
|
+
const attempts = /* @__PURE__ */ new WeakMap();
|
|
11291
|
+
function getTraceAttempt(test) {
|
|
11292
|
+
return attempts.get(test);
|
|
11293
|
+
}
|
|
11294
|
+
function createTraceRangeId() {
|
|
11295
|
+
return Math.random().toString(36).slice(2);
|
|
11296
|
+
}
|
|
11297
|
+
function recordTraceEntry(attempt, entry, source) {
|
|
11298
|
+
attempt.entries.push({
|
|
11299
|
+
entry: {
|
|
11300
|
+
...entry,
|
|
11301
|
+
startTime: performance.now() - attempt.startTime
|
|
11302
|
+
},
|
|
11303
|
+
source
|
|
11304
|
+
});
|
|
11305
|
+
}
|
|
11306
|
+
function startPromiseTraceRange(name, source) {
|
|
11307
|
+
return (promise) => promise;
|
|
11308
|
+
}
|
|
11309
|
+
/**
|
|
11310
|
+
* Copies the stack trace from one error to another.
|
|
11311
|
+
*
|
|
11312
|
+
* If the source has no stack trace, the target is left unchanged.
|
|
11313
|
+
*
|
|
11314
|
+
* @param target - The error to copy the stack trace to.
|
|
11315
|
+
* @param source - The error to copy the stack trace from.
|
|
11316
|
+
* @returns The target error with the updated stack trace.
|
|
11317
|
+
*/
|
|
11318
|
+
function copyStackTrace(target, source) {
|
|
11319
|
+
if (source.stack !== void 0) target.stack = source.stack.replace(source.message, target.message);
|
|
11320
|
+
return target;
|
|
11321
|
+
}
|
|
11121
11322
|
var fakeTimersSrc = {};
|
|
11122
11323
|
var global$1;
|
|
11123
11324
|
var hasRequiredGlobal;
|
|
@@ -11567,15 +11768,6 @@ function requireFakeTimersSrc() {
|
|
|
11567
11768
|
if (hasRequiredFakeTimersSrc) return fakeTimersSrc;
|
|
11568
11769
|
hasRequiredFakeTimersSrc = 1;
|
|
11569
11770
|
const globalObject = requireLib().global;
|
|
11570
|
-
let timersModule, timersPromisesModule;
|
|
11571
|
-
if (typeof __vitest_required__ !== "undefined") {
|
|
11572
|
-
try {
|
|
11573
|
-
timersModule = __vitest_required__.timers;
|
|
11574
|
-
} catch {}
|
|
11575
|
-
try {
|
|
11576
|
-
timersPromisesModule = __vitest_required__.timersPromises;
|
|
11577
|
-
} catch {}
|
|
11578
|
-
}
|
|
11579
11771
|
/**
|
|
11580
11772
|
* @typedef {"nextAsync" | "manual" | "interval"} TickMode
|
|
11581
11773
|
*/
|
|
@@ -12023,7 +12215,7 @@ function requireFakeTimersSrc() {
|
|
|
12023
12215
|
isPresent.hrtime = _global.process && typeof _global.process.hrtime === "function";
|
|
12024
12216
|
isPresent.hrtimeBigint = isPresent.hrtime && typeof _global.process.hrtime.bigint === "function";
|
|
12025
12217
|
isPresent.nextTick = _global.process && typeof _global.process.nextTick === "function";
|
|
12026
|
-
const utilPromisify = _global.process && _global.__vitest_required__
|
|
12218
|
+
const utilPromisify = _global.process && _global.__vitest_required__?.util.promisify;
|
|
12027
12219
|
isPresent.performance = _global.performance && typeof _global.performance.now === "function";
|
|
12028
12220
|
const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/);
|
|
12029
12221
|
const hasPerformanceConstructorPrototype = _global.performance && _global.performance.constructor && _global.performance.constructor.prototype;
|
|
@@ -13340,6 +13532,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.\n${sta
|
|
|
13340
13532
|
clock.uninstall = function() {
|
|
13341
13533
|
uninstalled = true;
|
|
13342
13534
|
clock.setTickMode({ mode: "manual" });
|
|
13535
|
+
const { timersModule, timersPromisesModule } = clock;
|
|
13343
13536
|
if (clock.methods) {
|
|
13344
13537
|
const installedHrTime = "_hrtime";
|
|
13345
13538
|
const installedNextTick = "_nextTick";
|
|
@@ -13411,6 +13604,12 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.\n${sta
|
|
|
13411
13604
|
let i, l;
|
|
13412
13605
|
const clock = createClock(config.now, config.loopLimit);
|
|
13413
13606
|
clock.shouldClearNativeTimers = config.shouldClearNativeTimers;
|
|
13607
|
+
const vitestRequired = config.fakeNodeBuiltins && _global.__vitest_required__;
|
|
13608
|
+
const timersModule = vitestRequired?.timers;
|
|
13609
|
+
const timersPromisesModule = vitestRequired?.timersPromises;
|
|
13610
|
+
const syncBuiltinESMExports = vitestRequired?.syncBuiltinESMExports;
|
|
13611
|
+
clock.timersModule = timersModule;
|
|
13612
|
+
clock.timersPromisesModule = timersPromisesModule;
|
|
13414
13613
|
clock.abortListenerMap = /* @__PURE__ */ new Map();
|
|
13415
13614
|
if (hasToFake) {
|
|
13416
13615
|
clock.methods = config.toFake || [];
|
|
@@ -13611,6 +13810,15 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.\n${sta
|
|
|
13611
13810
|
}
|
|
13612
13811
|
}
|
|
13613
13812
|
}
|
|
13813
|
+
if (syncBuiltinESMExports && (clock.timersModuleMethods?.length || clock.timersPromisesModuleMethods?.length)) {
|
|
13814
|
+
const uninstall = clock.uninstall;
|
|
13815
|
+
clock.uninstall = () => {
|
|
13816
|
+
const result = uninstall();
|
|
13817
|
+
syncBuiltinESMExports();
|
|
13818
|
+
return result;
|
|
13819
|
+
};
|
|
13820
|
+
syncBuiltinESMExports();
|
|
13821
|
+
}
|
|
13614
13822
|
return clock;
|
|
13615
13823
|
}
|
|
13616
13824
|
return {
|
|
@@ -13732,7 +13940,8 @@ var FakeTimers = class {
|
|
|
13732
13940
|
}
|
|
13733
13941
|
}
|
|
13734
13942
|
setSystemTime(now) {
|
|
13735
|
-
const
|
|
13943
|
+
const normalized = normalizeSystemTime(now);
|
|
13944
|
+
const date = typeof normalized === "undefined" || normalized instanceof Date ? normalized : new Date(normalized);
|
|
13736
13945
|
if (this._fakingTime) this._clock.setSystemTime(date);
|
|
13737
13946
|
else {
|
|
13738
13947
|
const newFakingDate = date ?? new Date(this.getRealSystemTime());
|
|
@@ -13760,13 +13969,15 @@ var FakeTimers = class {
|
|
|
13760
13969
|
return 0;
|
|
13761
13970
|
}
|
|
13762
13971
|
setTimerTickMode(mode, interval) {
|
|
13763
|
-
if (this._checkFakeTimers())
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
mode
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13972
|
+
if (this._checkFakeTimers()) {
|
|
13973
|
+
if (mode === "manual") this._clock.setTickMode({ mode: "manual" });
|
|
13974
|
+
else if (mode === "nextTimerAsync") this._clock.setTickMode({ mode: "nextAsync" });
|
|
13975
|
+
else if (mode === "interval") this._clock.setTickMode({
|
|
13976
|
+
mode: "interval",
|
|
13977
|
+
delta: interval
|
|
13978
|
+
});
|
|
13979
|
+
else throw new Error(`Invalid tick mode: ${mode}`);
|
|
13980
|
+
}
|
|
13770
13981
|
}
|
|
13771
13982
|
configure(config) {
|
|
13772
13983
|
this._userConfig = config;
|
|
@@ -13779,6 +13990,9 @@ var FakeTimers = class {
|
|
|
13779
13990
|
return this._fakingTime;
|
|
13780
13991
|
}
|
|
13781
13992
|
};
|
|
13993
|
+
function normalizeSystemTime(time) {
|
|
13994
|
+
return time && typeof time === "object" && "epochMilliseconds" in time ? time.epochMilliseconds : time;
|
|
13995
|
+
}
|
|
13782
13996
|
const whenSymbol = Symbol.for("$$vitest:when");
|
|
13783
13997
|
/**
|
|
13784
13998
|
* Returns `true` if the given value is a {@linkcode When} chain created by {@linkcode when|vi.when}.
|
|
@@ -14000,15 +14214,26 @@ function getSymbol(action) {
|
|
|
14000
14214
|
function validateOptions(options) {
|
|
14001
14215
|
if (typeof options?.times === "number" && options.times <= 0) throw new RangeError("vi.when: `times` option must be greater than 0");
|
|
14002
14216
|
}
|
|
14003
|
-
function
|
|
14004
|
-
if (
|
|
14005
|
-
|
|
14217
|
+
function prefixMessage(error, message) {
|
|
14218
|
+
if (message && error instanceof Error) {
|
|
14219
|
+
const original = error.message;
|
|
14220
|
+
try {
|
|
14221
|
+
error.message = `${message}: ${original}`;
|
|
14222
|
+
} catch {
|
|
14223
|
+
return error;
|
|
14224
|
+
}
|
|
14225
|
+
if (error.stack !== void 0) error.stack = error.stack.replace(original, error.message);
|
|
14226
|
+
}
|
|
14227
|
+
return error;
|
|
14228
|
+
}
|
|
14229
|
+
function getTraceName(name, message) {
|
|
14230
|
+
return message ? `${message} (${name})` : `${name}()`;
|
|
14006
14231
|
}
|
|
14007
14232
|
function waitFor(callback, options = {}) {
|
|
14008
14233
|
const { setTimeout, setInterval, clearTimeout, clearInterval } = getSafeTimers();
|
|
14009
|
-
const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
|
|
14234
|
+
const { interval = 50, timeout = 1e3, message } = typeof options === "number" ? { timeout: options } : options;
|
|
14010
14235
|
const STACK_TRACE_ERROR = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
|
|
14011
|
-
return new Promise((resolve, reject) => {
|
|
14236
|
+
return startPromiseTraceRange(getTraceName("vi.waitFor", message), STACK_TRACE_ERROR)(new Promise((resolve, reject) => {
|
|
14012
14237
|
let lastError;
|
|
14013
14238
|
let promiseStatus = "idle";
|
|
14014
14239
|
let timeoutId;
|
|
@@ -14021,8 +14246,8 @@ function waitFor(callback, options = {}) {
|
|
|
14021
14246
|
const handleTimeout = () => {
|
|
14022
14247
|
if (intervalId) clearInterval(intervalId);
|
|
14023
14248
|
let error = lastError;
|
|
14024
|
-
if (!error) error = copyStackTrace
|
|
14025
|
-
reject(error);
|
|
14249
|
+
if (!error) error = copyStackTrace(/* @__PURE__ */ new Error("Timed out in waitFor!"), STACK_TRACE_ERROR);
|
|
14250
|
+
reject(prefixMessage(error, message));
|
|
14026
14251
|
};
|
|
14027
14252
|
const checkCallback = () => {
|
|
14028
14253
|
if (vi.isFakeTimers()) vi.advanceTimersByTime(interval);
|
|
@@ -14050,20 +14275,20 @@ function waitFor(callback, options = {}) {
|
|
|
14050
14275
|
if (checkCallback() === true) return;
|
|
14051
14276
|
timeoutId = setTimeout(handleTimeout, timeout);
|
|
14052
14277
|
intervalId = setInterval(checkCallback, interval);
|
|
14053
|
-
});
|
|
14278
|
+
}));
|
|
14054
14279
|
}
|
|
14055
14280
|
function waitUntil(callback, options = {}) {
|
|
14056
14281
|
const { setTimeout, setInterval, clearTimeout, clearInterval } = getSafeTimers();
|
|
14057
|
-
const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
|
|
14282
|
+
const { interval = 50, timeout = 1e3, message } = typeof options === "number" ? { timeout: options } : options;
|
|
14058
14283
|
const STACK_TRACE_ERROR = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
|
|
14059
|
-
return new Promise((resolve, reject) => {
|
|
14284
|
+
return startPromiseTraceRange(getTraceName("vi.waitUntil", message), STACK_TRACE_ERROR)(new Promise((resolve, reject) => {
|
|
14060
14285
|
let promiseStatus = "idle";
|
|
14061
14286
|
let timeoutId;
|
|
14062
14287
|
let intervalId;
|
|
14063
14288
|
const onReject = (error) => {
|
|
14064
14289
|
if (intervalId) clearInterval(intervalId);
|
|
14065
|
-
if (!error) error = copyStackTrace
|
|
14066
|
-
reject(error);
|
|
14290
|
+
if (!error) error = copyStackTrace(/* @__PURE__ */ new Error("Timed out in waitUntil!"), STACK_TRACE_ERROR);
|
|
14291
|
+
reject(prefixMessage(error, message));
|
|
14067
14292
|
};
|
|
14068
14293
|
const onResolve = (result) => {
|
|
14069
14294
|
if (!result) return;
|
|
@@ -14095,7 +14320,7 @@ function waitUntil(callback, options = {}) {
|
|
|
14095
14320
|
if (checkCallback() === true) return;
|
|
14096
14321
|
timeoutId = setTimeout(onReject, timeout);
|
|
14097
14322
|
intervalId = setInterval(checkCallback, interval);
|
|
14098
|
-
});
|
|
14323
|
+
}));
|
|
14099
14324
|
}
|
|
14100
14325
|
function createVitest() {
|
|
14101
14326
|
let _config = null;
|
|
@@ -14208,7 +14433,7 @@ function createVitest() {
|
|
|
14208
14433
|
try {
|
|
14209
14434
|
return await result;
|
|
14210
14435
|
} catch (error) {
|
|
14211
|
-
if (error instanceof Error && !error.stack?.includes("__VITEST_HELPER__")) copyStackTrace
|
|
14436
|
+
if (error instanceof Error && !error.stack?.includes("__VITEST_HELPER__")) copyStackTrace(error, stackTraceError);
|
|
14212
14437
|
throw error;
|
|
14213
14438
|
}
|
|
14214
14439
|
})();
|
|
@@ -14337,10 +14562,6 @@ function getImporter(name) {
|
|
|
14337
14562
|
return stack.includes(` at Object.${name}`) || stack.includes(`${name}@`) || stack.includes(` at ${name} (`);
|
|
14338
14563
|
}) + 1])?.file || "";
|
|
14339
14564
|
}
|
|
14340
|
-
function copyStackTrace$1(target, source) {
|
|
14341
|
-
if (source.stack !== void 0) target.stack = source.stack.replace(source.message, target.message);
|
|
14342
|
-
return target;
|
|
14343
|
-
}
|
|
14344
14565
|
function waitNextTick() {
|
|
14345
14566
|
const { setTimeout } = getSafeTimers();
|
|
14346
14567
|
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
@@ -14368,15 +14589,19 @@ const unsupported = [
|
|
|
14368
14589
|
"toThrowError"
|
|
14369
14590
|
];
|
|
14370
14591
|
/**
|
|
14371
|
-
* Attaches a `cause` property to the error if missing, copies the stack trace from the source, and throws.
|
|
14592
|
+
* Attaches a `cause` property to the error if missing, prefixes the custom message, copies the stack trace from the source, and throws.
|
|
14372
14593
|
*
|
|
14373
14594
|
* @param error - The error to throw
|
|
14374
14595
|
* @param source - Error to copy the stack trace from
|
|
14596
|
+
* @param message - Custom message passed to `expect.poll`
|
|
14375
14597
|
*
|
|
14376
14598
|
* @throws Always throws the provided error with an amended stack trace
|
|
14377
14599
|
*/
|
|
14378
|
-
function throwWithCause(error, source) {
|
|
14600
|
+
function throwWithCause(error, source, message) {
|
|
14379
14601
|
error.cause ??= /* @__PURE__ */ new Error("Matcher did not succeed in time.");
|
|
14602
|
+
if (message && typeof error.message === "string" && !error.message.startsWith(`${message}: `)) try {
|
|
14603
|
+
error.message = `${message}: ${error.message}`;
|
|
14604
|
+
} catch {}
|
|
14380
14605
|
throw copyStackTrace(error, source);
|
|
14381
14606
|
}
|
|
14382
14607
|
function createExpectPoll(expect) {
|
|
@@ -14390,6 +14615,7 @@ function createExpectPoll(expect) {
|
|
|
14390
14615
|
utils_exports.flag(assertion, "_poll.interval", interval);
|
|
14391
14616
|
const test = utils_exports.flag(assertion, "vitest-test");
|
|
14392
14617
|
if (!test) throw new Error("expect.poll() must be called inside a test");
|
|
14618
|
+
setTraceHandlers(assertion, test);
|
|
14393
14619
|
const proxy = new Proxy(assertion, { get(target, key, receiver) {
|
|
14394
14620
|
const assertionFunction = Reflect.get(target, key, receiver);
|
|
14395
14621
|
if (typeof assertionFunction !== "function") return assertionFunction instanceof Assertion ? proxy : assertionFunction;
|
|
@@ -14415,7 +14641,7 @@ function createExpectPoll(expect) {
|
|
|
14415
14641
|
assertion,
|
|
14416
14642
|
status: "fail"
|
|
14417
14643
|
});
|
|
14418
|
-
throwWithCause(err, STACK_TRACE_ERROR);
|
|
14644
|
+
throwWithCause(err, STACK_TRACE_ERROR, message);
|
|
14419
14645
|
}
|
|
14420
14646
|
const { setTimeout, clearTimeout } = getSafeTimers();
|
|
14421
14647
|
let timerId;
|
|
@@ -14461,7 +14687,7 @@ function createExpectPoll(expect) {
|
|
|
14461
14687
|
assertion,
|
|
14462
14688
|
status: "fail"
|
|
14463
14689
|
});
|
|
14464
|
-
throwWithCause(lastError, STACK_TRACE_ERROR);
|
|
14690
|
+
throwWithCause(lastError, STACK_TRACE_ERROR, message);
|
|
14465
14691
|
}
|
|
14466
14692
|
};
|
|
14467
14693
|
let awaited = false;
|
|
@@ -14496,9 +14722,39 @@ function createExpectPoll(expect) {
|
|
|
14496
14722
|
return proxy;
|
|
14497
14723
|
};
|
|
14498
14724
|
}
|
|
14499
|
-
function
|
|
14500
|
-
|
|
14501
|
-
return
|
|
14725
|
+
function setTraceHandlers(assertion, test) {
|
|
14726
|
+
const attempt = getTraceAttempt(test);
|
|
14727
|
+
if (!attempt) return;
|
|
14728
|
+
const rangeId = createTraceRangeId();
|
|
14729
|
+
const getName = (assertion) => {
|
|
14730
|
+
const negated = utils_exports.flag(assertion, "negate") ? "not." : "";
|
|
14731
|
+
const message = utils_exports.flag(assertion, "message");
|
|
14732
|
+
const name = `expect.poll().${negated}${utils_exports.flag(assertion, "_name")}`;
|
|
14733
|
+
return message ? `${message} (${name})` : `${name}()`;
|
|
14734
|
+
};
|
|
14735
|
+
const onStart = ({ assertion }) => {
|
|
14736
|
+
recordTraceEntry(attempt, {
|
|
14737
|
+
name: getName(assertion),
|
|
14738
|
+
kind: "expect",
|
|
14739
|
+
range: {
|
|
14740
|
+
id: rangeId,
|
|
14741
|
+
phase: "start"
|
|
14742
|
+
}
|
|
14743
|
+
}, utils_exports.flag(assertion, "error"));
|
|
14744
|
+
};
|
|
14745
|
+
const onSettled = ({ assertion, status }) => {
|
|
14746
|
+
recordTraceEntry(attempt, {
|
|
14747
|
+
name: getName(assertion),
|
|
14748
|
+
kind: "expect",
|
|
14749
|
+
range: {
|
|
14750
|
+
id: rangeId,
|
|
14751
|
+
phase: "end"
|
|
14752
|
+
},
|
|
14753
|
+
status
|
|
14754
|
+
}, utils_exports.flag(assertion, "error"));
|
|
14755
|
+
};
|
|
14756
|
+
utils_exports.flag(assertion, "_poll.onStart", onStart);
|
|
14757
|
+
utils_exports.flag(assertion, "_poll.onSettled", onSettled);
|
|
14502
14758
|
}
|
|
14503
14759
|
function raceWith(promise, other) {
|
|
14504
14760
|
const left = promise.then((value) => ({
|
|
@@ -14576,7 +14832,8 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
14576
14832
|
filepath,
|
|
14577
14833
|
hint
|
|
14578
14834
|
}).then((result) => assertMatchResult(result, chai.util.flag(this, "message")));
|
|
14579
|
-
|
|
14835
|
+
const isSoft = utils.flag(this, "soft") && !utils.flag(this, "promise");
|
|
14836
|
+
return recordAsyncExpect(getTest(this), assertPromise, createAssertionMessage(utils, this, true), /* @__PURE__ */ new Error("resolves"), isSoft);
|
|
14580
14837
|
});
|
|
14581
14838
|
utils.addMethod(chai.Assertion.prototype, "toMatchInlineSnapshot", wrapAssertion(utils, "toMatchInlineSnapshot", function __INLINE_SNAPSHOT_OFFSET_3__(propertiesOrInlineSnapshot, inlineSnapshotOrHint, hint) {
|
|
14582
14839
|
return assertMatchResult(toMatchSnapshotImpl({
|
|
@@ -14655,6 +14912,7 @@ async function toMatchFileSnapshotImpl(options) {
|
|
|
14655
14912
|
const snapshotState = getSnapshotClient().getSnapshotState(testNames.filepath);
|
|
14656
14913
|
const rawSnapshotFile = await snapshotState.environment.resolveRawPath(testNames.filepath, options.filepath);
|
|
14657
14914
|
const rawSnapshotContent = await snapshotState.environment.readSnapshotFile(rawSnapshotFile);
|
|
14915
|
+
const assertionName = getAssertionName(assertion);
|
|
14658
14916
|
return getSnapshotClient().match({
|
|
14659
14917
|
received: options.received,
|
|
14660
14918
|
message: options.hint,
|
|
@@ -14662,6 +14920,7 @@ async function toMatchFileSnapshotImpl(options) {
|
|
|
14662
14920
|
file: rawSnapshotFile,
|
|
14663
14921
|
content: rawSnapshotContent ?? void 0
|
|
14664
14922
|
},
|
|
14923
|
+
assertionName,
|
|
14665
14924
|
...testNames
|
|
14666
14925
|
});
|
|
14667
14926
|
}
|
|
@@ -14671,7 +14930,8 @@ function assertMatchResult(result, customMessage) {
|
|
|
14671
14930
|
throw Object.assign(new Error(errorMessage), {
|
|
14672
14931
|
actual: result.actual,
|
|
14673
14932
|
expected: result.expected,
|
|
14674
|
-
diffOptions: { expand: getWorkerState().config.snapshotOptions.expand }
|
|
14933
|
+
diffOptions: { expand: getWorkerState().config.snapshotOptions.expand },
|
|
14934
|
+
__vitest_error_context__: { meta: result.meta }
|
|
14675
14935
|
});
|
|
14676
14936
|
}
|
|
14677
14937
|
}
|