@effect-uai/ai-sdk 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Messages.d.mts +0 -2
- package/dist/Messages.d.mts.map +1 -1
- package/dist/Messages.mjs +1 -1
- package/dist/Messages.mjs.map +1 -1
- package/dist/UIMessageStream.d.mts +0 -2
- package/dist/UIMessageStream.d.mts.map +1 -1
- package/dist/UIMessageStream.mjs +1 -1
- package/dist/UIMessageStream.mjs.map +1 -1
- package/dist/UIMessageStream.test.d.mts +1 -1
- package/dist/UIMessageStream.test.mjs +13 -9
- package/dist/UIMessageStream.test.mjs.map +1 -1
- package/dist/conformance.test.d.mts +1 -1
- package/dist/conformance.test.mjs +316 -1093
- package/dist/conformance.test.mjs.map +1 -1
- package/dist/{dist-DDciKZ0w.mjs → dist-CGDqr3r6.mjs} +799 -265
- package/dist/dist-CGDqr3r6.mjs.map +1 -0
- package/dist/{magic-string.es-CaWgF-3p.mjs → magic-string.es-CUAnjKYC.mjs} +14 -13
- package/dist/{magic-string.es-CaWgF-3p.mjs.map → magic-string.es-CUAnjKYC.mjs.map} +1 -1
- package/package.json +5 -5
- package/src/UIMessageStream.ts +14 -19
- package/dist/dist-DDciKZ0w.mjs.map +0 -1
- /package/dist/{chunk-CfYAbeIz.mjs → rolldown-runtime-D7D4PA-g.mjs} +0 -0
|
@@ -5,6 +5,7 @@ import * as Exit from "effect/Exit";
|
|
|
5
5
|
import { flow, pipe } from "effect/Function";
|
|
6
6
|
import * as Layer from "effect/Layer";
|
|
7
7
|
import { isObject } from "effect/Predicate";
|
|
8
|
+
import * as Rec from "effect/Record";
|
|
8
9
|
import * as Schedule from "effect/Schedule";
|
|
9
10
|
import * as Schema from "effect/Schema";
|
|
10
11
|
import * as Scope from "effect/Scope";
|
|
@@ -94,7 +95,7 @@ function C({ force: e } = {}) {
|
|
|
94
95
|
}
|
|
95
96
|
var y = C();
|
|
96
97
|
//#endregion
|
|
97
|
-
//#region ../../../node_modules/.pnpm/@vitest+pretty-format@4.1.
|
|
98
|
+
//#region ../../../node_modules/.pnpm/@vitest+pretty-format@4.1.11/node_modules/@vitest/pretty-format/dist/index.js
|
|
98
99
|
function _mergeNamespaces(n, m) {
|
|
99
100
|
m.forEach(function(e) {
|
|
100
101
|
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
@@ -248,7 +249,7 @@ const plugin$5 = {
|
|
|
248
249
|
test: test$5
|
|
249
250
|
};
|
|
250
251
|
const SPACE$1 = " ";
|
|
251
|
-
const OBJECT_NAMES = new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
252
|
+
const OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
252
253
|
const ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
|
|
253
254
|
function testName(name) {
|
|
254
255
|
return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
|
|
@@ -539,7 +540,7 @@ function requireReactIs$1() {
|
|
|
539
540
|
return reactIs$1.exports;
|
|
540
541
|
}
|
|
541
542
|
var reactIsExports$1 = requireReactIs$1();
|
|
542
|
-
var ReactIs19 =
|
|
543
|
+
var ReactIs19 = /*#__PURE__*/ _mergeNamespaces({
|
|
543
544
|
__proto__: null,
|
|
544
545
|
default: /* @__PURE__ */ getDefaultExportFromCjs$2(reactIsExports$1)
|
|
545
546
|
}, [reactIsExports$1]);
|
|
@@ -651,7 +652,7 @@ function requireReactIs() {
|
|
|
651
652
|
return reactIs.exports;
|
|
652
653
|
}
|
|
653
654
|
var reactIsExports = requireReactIs();
|
|
654
|
-
var ReactIs18 =
|
|
655
|
+
var ReactIs18 = /*#__PURE__*/ _mergeNamespaces({
|
|
655
656
|
__proto__: null,
|
|
656
657
|
default: /* @__PURE__ */ getDefaultExportFromCjs$2(reactIsExports)
|
|
657
658
|
}, [reactIsExports]);
|
|
@@ -977,7 +978,7 @@ const plugins = {
|
|
|
977
978
|
Error: ErrorPlugin
|
|
978
979
|
};
|
|
979
980
|
//#endregion
|
|
980
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
981
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/display.js
|
|
981
982
|
const ansiColors$1 = {
|
|
982
983
|
bold: ["1", "22"],
|
|
983
984
|
dim: ["2", "22"],
|
|
@@ -1520,18 +1521,20 @@ function objDisplay$1(obj, options = {}) {
|
|
|
1520
1521
|
if (typeof options.truncate === "undefined") options.truncate = 40;
|
|
1521
1522
|
const str = inspect$2(obj, options);
|
|
1522
1523
|
const type = Object.prototype.toString.call(obj);
|
|
1523
|
-
if (options.truncate && str.length >= options.truncate)
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1524
|
+
if (options.truncate && str.length >= options.truncate) {
|
|
1525
|
+
if (type === "[object Function]") {
|
|
1526
|
+
const fn = obj;
|
|
1527
|
+
return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
|
|
1528
|
+
} else if (type === "[object Array]") return `[ Array(${obj.length}) ]`;
|
|
1529
|
+
else if (type === "[object Object]") {
|
|
1530
|
+
const keys = Object.keys(obj);
|
|
1531
|
+
return `{ Object (${keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ")}) }`;
|
|
1532
|
+
} else return str;
|
|
1533
|
+
}
|
|
1531
1534
|
return str;
|
|
1532
1535
|
}
|
|
1533
1536
|
//#endregion
|
|
1534
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
1537
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/helpers.js
|
|
1535
1538
|
/**
|
|
1536
1539
|
* Get original stacktrace without source map support the most performant way.
|
|
1537
1540
|
* - Create only 1 stack frame.
|
|
@@ -1565,11 +1568,13 @@ function filterOutComments(s) {
|
|
|
1565
1568
|
if (s[i] === "\n") commentState = "none";
|
|
1566
1569
|
} else if (commentState === "multiline") {
|
|
1567
1570
|
if (s[i - 1] === "*" && s[i] === "/") commentState = "none";
|
|
1568
|
-
} else if (commentState === "none")
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1571
|
+
} else if (commentState === "none") {
|
|
1572
|
+
if (s[i] === "/" && s[i + 1] === "/") commentState = "singleline";
|
|
1573
|
+
else if (s[i] === "/" && s[i + 1] === "*") {
|
|
1574
|
+
commentState = "multiline";
|
|
1575
|
+
i += 2;
|
|
1576
|
+
} else result.push(s[i]);
|
|
1577
|
+
}
|
|
1573
1578
|
return result.join("");
|
|
1574
1579
|
}
|
|
1575
1580
|
function toArray(array) {
|
|
@@ -1693,7 +1698,7 @@ function getCallLastIndex(code) {
|
|
|
1693
1698
|
}
|
|
1694
1699
|
function isNegativeNaN(val) {
|
|
1695
1700
|
if (!Number.isNaN(val)) return false;
|
|
1696
|
-
const f64 = new Float64Array(1);
|
|
1701
|
+
const f64 = /* @__PURE__ */ new Float64Array(1);
|
|
1697
1702
|
f64[0] = val;
|
|
1698
1703
|
return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
|
|
1699
1704
|
}
|
|
@@ -1987,7 +1992,6 @@ function diff_cleanupMerge(diffs) {
|
|
|
1987
1992
|
count_delete = 0;
|
|
1988
1993
|
text_delete = "";
|
|
1989
1994
|
text_insert = "";
|
|
1990
|
-
break;
|
|
1991
1995
|
}
|
|
1992
1996
|
if (diffs.at(-1)?.[1] === "") diffs.pop();
|
|
1993
1997
|
let changes = false;
|
|
@@ -2347,7 +2351,7 @@ function requireBuild() {
|
|
|
2347
2351
|
}
|
|
2348
2352
|
return build;
|
|
2349
2353
|
}
|
|
2350
|
-
var diffSequences =
|
|
2354
|
+
var diffSequences = /*@__PURE__*/ getDefaultExportFromCjs$1(/* @__PURE__ */ requireBuild());
|
|
2351
2355
|
function formatTrailingSpaces(line, trailingSpaceFormatter) {
|
|
2352
2356
|
return line.replace(/\s+$/, (match) => trailingSpaceFormatter(match));
|
|
2353
2357
|
}
|
|
@@ -2377,22 +2381,24 @@ function joinAlignedDiffsNoExpand(diffs, options) {
|
|
|
2377
2381
|
while (i !== iLength) {
|
|
2378
2382
|
const iStart = i;
|
|
2379
2383
|
while (i !== iLength && diffs[i][0] === 0) i += 1;
|
|
2380
|
-
if (iStart !== i)
|
|
2381
|
-
if (
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2384
|
+
if (iStart !== i) {
|
|
2385
|
+
if (iStart === 0) {
|
|
2386
|
+
if (i > nContextLines) {
|
|
2387
|
+
jLength -= i - nContextLines;
|
|
2388
|
+
hasExcessAtStartOrEnd = true;
|
|
2389
|
+
}
|
|
2390
|
+
} else if (i === iLength) {
|
|
2391
|
+
const n = i - iStart;
|
|
2392
|
+
if (n > nContextLines) {
|
|
2393
|
+
jLength -= n - nContextLines;
|
|
2394
|
+
hasExcessAtStartOrEnd = true;
|
|
2395
|
+
}
|
|
2396
|
+
} else {
|
|
2397
|
+
const n = i - iStart;
|
|
2398
|
+
if (n > nContextLines2) {
|
|
2399
|
+
jLength -= n - nContextLines2;
|
|
2400
|
+
nExcessesBetweenChanges += 1;
|
|
2401
|
+
}
|
|
2396
2402
|
}
|
|
2397
2403
|
}
|
|
2398
2404
|
while (i !== iLength && diffs[i][0] !== 0) i += 1;
|
|
@@ -2428,33 +2434,35 @@ function joinAlignedDiffsNoExpand(diffs, options) {
|
|
|
2428
2434
|
while (i !== iLength) {
|
|
2429
2435
|
let iStart = i;
|
|
2430
2436
|
while (i !== iLength && diffs[i][0] === 0) i += 1;
|
|
2431
|
-
if (iStart !== i)
|
|
2432
|
-
if (
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
} else {
|
|
2444
|
-
const nCommon = i - iStart;
|
|
2445
|
-
if (nCommon > nContextLines2) {
|
|
2446
|
-
const iEnd = iStart + nContextLines;
|
|
2437
|
+
if (iStart !== i) {
|
|
2438
|
+
if (iStart === 0) {
|
|
2439
|
+
if (i > nContextLines) {
|
|
2440
|
+
iStart = i - nContextLines;
|
|
2441
|
+
aStart = iStart;
|
|
2442
|
+
bStart = iStart;
|
|
2443
|
+
aEnd = aStart;
|
|
2444
|
+
bEnd = bStart;
|
|
2445
|
+
}
|
|
2446
|
+
for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
2447
|
+
} else if (i === iLength) {
|
|
2448
|
+
const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i;
|
|
2447
2449
|
for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2450
|
+
} else {
|
|
2451
|
+
const nCommon = i - iStart;
|
|
2452
|
+
if (nCommon > nContextLines2) {
|
|
2453
|
+
const iEnd = iStart + nContextLines;
|
|
2454
|
+
for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
2455
|
+
lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options);
|
|
2456
|
+
jPatchMark = lines.length;
|
|
2457
|
+
lines.push("");
|
|
2458
|
+
const nOmit = nCommon - nContextLines2;
|
|
2459
|
+
aStart = aEnd + nOmit;
|
|
2460
|
+
bStart = bEnd + nOmit;
|
|
2461
|
+
aEnd = aStart;
|
|
2462
|
+
bEnd = bStart;
|
|
2463
|
+
for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
2464
|
+
} else for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
|
|
2465
|
+
}
|
|
2458
2466
|
}
|
|
2459
2467
|
while (i !== iLength && diffs[i][0] === -1) {
|
|
2460
2468
|
pushDeleteLine(diffs[i][1]);
|
|
@@ -2533,9 +2541,7 @@ function countChanges(diffs) {
|
|
|
2533
2541
|
case -1:
|
|
2534
2542
|
a += 1;
|
|
2535
2543
|
break;
|
|
2536
|
-
case 1:
|
|
2537
|
-
b += 1;
|
|
2538
|
-
break;
|
|
2544
|
+
case 1: b += 1;
|
|
2539
2545
|
}
|
|
2540
2546
|
});
|
|
2541
2547
|
return {
|
|
@@ -2833,13 +2839,14 @@ const FALLBACK_FORMAT_OPTIONS = {
|
|
|
2833
2839
|
maxDepth: 8,
|
|
2834
2840
|
plugins: PLUGINS$1
|
|
2835
2841
|
};
|
|
2842
|
+
const DEFAULT_MEMORIZE = (_, v) => v;
|
|
2836
2843
|
/**
|
|
2837
2844
|
* @param a Expected value
|
|
2838
2845
|
* @param b Received value
|
|
2839
2846
|
* @param options Diff options
|
|
2840
2847
|
* @returns {string | null} a string diff
|
|
2841
2848
|
*/
|
|
2842
|
-
function diff(a, b, options) {
|
|
2849
|
+
function diff(a, b, options, memorize = DEFAULT_MEMORIZE) {
|
|
2843
2850
|
if (Object.is(a, b)) return "";
|
|
2844
2851
|
const aType = getType(a);
|
|
2845
2852
|
let expectedType = aType;
|
|
@@ -2859,23 +2866,29 @@ function diff(a, b, options) {
|
|
|
2859
2866
|
function truncate(s) {
|
|
2860
2867
|
return s.length <= MAX_LENGTH ? s : `${s.slice(0, MAX_LENGTH)}...`;
|
|
2861
2868
|
}
|
|
2862
|
-
aDisplay = truncate(aDisplay);
|
|
2863
|
-
bDisplay = truncate(bDisplay);
|
|
2869
|
+
aDisplay = memorize("expected", truncate(aDisplay));
|
|
2870
|
+
bDisplay = memorize("actual", truncate(bDisplay));
|
|
2864
2871
|
return `${`${aColor(`${aIndicator} ${aAnnotation}:`)}\n${aDisplay}`}\n\n${`${bColor(`${bIndicator} ${bAnnotation}:`)}\n${bDisplay}`}`;
|
|
2865
2872
|
}
|
|
2866
2873
|
if (omitDifference) return;
|
|
2867
2874
|
switch (aType) {
|
|
2868
2875
|
case "string": return diffLinesUnified(a.split("\n"), b.split("\n"), options);
|
|
2869
2876
|
case "boolean":
|
|
2870
|
-
case "number": return comparePrimitive(a, b, options);
|
|
2871
|
-
case "map": return compareObjects(sortMap(a), sortMap(b), options);
|
|
2872
|
-
case "set": return compareObjects(sortSet(a), sortSet(b), options);
|
|
2873
|
-
default: return compareObjects(a, b, options);
|
|
2877
|
+
case "number": return comparePrimitive(a, b, options, memorize);
|
|
2878
|
+
case "map": return compareObjects(sortMap(a), sortMap(b), options, memorize);
|
|
2879
|
+
case "set": return compareObjects(sortSet(a), sortSet(b), options, memorize);
|
|
2880
|
+
default: return compareObjects(a, b, options, memorize);
|
|
2874
2881
|
}
|
|
2875
2882
|
}
|
|
2876
|
-
function
|
|
2877
|
-
|
|
2878
|
-
|
|
2883
|
+
function createMemorize(memory) {
|
|
2884
|
+
return (pointer, stringifiedValue) => {
|
|
2885
|
+
memory[pointer] = stringifiedValue;
|
|
2886
|
+
return stringifiedValue;
|
|
2887
|
+
};
|
|
2888
|
+
}
|
|
2889
|
+
function comparePrimitive(a, b, options, memorize = DEFAULT_MEMORIZE) {
|
|
2890
|
+
const aFormat = memorize("expected", format$1(a, FORMAT_OPTIONS));
|
|
2891
|
+
const bFormat = memorize("actual", format$1(b, FORMAT_OPTIONS));
|
|
2879
2892
|
return aFormat === bFormat ? "" : diffLinesUnified(aFormat.split("\n"), bFormat.split("\n"), options);
|
|
2880
2893
|
}
|
|
2881
2894
|
function sortMap(map) {
|
|
@@ -2884,21 +2897,24 @@ function sortMap(map) {
|
|
|
2884
2897
|
function sortSet(set) {
|
|
2885
2898
|
return new Set(Array.from(set.values()).sort());
|
|
2886
2899
|
}
|
|
2887
|
-
function compareObjects(a, b, options) {
|
|
2900
|
+
function compareObjects(a, b, options, memorize = DEFAULT_MEMORIZE) {
|
|
2888
2901
|
let difference;
|
|
2889
2902
|
let hasThrown = false;
|
|
2890
2903
|
try {
|
|
2891
|
-
difference = getObjectsDifference(a, b, getFormatOptions(FORMAT_OPTIONS, options), options);
|
|
2904
|
+
difference = getObjectsDifference(a, b, getFormatOptions(FORMAT_OPTIONS, options), options, memorize);
|
|
2892
2905
|
} catch {
|
|
2893
2906
|
hasThrown = true;
|
|
2894
2907
|
}
|
|
2895
2908
|
const noDiffMessage = getCommonMessage(NO_DIFF_MESSAGE, options);
|
|
2896
2909
|
if (difference === void 0 || difference === noDiffMessage) {
|
|
2897
|
-
difference = getObjectsDifference(a, b, getFormatOptions(FALLBACK_FORMAT_OPTIONS, options), options);
|
|
2910
|
+
difference = getObjectsDifference(a, b, getFormatOptions(FALLBACK_FORMAT_OPTIONS, options), options, memorize);
|
|
2898
2911
|
if (difference !== noDiffMessage && !hasThrown) difference = `${getCommonMessage(SIMILAR_MESSAGE, options)}\n\n${difference}`;
|
|
2899
2912
|
}
|
|
2900
2913
|
return difference;
|
|
2901
2914
|
}
|
|
2915
|
+
function getDefaultFormatOptions(options) {
|
|
2916
|
+
return getFormatOptions(FORMAT_OPTIONS, options);
|
|
2917
|
+
}
|
|
2902
2918
|
function getFormatOptions(formatOptions, options) {
|
|
2903
2919
|
const { compareKeys, printBasicPrototype, maxDepth } = normalizeDiffOptions(options);
|
|
2904
2920
|
return {
|
|
@@ -2908,7 +2924,7 @@ function getFormatOptions(formatOptions, options) {
|
|
|
2908
2924
|
maxDepth: maxDepth ?? formatOptions.maxDepth
|
|
2909
2925
|
};
|
|
2910
2926
|
}
|
|
2911
|
-
function getObjectsDifference(a, b, formatOptions, options) {
|
|
2927
|
+
function getObjectsDifference(a, b, formatOptions, options, memorize = DEFAULT_MEMORIZE) {
|
|
2912
2928
|
const formatOptionsZeroIndent = {
|
|
2913
2929
|
...formatOptions,
|
|
2914
2930
|
indent: 0
|
|
@@ -2917,8 +2933,8 @@ function getObjectsDifference(a, b, formatOptions, options) {
|
|
|
2917
2933
|
const bCompare = format$1(b, formatOptionsZeroIndent);
|
|
2918
2934
|
if (aCompare === bCompare) return getCommonMessage(NO_DIFF_MESSAGE, options);
|
|
2919
2935
|
else {
|
|
2920
|
-
const aDisplay = format$1(a, formatOptions);
|
|
2921
|
-
const bDisplay = format$1(b, formatOptions);
|
|
2936
|
+
const aDisplay = memorize("expected", format$1(a, formatOptions));
|
|
2937
|
+
const bDisplay = memorize("actual", format$1(b, formatOptions));
|
|
2922
2938
|
return diffLinesUnified2(aDisplay.split("\n"), bDisplay.split("\n"), aCompare.split("\n"), bCompare.split("\n"), options);
|
|
2923
2939
|
}
|
|
2924
2940
|
}
|
|
@@ -2930,7 +2946,7 @@ function isReplaceable(obj1, obj2) {
|
|
|
2930
2946
|
const obj1Type = getType$1(obj1);
|
|
2931
2947
|
return obj1Type === getType$1(obj2) && (obj1Type === "Object" || obj1Type === "Array");
|
|
2932
2948
|
}
|
|
2933
|
-
function printDiffOrStringify(received, expected, options) {
|
|
2949
|
+
function printDiffOrStringify(received, expected, options, memory) {
|
|
2934
2950
|
const { aAnnotation, bAnnotation } = normalizeDiffOptions(options);
|
|
2935
2951
|
if (typeof expected === "string" && typeof received === "string" && expected.length > 0 && received.length > 0 && expected.length <= MAX_DIFF_STRING_LENGTH && received.length <= MAX_DIFF_STRING_LENGTH && expected !== received) {
|
|
2936
2952
|
if (expected.includes("\n") || received.includes("\n")) return diffStringsUnified(expected, received, options);
|
|
@@ -2941,7 +2957,7 @@ function printDiffOrStringify(received, expected, options) {
|
|
|
2941
2957
|
}
|
|
2942
2958
|
const clonedExpected = deepClone(expected, { forceWritable: true });
|
|
2943
2959
|
const { replacedExpected, replacedActual } = replaceAsymmetricMatcher(deepClone(received, { forceWritable: true }), clonedExpected);
|
|
2944
|
-
return diff(replacedExpected, replacedActual, options);
|
|
2960
|
+
return diff(replacedExpected, replacedActual, options, memory ? createMemorize(memory) : DEFAULT_MEMORIZE);
|
|
2945
2961
|
}
|
|
2946
2962
|
function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakSet(), expectedReplaced = /* @__PURE__ */ new WeakSet()) {
|
|
2947
2963
|
if (actual instanceof Error && expected instanceof Error && typeof actual.cause !== "undefined" && typeof expected.cause === "undefined") {
|
|
@@ -3007,7 +3023,7 @@ function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff) {
|
|
|
3007
3023
|
return diffs.reduce((reduced, diff) => reduced + (diff[0] === 0 ? diff[1] : diff[0] === op ? hasCommonDiff ? y.inverse(diff[1]) : diff[1] : ""), "");
|
|
3008
3024
|
}
|
|
3009
3025
|
//#endregion
|
|
3010
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
3026
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/serialize.js
|
|
3011
3027
|
const IS_RECORD_SYMBOL$1 = "@@__IMMUTABLE_RECORD__@@";
|
|
3012
3028
|
const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
3013
3029
|
function isImmutable(v) {
|
|
@@ -3081,16 +3097,19 @@ function normalizeErrorMessage(message) {
|
|
|
3081
3097
|
return message.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/getByTestId('__vitest_\d+__')/g, "page");
|
|
3082
3098
|
}
|
|
3083
3099
|
//#endregion
|
|
3084
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
3100
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/error.js
|
|
3085
3101
|
function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
|
|
3086
3102
|
if (!_err || typeof _err !== "object") return { message: String(_err) };
|
|
3087
3103
|
const err = _err;
|
|
3088
|
-
if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0)
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3104
|
+
if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) {
|
|
3105
|
+
const options = {
|
|
3106
|
+
...diffOptions,
|
|
3107
|
+
...err.diffOptions
|
|
3108
|
+
};
|
|
3109
|
+
err.diff = printDiffOrStringify(err.actual, err.expected, options, err);
|
|
3110
|
+
err.expected = prettifyValue(err.expected, options);
|
|
3111
|
+
err.actual = prettifyValue(err.actual, options);
|
|
3112
|
+
}
|
|
3094
3113
|
try {
|
|
3095
3114
|
if (!seen.has(err) && typeof err.cause === "object") {
|
|
3096
3115
|
seen.add(err);
|
|
@@ -3103,8 +3122,12 @@ function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
3103
3122
|
return serializeValue(/* @__PURE__ */ new Error(`Failed to fully serialize error: ${e?.message}\nInner error message: ${err?.message}`));
|
|
3104
3123
|
}
|
|
3105
3124
|
}
|
|
3125
|
+
function prettifyValue(value, options) {
|
|
3126
|
+
if (typeof value !== "string") return format$1(value, getDefaultFormatOptions(options));
|
|
3127
|
+
return value;
|
|
3128
|
+
}
|
|
3106
3129
|
//#endregion
|
|
3107
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
3130
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/timers.js
|
|
3108
3131
|
const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");
|
|
3109
3132
|
function getSafeTimers() {
|
|
3110
3133
|
const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
|
|
@@ -3138,32 +3161,32 @@ function delay(timeout, scheduler = setTimeout) {
|
|
|
3138
3161
|
return new Promise((resolve) => scheduler(resolve, timeout));
|
|
3139
3162
|
}
|
|
3140
3163
|
//#endregion
|
|
3141
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
3142
|
-
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3143
|
-
function normalizeWindowsPath(input = "") {
|
|
3164
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
|
|
3165
|
+
const _DRIVE_LETTER_START_RE$1 = /^[A-Za-z]:\//;
|
|
3166
|
+
function normalizeWindowsPath$1(input = "") {
|
|
3144
3167
|
if (!input) return input;
|
|
3145
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
3168
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE$1, (r) => r.toUpperCase());
|
|
3146
3169
|
}
|
|
3147
|
-
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
3170
|
+
const _IS_ABSOLUTE_RE$1 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
3148
3171
|
function cwd() {
|
|
3149
3172
|
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
3150
3173
|
return "/";
|
|
3151
3174
|
}
|
|
3152
3175
|
const resolve = function(...arguments_) {
|
|
3153
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
3176
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath$1(argument));
|
|
3154
3177
|
let resolvedPath = "";
|
|
3155
3178
|
let resolvedAbsolute = false;
|
|
3156
3179
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
3157
3180
|
const path = index >= 0 ? arguments_[index] : cwd();
|
|
3158
3181
|
if (!path || path.length === 0) continue;
|
|
3159
3182
|
resolvedPath = `${path}/${resolvedPath}`;
|
|
3160
|
-
resolvedAbsolute = isAbsolute(path);
|
|
3183
|
+
resolvedAbsolute = isAbsolute$1(path);
|
|
3161
3184
|
}
|
|
3162
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
3163
|
-
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
3185
|
+
resolvedPath = normalizeString$1(resolvedPath, !resolvedAbsolute);
|
|
3186
|
+
if (resolvedAbsolute && !isAbsolute$1(resolvedPath)) return `/${resolvedPath}`;
|
|
3164
3187
|
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
3165
3188
|
};
|
|
3166
|
-
function normalizeString(path, allowAboveRoot) {
|
|
3189
|
+
function normalizeString$1(path, allowAboveRoot) {
|
|
3167
3190
|
let res = "";
|
|
3168
3191
|
let lastSegmentLength = 0;
|
|
3169
3192
|
let lastSlash = -1;
|
|
@@ -3213,15 +3236,15 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
3213
3236
|
}
|
|
3214
3237
|
return res;
|
|
3215
3238
|
}
|
|
3216
|
-
const isAbsolute = function(p) {
|
|
3217
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
3239
|
+
const isAbsolute$1 = function(p) {
|
|
3240
|
+
return _IS_ABSOLUTE_RE$1.test(p);
|
|
3218
3241
|
};
|
|
3219
3242
|
//#endregion
|
|
3220
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
3243
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/source-map.js
|
|
3221
3244
|
var comma = ",".charCodeAt(0);
|
|
3222
3245
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3223
|
-
var intToChar = new Uint8Array(64);
|
|
3224
|
-
var charToInt = new Uint8Array(128);
|
|
3246
|
+
var intToChar = /* @__PURE__ */ new Uint8Array(64);
|
|
3247
|
+
var charToInt = /* @__PURE__ */ new Uint8Array(128);
|
|
3225
3248
|
for (let i = 0; i < chars.length; i++) {
|
|
3226
3249
|
const c = chars.charCodeAt(i);
|
|
3227
3250
|
intToChar[i] = c;
|
|
@@ -3585,7 +3608,89 @@ function getOriginalPosition(map, needle) {
|
|
|
3585
3608
|
return result;
|
|
3586
3609
|
}
|
|
3587
3610
|
//#endregion
|
|
3588
|
-
//#region ../../../node_modules/.pnpm
|
|
3611
|
+
//#region ../../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
3612
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3613
|
+
function normalizeWindowsPath(input = "") {
|
|
3614
|
+
if (!input) return input;
|
|
3615
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
3616
|
+
}
|
|
3617
|
+
const _UNC_REGEX = /^[/\\]{2}/;
|
|
3618
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
3619
|
+
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
3620
|
+
const normalize = function(path) {
|
|
3621
|
+
if (path.length === 0) return ".";
|
|
3622
|
+
path = normalizeWindowsPath(path);
|
|
3623
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
3624
|
+
const isPathAbsolute = isAbsolute(path);
|
|
3625
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
3626
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
3627
|
+
if (path.length === 0) {
|
|
3628
|
+
if (isPathAbsolute) return "/";
|
|
3629
|
+
return trailingSeparator ? "./" : ".";
|
|
3630
|
+
}
|
|
3631
|
+
if (trailingSeparator) path += "/";
|
|
3632
|
+
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
3633
|
+
if (isUNCPath) {
|
|
3634
|
+
if (!isPathAbsolute) return `//./${path}`;
|
|
3635
|
+
return `//${path}`;
|
|
3636
|
+
}
|
|
3637
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
3638
|
+
};
|
|
3639
|
+
function normalizeString(path, allowAboveRoot) {
|
|
3640
|
+
let res = "";
|
|
3641
|
+
let lastSegmentLength = 0;
|
|
3642
|
+
let lastSlash = -1;
|
|
3643
|
+
let dots = 0;
|
|
3644
|
+
let char = null;
|
|
3645
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
3646
|
+
if (index < path.length) char = path[index];
|
|
3647
|
+
else if (char === "/") break;
|
|
3648
|
+
else char = "/";
|
|
3649
|
+
if (char === "/") {
|
|
3650
|
+
if (lastSlash === index - 1 || dots === 1);
|
|
3651
|
+
else if (dots === 2) {
|
|
3652
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
3653
|
+
if (res.length > 2) {
|
|
3654
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
3655
|
+
if (lastSlashIndex === -1) {
|
|
3656
|
+
res = "";
|
|
3657
|
+
lastSegmentLength = 0;
|
|
3658
|
+
} else {
|
|
3659
|
+
res = res.slice(0, lastSlashIndex);
|
|
3660
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
3661
|
+
}
|
|
3662
|
+
lastSlash = index;
|
|
3663
|
+
dots = 0;
|
|
3664
|
+
continue;
|
|
3665
|
+
} else if (res.length > 0) {
|
|
3666
|
+
res = "";
|
|
3667
|
+
lastSegmentLength = 0;
|
|
3668
|
+
lastSlash = index;
|
|
3669
|
+
dots = 0;
|
|
3670
|
+
continue;
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
if (allowAboveRoot) {
|
|
3674
|
+
res += res.length > 0 ? "/.." : "..";
|
|
3675
|
+
lastSegmentLength = 2;
|
|
3676
|
+
}
|
|
3677
|
+
} else {
|
|
3678
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
3679
|
+
else res = path.slice(lastSlash + 1, index);
|
|
3680
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
3681
|
+
}
|
|
3682
|
+
lastSlash = index;
|
|
3683
|
+
dots = 0;
|
|
3684
|
+
} else if (char === "." && dots !== -1) ++dots;
|
|
3685
|
+
else dots = -1;
|
|
3686
|
+
}
|
|
3687
|
+
return res;
|
|
3688
|
+
}
|
|
3689
|
+
const isAbsolute = function(p) {
|
|
3690
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
3691
|
+
};
|
|
3692
|
+
//#endregion
|
|
3693
|
+
//#region ../../../node_modules/.pnpm/@vitest+runner@4.1.11/node_modules/@vitest/runner/dist/chunk-artifact.js
|
|
3589
3694
|
var PendingError = class extends Error {
|
|
3590
3695
|
code = "VITEST_PENDING";
|
|
3591
3696
|
taskId;
|
|
@@ -3611,6 +3716,9 @@ const hooksMap = /* @__PURE__ */ new WeakMap();
|
|
|
3611
3716
|
function setFn(key, fn) {
|
|
3612
3717
|
fnMap.set(key, fn);
|
|
3613
3718
|
}
|
|
3719
|
+
function getFn(key) {
|
|
3720
|
+
return fnMap.get(key);
|
|
3721
|
+
}
|
|
3614
3722
|
function setTestFixture(key, fixture) {
|
|
3615
3723
|
testFixtureMap.set(key, fixture);
|
|
3616
3724
|
}
|
|
@@ -3666,9 +3774,10 @@ var TestFixtures = class TestFixtures {
|
|
|
3666
3774
|
TestFixtures._definitions.push(this);
|
|
3667
3775
|
}
|
|
3668
3776
|
extend(runner, userFixtures) {
|
|
3669
|
-
const { suite } = getCurrentSuite();
|
|
3777
|
+
const { suite } = getCurrentSuite$1();
|
|
3670
3778
|
const isTopLevel = !suite || suite.file === suite;
|
|
3671
|
-
|
|
3779
|
+
const registrations = this.parseUserFixtures(runner, userFixtures, isTopLevel);
|
|
3780
|
+
return new TestFixtures(registrations);
|
|
3672
3781
|
}
|
|
3673
3782
|
get(suite) {
|
|
3674
3783
|
let currentSuite = suite;
|
|
@@ -3681,7 +3790,7 @@ var TestFixtures = class TestFixtures {
|
|
|
3681
3790
|
return this._registrations;
|
|
3682
3791
|
}
|
|
3683
3792
|
override(runner, userFixtures) {
|
|
3684
|
-
const { suite: currentSuite, file } = getCurrentSuite();
|
|
3793
|
+
const { suite: currentSuite, file } = getCurrentSuite$1();
|
|
3685
3794
|
const suite = currentSuite || file;
|
|
3686
3795
|
const isTopLevel = !currentSuite || currentSuite.file === currentSuite;
|
|
3687
3796
|
const suiteRegistrations = new Map(this.get(suite));
|
|
@@ -3766,7 +3875,7 @@ var TestFixtures = class TestFixtures {
|
|
|
3766
3875
|
const cleanupFnArrayMap = /* @__PURE__ */ new WeakMap();
|
|
3767
3876
|
const contextHasFixturesCache = /* @__PURE__ */ new WeakMap();
|
|
3768
3877
|
function withFixtures(fn, options) {
|
|
3769
|
-
const collector = getCurrentSuite();
|
|
3878
|
+
const collector = getCurrentSuite$1();
|
|
3770
3879
|
const suite = options?.suite || collector.suite || collector.file;
|
|
3771
3880
|
return async (hookContext) => {
|
|
3772
3881
|
const context = hookContext || options?.context;
|
|
@@ -3887,8 +3996,10 @@ function resolveDeps(usedFixtures, registrations, depSet = /* @__PURE__ */ new S
|
|
|
3887
3996
|
pendingFixtures.push(fixture);
|
|
3888
3997
|
return;
|
|
3889
3998
|
}
|
|
3890
|
-
if (depSet.has(fixture))
|
|
3891
|
-
|
|
3999
|
+
if (depSet.has(fixture)) {
|
|
4000
|
+
if (fixture.parent) fixture = fixture.parent;
|
|
4001
|
+
else throw new Error(`Circular fixture dependency detected: ${fixture.name} <- ${[...depSet].reverse().map((d) => d.name).join(" <- ")}`);
|
|
4002
|
+
}
|
|
3892
4003
|
depSet.add(fixture);
|
|
3893
4004
|
resolveDeps([...fixture.deps].map((n) => n === fixture.name ? fixture.parent : registrations.get(n)).filter((n) => !!n), registrations, depSet, pendingFixtures);
|
|
3894
4005
|
pendingFixtures.push(fixture);
|
|
@@ -3962,10 +4073,7 @@ function splitByComma(s) {
|
|
|
3962
4073
|
if (lastToken) result.push(lastToken);
|
|
3963
4074
|
return result;
|
|
3964
4075
|
}
|
|
3965
|
-
|
|
3966
|
-
function getCurrentTest() {
|
|
3967
|
-
return _test;
|
|
3968
|
-
}
|
|
4076
|
+
function getCurrentTest() {}
|
|
3969
4077
|
const kChainableContext = Symbol("kChainableContext");
|
|
3970
4078
|
function getChainableContext(chainable) {
|
|
3971
4079
|
return chainable?.[kChainableContext];
|
|
@@ -4032,7 +4140,7 @@ function beforeAll(fn, timeout = getDefaultHookTimeout()) {
|
|
|
4032
4140
|
assertTypes(fn, "\"beforeAll\" callback", ["function"]);
|
|
4033
4141
|
const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
|
|
4034
4142
|
const context = getChainableContext(this);
|
|
4035
|
-
return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(withSuiteFixtures("beforeAll", fn, context, stackTraceError), timeout, true, stackTraceError), {
|
|
4143
|
+
return getCurrentSuite$1().on("beforeAll", Object.assign(withTimeout(withSuiteFixtures("beforeAll", fn, context, stackTraceError), timeout, true, stackTraceError), {
|
|
4036
4144
|
[CLEANUP_TIMEOUT_KEY]: timeout,
|
|
4037
4145
|
[CLEANUP_STACK_TRACE_KEY]: stackTraceError
|
|
4038
4146
|
}));
|
|
@@ -4058,7 +4166,7 @@ function afterAll(fn, timeout) {
|
|
|
4058
4166
|
assertTypes(fn, "\"afterAll\" callback", ["function"]);
|
|
4059
4167
|
const context = getChainableContext(this);
|
|
4060
4168
|
const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
|
|
4061
|
-
return getCurrentSuite().on("afterAll", withTimeout(withSuiteFixtures("afterAll", fn, context, stackTraceError), timeout ?? getDefaultHookTimeout(), true, stackTraceError));
|
|
4169
|
+
return getCurrentSuite$1().on("afterAll", withTimeout(withSuiteFixtures("afterAll", fn, context, stackTraceError), timeout ?? getDefaultHookTimeout(), true, stackTraceError));
|
|
4062
4170
|
}
|
|
4063
4171
|
/**
|
|
4064
4172
|
* Registers a callback function to be executed before each test within the current suite.
|
|
@@ -4083,7 +4191,7 @@ function beforeEach(fn, timeout = getDefaultHookTimeout()) {
|
|
|
4083
4191
|
const wrapper = (context, suite) => {
|
|
4084
4192
|
return withFixtures(fn, { suite })(context);
|
|
4085
4193
|
};
|
|
4086
|
-
return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
|
|
4194
|
+
return getCurrentSuite$1().on("beforeEach", Object.assign(withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
|
|
4087
4195
|
[CLEANUP_TIMEOUT_KEY]: timeout,
|
|
4088
4196
|
[CLEANUP_STACK_TRACE_KEY]: stackTraceError
|
|
4089
4197
|
}));
|
|
@@ -4110,16 +4218,8 @@ function afterEach(fn, timeout) {
|
|
|
4110
4218
|
const wrapper = (context, suite) => {
|
|
4111
4219
|
return withFixtures(fn, { suite })(context);
|
|
4112
4220
|
};
|
|
4113
|
-
return getCurrentSuite().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
4221
|
+
return getCurrentSuite$1().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
4114
4222
|
}
|
|
4115
|
-
createTestHook("onTestFailed", (test, handler, timeout) => {
|
|
4116
|
-
test.onFailed ||= [];
|
|
4117
|
-
test.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
4118
|
-
});
|
|
4119
|
-
createTestHook("onTestFinished", (test, handler, timeout) => {
|
|
4120
|
-
test.onFinished ||= [];
|
|
4121
|
-
test.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
4122
|
-
});
|
|
4123
4223
|
/**
|
|
4124
4224
|
* Registers a callback function that wraps around all tests within the current suite.
|
|
4125
4225
|
* The callback receives a `runSuite` function that must be called to run the suite's tests.
|
|
@@ -4152,7 +4252,7 @@ function aroundAll(fn, timeout) {
|
|
|
4152
4252
|
const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
|
|
4153
4253
|
const resolvedTimeout = timeout ?? getDefaultHookTimeout();
|
|
4154
4254
|
const context = getChainableContext(this);
|
|
4155
|
-
return getCurrentSuite().on("aroundAll", Object.assign(withSuiteFixtures("aroundAll", fn, context, stackTraceError, 1), {
|
|
4255
|
+
return getCurrentSuite$1().on("aroundAll", Object.assign(withSuiteFixtures("aroundAll", fn, context, stackTraceError, 1), {
|
|
4156
4256
|
[AROUND_TIMEOUT_KEY]: resolvedTimeout,
|
|
4157
4257
|
[AROUND_STACK_TRACE_KEY]: stackTraceError
|
|
4158
4258
|
}));
|
|
@@ -4195,7 +4295,7 @@ function aroundEach(fn, timeout) {
|
|
|
4195
4295
|
});
|
|
4196
4296
|
return withFixtures(innerFn, { suite })(context);
|
|
4197
4297
|
};
|
|
4198
|
-
return getCurrentSuite().on("aroundEach", Object.assign(wrapper, {
|
|
4298
|
+
return getCurrentSuite$1().on("aroundEach", Object.assign(wrapper, {
|
|
4199
4299
|
[AROUND_TIMEOUT_KEY]: resolvedTimeout,
|
|
4200
4300
|
[AROUND_STACK_TRACE_KEY]: stackTraceError
|
|
4201
4301
|
}));
|
|
@@ -4219,14 +4319,6 @@ function withSuiteFixtures(suiteHook, fn, context, stackTraceError, contextIndex
|
|
|
4219
4319
|
})();
|
|
4220
4320
|
};
|
|
4221
4321
|
}
|
|
4222
|
-
function createTestHook(name, handler) {
|
|
4223
|
-
return (fn, timeout) => {
|
|
4224
|
-
assertTypes(fn, `"${name}" callback`, ["function"]);
|
|
4225
|
-
const current = getCurrentTest();
|
|
4226
|
-
if (!current) throw new Error(`Hook ${name}() can only be called inside a test`);
|
|
4227
|
-
return handler(current, fn, timeout);
|
|
4228
|
-
};
|
|
4229
|
-
}
|
|
4230
4322
|
function findTestFileStackTrace(testFilePath, error) {
|
|
4231
4323
|
const lines = error.split("\n").slice(1);
|
|
4232
4324
|
for (const line of lines) {
|
|
@@ -4234,6 +4326,21 @@ function findTestFileStackTrace(testFilePath, error) {
|
|
|
4234
4326
|
if (stack && stack.file === testFilePath) return stack;
|
|
4235
4327
|
}
|
|
4236
4328
|
}
|
|
4329
|
+
const filterMap = /* @__PURE__ */ new WeakMap();
|
|
4330
|
+
/**
|
|
4331
|
+
* @experimental
|
|
4332
|
+
*/
|
|
4333
|
+
function matchesTags(testTags) {
|
|
4334
|
+
const runner = getRunner();
|
|
4335
|
+
const tagsFilter = runner._currentSpecification?.testTagsFilter ?? runner.config.tagsFilter;
|
|
4336
|
+
if (!tagsFilter) return true;
|
|
4337
|
+
let tagsFilterPredicate = filterMap.get(tagsFilter);
|
|
4338
|
+
if (!tagsFilterPredicate) {
|
|
4339
|
+
tagsFilterPredicate = createTagsFilter(tagsFilter, runner.config.tags);
|
|
4340
|
+
filterMap.set(tagsFilter, tagsFilterPredicate);
|
|
4341
|
+
}
|
|
4342
|
+
return tagsFilterPredicate(testTags);
|
|
4343
|
+
}
|
|
4237
4344
|
function validateTags(config, tags) {
|
|
4238
4345
|
if (!config.strictTags) return;
|
|
4239
4346
|
const availableTags = new Set(config.tags.map((tag) => tag.name));
|
|
@@ -4243,6 +4350,215 @@ function createNoTagsError(availableTags, tag, prefix = "tag") {
|
|
|
4243
4350
|
if (!availableTags.length) throw new Error(`The Vitest config does't define any "tags", cannot apply "${tag}" ${prefix} for this test. See: https://vitest.dev/guide/test-tags`);
|
|
4244
4351
|
throw new Error(`The ${prefix} "${tag}" is not defined in the configuration. Available tags are:\n${availableTags.map((t) => `- ${t.name}${t.description ? `: ${t.description}` : ""}`).join("\n")}`);
|
|
4245
4352
|
}
|
|
4353
|
+
function createTagsFilter(tagsExpr, availableTags) {
|
|
4354
|
+
const matchers = tagsExpr.map((expr) => parseTagsExpression(expr, availableTags));
|
|
4355
|
+
return (testTags) => {
|
|
4356
|
+
return matchers.every((matcher) => matcher(testTags));
|
|
4357
|
+
};
|
|
4358
|
+
}
|
|
4359
|
+
function parseTagsExpression(expr, availableTags) {
|
|
4360
|
+
const stream = new TokenStream(tokenize(expr), expr);
|
|
4361
|
+
const ast = parseOrExpression(stream, availableTags);
|
|
4362
|
+
if (stream.peek().type !== "EOF") throw new Error(`Invalid tags expression: unexpected "${formatToken(stream.peek())}" in "${expr}"`);
|
|
4363
|
+
return (tags) => evaluateNode(ast, tags);
|
|
4364
|
+
}
|
|
4365
|
+
function formatToken(token) {
|
|
4366
|
+
switch (token.type) {
|
|
4367
|
+
case "TAG": return token.value;
|
|
4368
|
+
default: return formatTokenType(token.type);
|
|
4369
|
+
}
|
|
4370
|
+
}
|
|
4371
|
+
function tokenize(expr) {
|
|
4372
|
+
const tokens = [];
|
|
4373
|
+
let i = 0;
|
|
4374
|
+
while (i < expr.length) {
|
|
4375
|
+
if (expr[i] === " " || expr[i] === " ") {
|
|
4376
|
+
i++;
|
|
4377
|
+
continue;
|
|
4378
|
+
}
|
|
4379
|
+
if (expr[i] === "(") {
|
|
4380
|
+
tokens.push({ type: "LPAREN" });
|
|
4381
|
+
i++;
|
|
4382
|
+
continue;
|
|
4383
|
+
}
|
|
4384
|
+
if (expr[i] === ")") {
|
|
4385
|
+
tokens.push({ type: "RPAREN" });
|
|
4386
|
+
i++;
|
|
4387
|
+
continue;
|
|
4388
|
+
}
|
|
4389
|
+
if (expr[i] === "!") {
|
|
4390
|
+
tokens.push({ type: "NOT" });
|
|
4391
|
+
i++;
|
|
4392
|
+
continue;
|
|
4393
|
+
}
|
|
4394
|
+
if (expr.slice(i, i + 2) === "&&") {
|
|
4395
|
+
tokens.push({ type: "AND" });
|
|
4396
|
+
i += 2;
|
|
4397
|
+
continue;
|
|
4398
|
+
}
|
|
4399
|
+
if (expr.slice(i, i + 2) === "||") {
|
|
4400
|
+
tokens.push({ type: "OR" });
|
|
4401
|
+
i += 2;
|
|
4402
|
+
continue;
|
|
4403
|
+
}
|
|
4404
|
+
if (/^and(?:\s|\)|$)/i.test(expr.slice(i))) {
|
|
4405
|
+
tokens.push({ type: "AND" });
|
|
4406
|
+
i += 3;
|
|
4407
|
+
continue;
|
|
4408
|
+
}
|
|
4409
|
+
if (/^or(?:\s|\)|$)/i.test(expr.slice(i))) {
|
|
4410
|
+
tokens.push({ type: "OR" });
|
|
4411
|
+
i += 2;
|
|
4412
|
+
continue;
|
|
4413
|
+
}
|
|
4414
|
+
if (/^not\s/i.test(expr.slice(i))) {
|
|
4415
|
+
tokens.push({ type: "NOT" });
|
|
4416
|
+
i += 3;
|
|
4417
|
+
continue;
|
|
4418
|
+
}
|
|
4419
|
+
let tag = "";
|
|
4420
|
+
while (i < expr.length && expr[i] !== " " && expr[i] !== " " && expr[i] !== "(" && expr[i] !== ")" && expr[i] !== "!" && expr[i] !== "&" && expr[i] !== "|") {
|
|
4421
|
+
const remaining = expr.slice(i);
|
|
4422
|
+
if (tag === "" && (/^and(?:\s|\)|$)/i.test(remaining) || /^or(?:\s|\)|$)/i.test(remaining) || /^not\s/i.test(remaining))) break;
|
|
4423
|
+
tag += expr[i];
|
|
4424
|
+
i++;
|
|
4425
|
+
}
|
|
4426
|
+
if (tag) tokens.push({
|
|
4427
|
+
type: "TAG",
|
|
4428
|
+
value: tag
|
|
4429
|
+
});
|
|
4430
|
+
}
|
|
4431
|
+
tokens.push({ type: "EOF" });
|
|
4432
|
+
return tokens;
|
|
4433
|
+
}
|
|
4434
|
+
var TokenStream = class {
|
|
4435
|
+
pos = 0;
|
|
4436
|
+
constructor(tokens, expr) {
|
|
4437
|
+
this.tokens = tokens;
|
|
4438
|
+
this.expr = expr;
|
|
4439
|
+
}
|
|
4440
|
+
peek() {
|
|
4441
|
+
return this.tokens[this.pos];
|
|
4442
|
+
}
|
|
4443
|
+
next() {
|
|
4444
|
+
return this.tokens[this.pos++];
|
|
4445
|
+
}
|
|
4446
|
+
expect(type) {
|
|
4447
|
+
const token = this.next();
|
|
4448
|
+
if (token.type !== type) {
|
|
4449
|
+
if (type === "RPAREN" && token.type === "EOF") throw new Error(`Invalid tags expression: missing closing ")" in "${this.expr}"`);
|
|
4450
|
+
throw new Error(`Invalid tags expression: expected "${formatTokenType(type)}" but got "${formatToken(token)}" in "${this.expr}"`);
|
|
4451
|
+
}
|
|
4452
|
+
return token;
|
|
4453
|
+
}
|
|
4454
|
+
unexpectedToken() {
|
|
4455
|
+
const token = this.peek();
|
|
4456
|
+
if (token.type === "EOF") throw new Error(`Invalid tags expression: unexpected end of expression in "${this.expr}"`);
|
|
4457
|
+
throw new Error(`Invalid tags expression: unexpected "${formatToken(token)}" in "${this.expr}"`);
|
|
4458
|
+
}
|
|
4459
|
+
};
|
|
4460
|
+
function formatTokenType(type) {
|
|
4461
|
+
switch (type) {
|
|
4462
|
+
case "TAG": return "tag";
|
|
4463
|
+
case "AND": return "and";
|
|
4464
|
+
case "OR": return "or";
|
|
4465
|
+
case "NOT": return "not";
|
|
4466
|
+
case "LPAREN": return "(";
|
|
4467
|
+
case "RPAREN": return ")";
|
|
4468
|
+
case "EOF": return "end of expression";
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
function parseOrExpression(stream, availableTags) {
|
|
4472
|
+
let left = parseAndExpression(stream, availableTags);
|
|
4473
|
+
while (stream.peek().type === "OR") {
|
|
4474
|
+
stream.next();
|
|
4475
|
+
const right = parseAndExpression(stream, availableTags);
|
|
4476
|
+
left = {
|
|
4477
|
+
type: "or",
|
|
4478
|
+
left,
|
|
4479
|
+
right
|
|
4480
|
+
};
|
|
4481
|
+
}
|
|
4482
|
+
return left;
|
|
4483
|
+
}
|
|
4484
|
+
function parseAndExpression(stream, availableTags) {
|
|
4485
|
+
let left = parseUnaryExpression(stream, availableTags);
|
|
4486
|
+
while (stream.peek().type === "AND") {
|
|
4487
|
+
stream.next();
|
|
4488
|
+
const right = parseUnaryExpression(stream, availableTags);
|
|
4489
|
+
left = {
|
|
4490
|
+
type: "and",
|
|
4491
|
+
left,
|
|
4492
|
+
right
|
|
4493
|
+
};
|
|
4494
|
+
}
|
|
4495
|
+
return left;
|
|
4496
|
+
}
|
|
4497
|
+
function parseUnaryExpression(stream, availableTags) {
|
|
4498
|
+
if (stream.peek().type === "NOT") {
|
|
4499
|
+
stream.next();
|
|
4500
|
+
return {
|
|
4501
|
+
type: "not",
|
|
4502
|
+
operand: parseUnaryExpression(stream, availableTags)
|
|
4503
|
+
};
|
|
4504
|
+
}
|
|
4505
|
+
return parsePrimaryExpression(stream, availableTags);
|
|
4506
|
+
}
|
|
4507
|
+
function parsePrimaryExpression(stream, availableTags) {
|
|
4508
|
+
const token = stream.peek();
|
|
4509
|
+
if (token.type === "LPAREN") {
|
|
4510
|
+
stream.next();
|
|
4511
|
+
const expr = parseOrExpression(stream, availableTags);
|
|
4512
|
+
stream.expect("RPAREN");
|
|
4513
|
+
return expr;
|
|
4514
|
+
}
|
|
4515
|
+
if (token.type === "TAG") {
|
|
4516
|
+
stream.next();
|
|
4517
|
+
const tagValue = token.value;
|
|
4518
|
+
return {
|
|
4519
|
+
type: "tag",
|
|
4520
|
+
value: tagValue,
|
|
4521
|
+
pattern: resolveTagPattern(tagValue, availableTags)
|
|
4522
|
+
};
|
|
4523
|
+
}
|
|
4524
|
+
stream.unexpectedToken();
|
|
4525
|
+
}
|
|
4526
|
+
function createWildcardRegex(pattern) {
|
|
4527
|
+
return new RegExp(`^${pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`);
|
|
4528
|
+
}
|
|
4529
|
+
function resolveTagPattern(tagPattern, availableTags) {
|
|
4530
|
+
if (tagPattern.includes("*")) {
|
|
4531
|
+
const regex = createWildcardRegex(tagPattern);
|
|
4532
|
+
if (!availableTags.some((tag) => regex.test(tag.name))) throw createNoTagsError(availableTags, tagPattern, "tag pattern");
|
|
4533
|
+
return regex;
|
|
4534
|
+
}
|
|
4535
|
+
if (!availableTags.length || !availableTags.some((tag) => tag.name === tagPattern)) throw createNoTagsError(availableTags, tagPattern, "tag pattern");
|
|
4536
|
+
return null;
|
|
4537
|
+
}
|
|
4538
|
+
function evaluateNode(node, tags) {
|
|
4539
|
+
switch (node.type) {
|
|
4540
|
+
case "tag":
|
|
4541
|
+
if (node.pattern) return tags.some((tag) => node.pattern.test(tag));
|
|
4542
|
+
return tags.includes(node.value);
|
|
4543
|
+
case "not": return !evaluateNode(node.operand, tags);
|
|
4544
|
+
case "and": return evaluateNode(node.left, tags) && evaluateNode(node.right, tags);
|
|
4545
|
+
case "or": return evaluateNode(node.left, tags) || evaluateNode(node.right, tags);
|
|
4546
|
+
}
|
|
4547
|
+
}
|
|
4548
|
+
function isTestCase(s) {
|
|
4549
|
+
return s.type === "test";
|
|
4550
|
+
}
|
|
4551
|
+
function getTests(suite) {
|
|
4552
|
+
const tests = [];
|
|
4553
|
+
const arraySuites = toArray(suite);
|
|
4554
|
+
for (const s of arraySuites) if (isTestCase(s)) tests.push(s);
|
|
4555
|
+
else for (const task of s.tasks) if (isTestCase(task)) tests.push(task);
|
|
4556
|
+
else {
|
|
4557
|
+
const taskTests = getTests(task);
|
|
4558
|
+
for (const test of taskTests) tests.push(test);
|
|
4559
|
+
}
|
|
4560
|
+
return tests;
|
|
4561
|
+
}
|
|
4246
4562
|
function getNames(task) {
|
|
4247
4563
|
const names = [task.name];
|
|
4248
4564
|
let current = task;
|
|
@@ -4253,6 +4569,9 @@ function getNames(task) {
|
|
|
4253
4569
|
if (current !== task.file) names.unshift(task.file.name);
|
|
4254
4570
|
return names;
|
|
4255
4571
|
}
|
|
4572
|
+
function getTestName(task, separator = " > ") {
|
|
4573
|
+
return getNames(task).slice(1).join(separator);
|
|
4574
|
+
}
|
|
4256
4575
|
function createTaskName(names, separator = " > ") {
|
|
4257
4576
|
return names.filter((name) => name !== void 0).join(separator);
|
|
4258
4577
|
}
|
|
@@ -4317,8 +4636,7 @@ const suite = createSuite();
|
|
|
4317
4636
|
* ```
|
|
4318
4637
|
*/
|
|
4319
4638
|
const test$2 = createTest(function(name, optionsOrFn, optionsOrTest) {
|
|
4320
|
-
|
|
4321
|
-
getCurrentSuite().test.fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
|
|
4639
|
+
getCurrentSuite$1().test.fn.call(this, formatName$1(name), optionsOrFn, optionsOrTest);
|
|
4322
4640
|
});
|
|
4323
4641
|
/**
|
|
4324
4642
|
* Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
|
|
@@ -4394,9 +4712,8 @@ function assert$3(condition, message) {
|
|
|
4394
4712
|
}
|
|
4395
4713
|
function getRunner() {
|
|
4396
4714
|
assert$3(runner, "the runner");
|
|
4397
|
-
return runner;
|
|
4398
4715
|
}
|
|
4399
|
-
function getCurrentSuite() {
|
|
4716
|
+
function getCurrentSuite$1() {
|
|
4400
4717
|
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
4401
4718
|
assert$3(currentSuite, "the current suite");
|
|
4402
4719
|
return currentSuite;
|
|
@@ -4478,7 +4795,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
4478
4795
|
};
|
|
4479
4796
|
const handler = options.handler;
|
|
4480
4797
|
if (task.mode === "run" && !handler) task.mode = "todo";
|
|
4481
|
-
if (options.concurrent
|
|
4798
|
+
if (options.concurrent ?? (!options.sequential && runner.config.sequence.concurrent)) task.concurrent = true;
|
|
4482
4799
|
task.shuffle = suiteOptions?.shuffle;
|
|
4483
4800
|
const context = createTestContext(task, runner);
|
|
4484
4801
|
Object.defineProperty(task, "context", {
|
|
@@ -4509,7 +4826,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
4509
4826
|
if (options.concurrent != null && concurrent != null) options.concurrent = concurrent;
|
|
4510
4827
|
const sequential = this.sequential ?? (!this.concurrent && options?.sequential);
|
|
4511
4828
|
if (options.sequential != null && sequential != null) options.sequential = sequential;
|
|
4512
|
-
const test = task(formatName(name), {
|
|
4829
|
+
const test = task(formatName$1(name), {
|
|
4513
4830
|
...this,
|
|
4514
4831
|
...options,
|
|
4515
4832
|
handler
|
|
@@ -4584,7 +4901,6 @@ function withAwaitAsyncAssertions(fn, task) {
|
|
|
4584
4901
|
}
|
|
4585
4902
|
function createSuite() {
|
|
4586
4903
|
function suiteFn(name, factoryOrOptions, optionsOrFactory) {
|
|
4587
|
-
if (getCurrentTest()) throw new Error("Calling the suite function inside test function is not allowed. It can be only called at the top level or inside another suite function.");
|
|
4588
4904
|
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
4589
4905
|
let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
|
|
4590
4906
|
const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false;
|
|
@@ -4594,7 +4910,7 @@ function createSuite() {
|
|
|
4594
4910
|
...parentOptions,
|
|
4595
4911
|
...options
|
|
4596
4912
|
};
|
|
4597
|
-
const shuffle = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ??
|
|
4913
|
+
const shuffle = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ?? void 0;
|
|
4598
4914
|
if (shuffle != null) options.shuffle = shuffle;
|
|
4599
4915
|
let mode = this.only ?? options.only ? "only" : this.skip ?? options.skip ? "skip" : this.todo ?? options.todo ? "todo" : "run";
|
|
4600
4916
|
if (mode === "run" && !factory) mode = "todo";
|
|
@@ -4603,7 +4919,7 @@ function createSuite() {
|
|
|
4603
4919
|
if (isConcurrent != null) options.concurrent = isConcurrent && !isSequential;
|
|
4604
4920
|
if (isSequential != null) options.sequential = isSequential && !isConcurrent;
|
|
4605
4921
|
if (parentMeta) options.meta = Object.assign(Object.create(null), parentMeta, options.meta);
|
|
4606
|
-
return createSuiteCollector(formatName(name), factory, mode, this.each, options);
|
|
4922
|
+
return createSuiteCollector(formatName$1(name), factory, mode, this.each, options);
|
|
4607
4923
|
}
|
|
4608
4924
|
suiteFn.each = function(cases, ...args) {
|
|
4609
4925
|
const context = getChainableContext(this);
|
|
@@ -4611,15 +4927,16 @@ function createSuite() {
|
|
|
4611
4927
|
context.setContext("each", true);
|
|
4612
4928
|
if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
|
|
4613
4929
|
return (name, optionsOrFn, fnOrOptions) => {
|
|
4614
|
-
const _name = formatName(name);
|
|
4930
|
+
const _name = formatName$1(name);
|
|
4615
4931
|
const arrayOnlyCases = cases.every(Array.isArray);
|
|
4616
4932
|
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
4617
4933
|
const fnFirst = typeof optionsOrFn === "function";
|
|
4618
4934
|
cases.forEach((i, idx) => {
|
|
4619
4935
|
const items = Array.isArray(i) ? i : [i];
|
|
4620
|
-
if (fnFirst)
|
|
4621
|
-
|
|
4622
|
-
|
|
4936
|
+
if (fnFirst) {
|
|
4937
|
+
if (arrayOnlyCases) suite(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
4938
|
+
else suite(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
|
|
4939
|
+
} else if (arrayOnlyCases) suite(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
4623
4940
|
else suite(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
|
|
4624
4941
|
});
|
|
4625
4942
|
context.setContext("each", void 0);
|
|
@@ -4628,7 +4945,7 @@ function createSuite() {
|
|
|
4628
4945
|
suiteFn.for = function(cases, ...args) {
|
|
4629
4946
|
if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
|
|
4630
4947
|
return (name, optionsOrFn, fnOrOptions) => {
|
|
4631
|
-
const name_ = formatName(name);
|
|
4948
|
+
const name_ = formatName$1(name);
|
|
4632
4949
|
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
4633
4950
|
cases.forEach((item, idx) => {
|
|
4634
4951
|
suite(formatTitle(name_, toArray(item), idx), options, handler ? () => handler(item) : void 0);
|
|
@@ -4654,15 +4971,16 @@ function createTaskCollector(fn) {
|
|
|
4654
4971
|
context.setContext("each", true);
|
|
4655
4972
|
if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
|
|
4656
4973
|
return (name, optionsOrFn, fnOrOptions) => {
|
|
4657
|
-
const _name = formatName(name);
|
|
4974
|
+
const _name = formatName$1(name);
|
|
4658
4975
|
const arrayOnlyCases = cases.every(Array.isArray);
|
|
4659
4976
|
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
4660
4977
|
const fnFirst = typeof optionsOrFn === "function";
|
|
4661
4978
|
cases.forEach((i, idx) => {
|
|
4662
4979
|
const items = Array.isArray(i) ? i : [i];
|
|
4663
|
-
if (fnFirst)
|
|
4664
|
-
|
|
4665
|
-
|
|
4980
|
+
if (fnFirst) {
|
|
4981
|
+
if (arrayOnlyCases) test(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
4982
|
+
else test(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
|
|
4983
|
+
} else if (arrayOnlyCases) test(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
4666
4984
|
else test(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
|
|
4667
4985
|
});
|
|
4668
4986
|
context.setContext("each", void 0);
|
|
@@ -4672,7 +4990,7 @@ function createTaskCollector(fn) {
|
|
|
4672
4990
|
const test = getChainableContext(this).withContext();
|
|
4673
4991
|
if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
|
|
4674
4992
|
return (name, optionsOrFn, fnOrOptions) => {
|
|
4675
|
-
const _name = formatName(name);
|
|
4993
|
+
const _name = formatName$1(name);
|
|
4676
4994
|
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
4677
4995
|
cases.forEach((item, idx) => {
|
|
4678
4996
|
const handlerWrapper = handler ? (ctx) => handler(item, ctx) : void 0;
|
|
@@ -4740,7 +5058,7 @@ function createTaskCollector(fn) {
|
|
|
4740
5058
|
const userFixtures = parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn);
|
|
4741
5059
|
const fixtures = getChainableContext(this).getFixtures().extend(runner, userFixtures);
|
|
4742
5060
|
const _test = createTest(function(name, optionsOrFn, optionsOrTest) {
|
|
4743
|
-
fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
|
|
5061
|
+
fn.call(this, formatName$1(name), optionsOrFn, optionsOrTest);
|
|
4744
5062
|
});
|
|
4745
5063
|
getChainableContext(_test).mergeContext({ fixtures });
|
|
4746
5064
|
return _test;
|
|
@@ -4765,7 +5083,7 @@ function createTaskCollector(fn) {
|
|
|
4765
5083
|
function createTest(fn) {
|
|
4766
5084
|
return createTaskCollector(fn);
|
|
4767
5085
|
}
|
|
4768
|
-
function formatName(name) {
|
|
5086
|
+
function formatName$1(name) {
|
|
4769
5087
|
return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
|
|
4770
5088
|
}
|
|
4771
5089
|
function formatTitle(template, items, idx) {
|
|
@@ -4786,7 +5104,7 @@ function formatTitle(template, items, idx) {
|
|
|
4786
5104
|
const isArrayKey = /^\d+$/.test(key);
|
|
4787
5105
|
if (!isObjectItem && !isArrayKey) return `$${key}`;
|
|
4788
5106
|
const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
|
|
4789
|
-
return objDisplay$1(isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement, { truncate:
|
|
5107
|
+
return objDisplay$1(isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement, { truncate: void 0 });
|
|
4790
5108
|
});
|
|
4791
5109
|
}
|
|
4792
5110
|
let output = "";
|
|
@@ -4955,7 +5273,7 @@ function makeTimeoutError(isHook, timeout, stackTraceError) {
|
|
|
4955
5273
|
}
|
|
4956
5274
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
4957
5275
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
4958
|
-
|
|
5276
|
+
Date.now;
|
|
4959
5277
|
const { clearTimeout, setTimeout: setTimeout$1 } = getSafeTimers();
|
|
4960
5278
|
const packs = /* @__PURE__ */ new Map();
|
|
4961
5279
|
const eventsPacks = [];
|
|
@@ -4982,21 +5300,6 @@ async function finishSendTasksUpdate(runner) {
|
|
|
4982
5300
|
sendTasksUpdate(runner);
|
|
4983
5301
|
await Promise.all(pendingTasksUpdates);
|
|
4984
5302
|
}
|
|
4985
|
-
function throttle(fn, ms) {
|
|
4986
|
-
let last = 0;
|
|
4987
|
-
let pendingCall;
|
|
4988
|
-
return function call(...args) {
|
|
4989
|
-
const now = unixNow();
|
|
4990
|
-
if (now - last > ms) {
|
|
4991
|
-
last = now;
|
|
4992
|
-
clearTimeout(pendingCall);
|
|
4993
|
-
pendingCall = void 0;
|
|
4994
|
-
return fn.apply(this, args);
|
|
4995
|
-
}
|
|
4996
|
-
pendingCall ??= setTimeout$1(() => call.bind(this)(...args), ms);
|
|
4997
|
-
};
|
|
4998
|
-
}
|
|
4999
|
-
throttle(sendTasksUpdate, 100);
|
|
5000
5303
|
/**
|
|
5001
5304
|
* @experimental
|
|
5002
5305
|
* @advanced
|
|
@@ -5119,7 +5422,7 @@ function manageArtifactAttachment(attachment) {
|
|
|
5119
5422
|
if (attachment.body != null) attachment.bodyEncoding ??= "base64";
|
|
5120
5423
|
}
|
|
5121
5424
|
//#endregion
|
|
5122
|
-
//#region ../../../node_modules/.pnpm/vitest@4.1.
|
|
5425
|
+
//#region ../../../node_modules/.pnpm/vitest@4.1.11_@types+node@26.2.0_vite@7.3.2_@types+node@26.2.0_jiti@2.6.1_lightningcss@1.32.0_tsx@4.23.12_yaml@2.9.0_/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
|
|
5123
5426
|
const NAME_WORKER_STATE = "__vitest_worker__";
|
|
5124
5427
|
function getWorkerState() {
|
|
5125
5428
|
const workerState = globalThis[NAME_WORKER_STATE];
|
|
@@ -5159,7 +5462,40 @@ async function waitForImportsToResolve() {
|
|
|
5159
5462
|
await waitForImportsToResolve();
|
|
5160
5463
|
}
|
|
5161
5464
|
//#endregion
|
|
5162
|
-
//#region ../../../node_modules/.pnpm
|
|
5465
|
+
//#region ../../../node_modules/.pnpm/vitest@4.1.11_@types+node@26.2.0_vite@7.3.2_@types+node@26.2.0_jiti@2.6.1_lightningcss@1.32.0_tsx@4.23.12_yaml@2.9.0_/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js
|
|
5466
|
+
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
5467
|
+
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
5468
|
+
function getBenchOptions(key) {
|
|
5469
|
+
return benchOptsMap.get(key);
|
|
5470
|
+
}
|
|
5471
|
+
function getBenchFn(key) {
|
|
5472
|
+
return benchFns.get(key);
|
|
5473
|
+
}
|
|
5474
|
+
createBenchmark(function(name, fn = noop, options = {}) {
|
|
5475
|
+
if (getWorkerState().config.mode !== "benchmark") throw new Error("`bench()` is only available in benchmark mode.");
|
|
5476
|
+
const task = getCurrentSuite$1().task(formatName(name), {
|
|
5477
|
+
...this,
|
|
5478
|
+
meta: { benchmark: true }
|
|
5479
|
+
});
|
|
5480
|
+
benchFns.set(task, fn);
|
|
5481
|
+
benchOptsMap.set(task, options);
|
|
5482
|
+
if (!this.todo && task.mode === "todo") task.mode = "run";
|
|
5483
|
+
});
|
|
5484
|
+
function createBenchmark(fn) {
|
|
5485
|
+
const benchmark = createChainable([
|
|
5486
|
+
"skip",
|
|
5487
|
+
"only",
|
|
5488
|
+
"todo"
|
|
5489
|
+
], fn);
|
|
5490
|
+
benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
|
|
5491
|
+
benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
|
|
5492
|
+
return benchmark;
|
|
5493
|
+
}
|
|
5494
|
+
function formatName(name) {
|
|
5495
|
+
return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
|
|
5496
|
+
}
|
|
5497
|
+
//#endregion
|
|
5498
|
+
//#region ../../../node_modules/.pnpm/@vitest+spy@4.1.11/node_modules/@vitest/spy/dist/index.js
|
|
5163
5499
|
function isMockFunction(fn) {
|
|
5164
5500
|
return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true;
|
|
5165
5501
|
}
|
|
@@ -5483,7 +5819,7 @@ function copyOriginalStaticProperties(mock, original) {
|
|
|
5483
5819
|
Object.defineProperty(mock, key, descriptor);
|
|
5484
5820
|
}
|
|
5485
5821
|
}
|
|
5486
|
-
const ignoreProperties = new Set([
|
|
5822
|
+
const ignoreProperties = /* @__PURE__ */ new Set([
|
|
5487
5823
|
"length",
|
|
5488
5824
|
"name",
|
|
5489
5825
|
"prototype",
|
|
@@ -6279,13 +6615,14 @@ function inspect2(obj, showHidden, depth, colors) {
|
|
|
6279
6615
|
__name(inspect2, "inspect");
|
|
6280
6616
|
function objDisplay(obj) {
|
|
6281
6617
|
let str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
|
|
6282
|
-
if (config.truncateThreshold && str.length >= config.truncateThreshold)
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6618
|
+
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
|
6619
|
+
if (type3 === "[object Function]") return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
|
|
6620
|
+
else if (type3 === "[object Array]") return "[ Array(" + obj.length + ") ]";
|
|
6621
|
+
else if (type3 === "[object Object]") {
|
|
6622
|
+
let keys = Object.keys(obj);
|
|
6623
|
+
return "{ Object (" + (keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ")) + ") }";
|
|
6624
|
+
} else return str;
|
|
6287
6625
|
} else return str;
|
|
6288
|
-
else return str;
|
|
6289
6626
|
}
|
|
6290
6627
|
__name(objDisplay, "objDisplay");
|
|
6291
6628
|
function getMessage2(obj, args) {
|
|
@@ -6968,7 +7305,8 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
|
6968
7305
|
Object.setPrototypeOf(chainableMethodWrapper, prototype);
|
|
6969
7306
|
} else Object.getOwnPropertyNames(ctx).forEach(function(asserterName) {
|
|
6970
7307
|
if (excludeNames.indexOf(asserterName) !== -1) return;
|
|
6971
|
-
|
|
7308
|
+
let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
|
7309
|
+
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
|
6972
7310
|
});
|
|
6973
7311
|
transferFlags(this, chainableMethodWrapper);
|
|
6974
7312
|
return proxify(chainableMethodWrapper);
|
|
@@ -7600,17 +7938,23 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7600
7938
|
}
|
|
7601
7939
|
if (errorLike && caughtErr) {
|
|
7602
7940
|
if (errorLike instanceof Error) {
|
|
7603
|
-
if (check_error_exports.compatibleInstance(caughtErr, errorLike) === negate)
|
|
7604
|
-
|
|
7941
|
+
if (check_error_exports.compatibleInstance(caughtErr, errorLike) === negate) {
|
|
7942
|
+
if (everyArgIsDefined && negate) errorLikeFail = true;
|
|
7943
|
+
else this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr && !negate ? " but #{act} was thrown" : ""), errorLike.toString(), caughtErr.toString());
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
if (check_error_exports.compatibleConstructor(caughtErr, errorLike) === negate) {
|
|
7947
|
+
if (everyArgIsDefined && negate) errorLikeFail = true;
|
|
7948
|
+
else this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr));
|
|
7605
7949
|
}
|
|
7606
|
-
if (check_error_exports.compatibleConstructor(caughtErr, errorLike) === negate) if (everyArgIsDefined && negate) errorLikeFail = true;
|
|
7607
|
-
else this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr));
|
|
7608
7950
|
}
|
|
7609
7951
|
if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
|
|
7610
7952
|
let placeholder = "including";
|
|
7611
7953
|
if (isRegExp2(errMsgMatcher)) placeholder = "matching";
|
|
7612
|
-
if (check_error_exports.compatibleMessage(caughtErr, errMsgMatcher) === negate)
|
|
7613
|
-
|
|
7954
|
+
if (check_error_exports.compatibleMessage(caughtErr, errMsgMatcher) === negate) {
|
|
7955
|
+
if (everyArgIsDefined && negate) errMsgMatcherFail = true;
|
|
7956
|
+
else this.assert(negate, "expected #{this} to throw error " + placeholder + " #{exp} but got #{act}", "expected #{this} to throw error not " + placeholder + " #{exp}", errMsgMatcher, check_error_exports.getMessage(caughtErr));
|
|
7957
|
+
}
|
|
7614
7958
|
}
|
|
7615
7959
|
if (errorLikeFail && errMsgMatcherFail) this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr));
|
|
7616
7960
|
flag2(this, "object", caughtErr);
|
|
@@ -7840,8 +8184,10 @@ function compareSubset(expected, actual) {
|
|
|
7840
8184
|
});
|
|
7841
8185
|
});
|
|
7842
8186
|
}
|
|
7843
|
-
if (expected instanceof Date)
|
|
7844
|
-
|
|
8187
|
+
if (expected instanceof Date) {
|
|
8188
|
+
if (actual instanceof Date) return expected.getTime() === actual.getTime();
|
|
8189
|
+
else return false;
|
|
8190
|
+
}
|
|
7845
8191
|
return Object.keys(expected).every(function(key) {
|
|
7846
8192
|
let expectedValue = expected[key];
|
|
7847
8193
|
let actualValue = actual[key];
|
|
@@ -8512,7 +8858,7 @@ function use(fn) {
|
|
|
8512
8858
|
}
|
|
8513
8859
|
__name(use, "use");
|
|
8514
8860
|
//#endregion
|
|
8515
|
-
//#region ../../../node_modules/.pnpm/@vitest+expect@4.1.
|
|
8861
|
+
//#region ../../../node_modules/.pnpm/@vitest+expect@4.1.11/node_modules/@vitest/expect/dist/index.js
|
|
8516
8862
|
const ChaiStyleAssertions = (chai, utils) => {
|
|
8517
8863
|
function defProperty(name, delegateTo) {
|
|
8518
8864
|
utils.addProperty(chai.Assertion.prototype, name, function() {
|
|
@@ -9351,8 +9697,12 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9351
9697
|
if (promise === "rejects") utils.flag(this, "object", () => {
|
|
9352
9698
|
throw object;
|
|
9353
9699
|
});
|
|
9354
|
-
else if (promise === "resolves" && typeof object !== "function")
|
|
9355
|
-
|
|
9700
|
+
else if (promise === "resolves" && typeof object !== "function") {
|
|
9701
|
+
if (!isNot) {
|
|
9702
|
+
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
9703
|
+
throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
|
|
9704
|
+
} else return;
|
|
9705
|
+
}
|
|
9356
9706
|
_super.apply(this, args);
|
|
9357
9707
|
};
|
|
9358
9708
|
});
|
|
@@ -9411,7 +9761,8 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9411
9761
|
actualSubset,
|
|
9412
9762
|
false
|
|
9413
9763
|
]);
|
|
9414
|
-
|
|
9764
|
+
const message = stripped === 0 ? msg : `${msg}\n(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
|
|
9765
|
+
throw new AssertionError(message, {
|
|
9415
9766
|
showDiff: true,
|
|
9416
9767
|
expected,
|
|
9417
9768
|
actual: actualSubset
|
|
@@ -9644,9 +9995,12 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9644
9995
|
const isNot = utils.flag(this, "negate");
|
|
9645
9996
|
let thrown = null;
|
|
9646
9997
|
if (promise === "rejects") thrown = obj;
|
|
9647
|
-
else if (promise === "resolves" && typeof obj !== "function")
|
|
9648
|
-
|
|
9649
|
-
|
|
9998
|
+
else if (promise === "resolves" && typeof obj !== "function") {
|
|
9999
|
+
if (!isNot) {
|
|
10000
|
+
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
10001
|
+
throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
|
|
10002
|
+
} else return;
|
|
10003
|
+
} else {
|
|
9650
10004
|
let isThrow = false;
|
|
9651
10005
|
try {
|
|
9652
10006
|
obj();
|
|
@@ -9654,7 +10008,10 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9654
10008
|
isThrow = true;
|
|
9655
10009
|
thrown = err;
|
|
9656
10010
|
}
|
|
9657
|
-
if (!isThrow && !isNot)
|
|
10011
|
+
if (!isThrow && !isNot) {
|
|
10012
|
+
const message = utils.flag(this, "message") || "expected function to throw an error, but it didn't";
|
|
10013
|
+
throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
|
|
10014
|
+
}
|
|
9658
10015
|
}
|
|
9659
10016
|
if (typeof expected === "function") {
|
|
9660
10017
|
const name = expected.name || expected.prototype.constructor.name;
|
|
@@ -9724,7 +10081,8 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9724
10081
|
`expected "${spyName}" to not ${action} with: #{exp}`,
|
|
9725
10082
|
value
|
|
9726
10083
|
]);
|
|
9727
|
-
|
|
10084
|
+
const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
|
|
10085
|
+
throw new AssertionError(formatReturns(spy, results, msg, value));
|
|
9728
10086
|
}
|
|
9729
10087
|
});
|
|
9730
10088
|
});
|
|
@@ -9790,7 +10148,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9790
10148
|
if (typeof result !== "function") return result instanceof chai.Assertion ? proxy : result;
|
|
9791
10149
|
return (...args) => {
|
|
9792
10150
|
utils.flag(this, "_name", key);
|
|
9793
|
-
|
|
10151
|
+
const promise = Promise.resolve(obj).then((value) => {
|
|
9794
10152
|
utils.flag(this, "object", value);
|
|
9795
10153
|
return result.call(this, ...args);
|
|
9796
10154
|
}, (err) => {
|
|
@@ -9800,7 +10158,8 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9800
10158
|
}).catch((err) => {
|
|
9801
10159
|
if (isError(err) && error.stack) err.stack = error.stack.replace(error.message, err.message);
|
|
9802
10160
|
throw err;
|
|
9803
|
-
})
|
|
10161
|
+
});
|
|
10162
|
+
return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error, utils.flag(this, "soft"));
|
|
9804
10163
|
};
|
|
9805
10164
|
} });
|
|
9806
10165
|
return proxy;
|
|
@@ -9819,7 +10178,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9819
10178
|
if (typeof result !== "function") return result instanceof chai.Assertion ? proxy : result;
|
|
9820
10179
|
return (...args) => {
|
|
9821
10180
|
utils.flag(this, "_name", key);
|
|
9822
|
-
|
|
10181
|
+
const promise = Promise.resolve(wrapper).then((value) => {
|
|
9823
10182
|
throw new AssertionError(`promise resolved "${utils.inspect(value)}" instead of rejecting`, {
|
|
9824
10183
|
showDiff: true,
|
|
9825
10184
|
expected: /* @__PURE__ */ new Error("rejected promise"),
|
|
@@ -9831,7 +10190,8 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
9831
10190
|
}).catch((err) => {
|
|
9832
10191
|
if (isError(err) && error.stack) err.stack = error.stack.replace(error.message, err.message);
|
|
9833
10192
|
throw err;
|
|
9834
|
-
})
|
|
10193
|
+
});
|
|
10194
|
+
return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error, utils.flag(this, "soft"));
|
|
9835
10195
|
};
|
|
9836
10196
|
} });
|
|
9837
10197
|
return proxy;
|
|
@@ -9974,7 +10334,7 @@ const JestExtend = (chai, utils) => {
|
|
|
9974
10334
|
});
|
|
9975
10335
|
};
|
|
9976
10336
|
//#endregion
|
|
9977
|
-
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
10337
|
+
//#region ../../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/offset.js
|
|
9978
10338
|
const lineSplitRE = /\r?\n/;
|
|
9979
10339
|
function positionToOffset(source, lineNumber, columnNumber) {
|
|
9980
10340
|
const lines = source.split(lineSplitRE);
|
|
@@ -9998,10 +10358,10 @@ function offsetToLineNumber(source, offset) {
|
|
|
9998
10358
|
return line + 1;
|
|
9999
10359
|
}
|
|
10000
10360
|
//#endregion
|
|
10001
|
-
//#region ../../../node_modules/.pnpm/vitest@4.1.
|
|
10361
|
+
//#region ../../../node_modules/.pnpm/vitest@4.1.11_@types+node@26.2.0_vite@7.3.2_@types+node@26.2.0_jiti@2.6.1_lightningcss@1.32.0_tsx@4.23.12_yaml@2.9.0_/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js
|
|
10002
10362
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
10003
10363
|
//#endregion
|
|
10004
|
-
//#region ../../../node_modules/.pnpm/vitest@4.1.
|
|
10364
|
+
//#region ../../../node_modules/.pnpm/vitest@4.1.11_@types+node@26.2.0_vite@7.3.2_@types+node@26.2.0_jiti@2.6.1_lightningcss@1.32.0_tsx@4.23.12_yaml@2.9.0_/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js
|
|
10005
10365
|
const RealDate = Date;
|
|
10006
10366
|
let now = null;
|
|
10007
10367
|
var MockDate = class MockDate extends RealDate {
|
|
@@ -10023,7 +10383,6 @@ var MockDate = class MockDate extends RealDate {
|
|
|
10023
10383
|
s = s || 0;
|
|
10024
10384
|
ms = ms || 0;
|
|
10025
10385
|
date = new RealDate(y, m, d, h, M, s, ms);
|
|
10026
|
-
break;
|
|
10027
10386
|
}
|
|
10028
10387
|
Object.setPrototypeOf(date, MockDate.prototype);
|
|
10029
10388
|
return date;
|
|
@@ -10049,8 +10408,12 @@ function resetDate() {
|
|
|
10049
10408
|
globalThis.Date = RealDate;
|
|
10050
10409
|
}
|
|
10051
10410
|
const { get } = Reflect;
|
|
10411
|
+
function rpc() {
|
|
10412
|
+
const { rpc } = getWorkerState();
|
|
10413
|
+
return rpc;
|
|
10414
|
+
}
|
|
10052
10415
|
//#endregion
|
|
10053
|
-
//#region ../../../node_modules/.pnpm/@vitest+snapshot@4.1.
|
|
10416
|
+
//#region ../../../node_modules/.pnpm/@vitest+snapshot@4.1.11/node_modules/@vitest/snapshot/dist/index.js
|
|
10054
10417
|
function getDefaultExportFromCjs(x) {
|
|
10055
10418
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
10056
10419
|
}
|
|
@@ -10095,7 +10458,7 @@ function requireNaturalCompare() {
|
|
|
10095
10458
|
}
|
|
10096
10459
|
return naturalCompare$1.exports;
|
|
10097
10460
|
}
|
|
10098
|
-
var naturalCompare =
|
|
10461
|
+
var naturalCompare = /*@__PURE__*/ getDefaultExportFromCjs(requireNaturalCompare());
|
|
10099
10462
|
const serialize$1 = (val, config, indentation, depth, refs, printer) => {
|
|
10100
10463
|
const name = val.getMockName();
|
|
10101
10464
|
const nameString = name === "vi.fn()" ? "" : ` ${name}`;
|
|
@@ -10208,9 +10571,10 @@ function deepMergeSnapshot(target, source) {
|
|
|
10208
10571
|
if (isObject$1(target) && isObject$1(source)) {
|
|
10209
10572
|
const mergedOutput = { ...target };
|
|
10210
10573
|
Object.keys(source).forEach((key) => {
|
|
10211
|
-
if (isObject$1(source[key]) && !source[key].$$typeof)
|
|
10212
|
-
|
|
10213
|
-
|
|
10574
|
+
if (isObject$1(source[key]) && !source[key].$$typeof) {
|
|
10575
|
+
if (!(key in target)) Object.assign(mergedOutput, { [key]: source[key] });
|
|
10576
|
+
else mergedOutput[key] = deepMergeSnapshot(target[key], source[key]);
|
|
10577
|
+
} else if (Array.isArray(source[key])) mergedOutput[key] = deepMergeArray(target[key], source[key]);
|
|
10214
10578
|
else Object.assign(mergedOutput, { [key]: source[key] });
|
|
10215
10579
|
});
|
|
10216
10580
|
return mergedOutput;
|
|
@@ -10255,7 +10619,7 @@ function memo(fn) {
|
|
|
10255
10619
|
};
|
|
10256
10620
|
}
|
|
10257
10621
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
10258
|
-
const MagicString = (await import("./magic-string.es-
|
|
10622
|
+
const MagicString = (await import("./magic-string.es-CUAnjKYC.mjs")).default;
|
|
10259
10623
|
const files = new Set(snapshots.map((i) => i.file));
|
|
10260
10624
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
10261
10625
|
const snaps = snapshots.filter((i) => i.file === file);
|
|
@@ -10437,7 +10801,8 @@ var SnapshotState = class SnapshotState {
|
|
|
10437
10801
|
}
|
|
10438
10802
|
static async create(testFilePath, options) {
|
|
10439
10803
|
const snapshotPath = await options.snapshotEnvironment.resolvePath(testFilePath);
|
|
10440
|
-
|
|
10804
|
+
const content = await options.snapshotEnvironment.readSnapshotFile(snapshotPath);
|
|
10805
|
+
return new SnapshotState(testFilePath, snapshotPath, content, options);
|
|
10441
10806
|
}
|
|
10442
10807
|
get snapshotUpdateState() {
|
|
10443
10808
|
return this._updateSnapshot;
|
|
@@ -10533,17 +10898,18 @@ var SnapshotState = class SnapshotState {
|
|
|
10533
10898
|
}
|
|
10534
10899
|
_reconcile(opts) {
|
|
10535
10900
|
if (opts.hasSnapshot && this._updateSnapshot === "all" || (!opts.hasSnapshot || !opts.snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
|
|
10536
|
-
if (this._updateSnapshot === "all")
|
|
10537
|
-
if (opts.
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10901
|
+
if (this._updateSnapshot === "all") {
|
|
10902
|
+
if (!opts.pass) {
|
|
10903
|
+
if (opts.hasSnapshot) this.updated.increment(opts.testId);
|
|
10904
|
+
else this.added.increment(opts.testId);
|
|
10905
|
+
this._addSnapshot(opts.key, opts.addValue, {
|
|
10906
|
+
stack: opts.stack,
|
|
10907
|
+
testId: opts.testId,
|
|
10908
|
+
rawSnapshot: opts.rawSnapshot,
|
|
10909
|
+
assertionName: opts.assertionName
|
|
10910
|
+
});
|
|
10911
|
+
} else this.matched.increment(opts.testId);
|
|
10912
|
+
} else {
|
|
10547
10913
|
this._addSnapshot(opts.key, opts.addValue, {
|
|
10548
10914
|
stack: opts.stack,
|
|
10549
10915
|
testId: opts.testId,
|
|
@@ -10964,7 +11330,7 @@ function raceWith(promise, other) {
|
|
|
10964
11330
|
}))]);
|
|
10965
11331
|
}
|
|
10966
11332
|
//#endregion
|
|
10967
|
-
//#region ../../../node_modules/.pnpm/vitest@4.1.
|
|
11333
|
+
//#region ../../../node_modules/.pnpm/vitest@4.1.11_@types+node@26.2.0_vite@7.3.2_@types+node@26.2.0_jiti@2.6.1_lightningcss@1.32.0_tsx@4.23.12_yaml@2.9.0_/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js
|
|
10968
11334
|
var fakeTimersSrc = {};
|
|
10969
11335
|
var global$1;
|
|
10970
11336
|
var hasRequiredGlobal;
|
|
@@ -12046,7 +12412,8 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`);
|
|
|
12046
12412
|
const originalPerfDescriptor = Object.getOwnPropertyDescriptor(target, method);
|
|
12047
12413
|
if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) {
|
|
12048
12414
|
Object.defineProperty(clock, `_${method}`, originalPerfDescriptor);
|
|
12049
|
-
|
|
12415
|
+
const perfDescriptor = Object.getOwnPropertyDescriptor(clock, method);
|
|
12416
|
+
Object.defineProperty(target, method, perfDescriptor);
|
|
12050
12417
|
} else target[method] = clock[method];
|
|
12051
12418
|
} else {
|
|
12052
12419
|
target[method] = function() {
|
|
@@ -12481,7 +12848,8 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`);
|
|
|
12481
12848
|
clock.next();
|
|
12482
12849
|
checkIsNearInfiniteLimit(clock, i);
|
|
12483
12850
|
}
|
|
12484
|
-
|
|
12851
|
+
const excessJob = firstTimer(clock);
|
|
12852
|
+
throw getInfiniteLoopError(clock, excessJob);
|
|
12485
12853
|
};
|
|
12486
12854
|
clock.runToFrame = function runToFrame() {
|
|
12487
12855
|
return clock.tick(getTimeToNextFrame());
|
|
@@ -12515,7 +12883,8 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`);
|
|
|
12515
12883
|
checkIsNearInfiniteLimit(clock, i);
|
|
12516
12884
|
return;
|
|
12517
12885
|
}
|
|
12518
|
-
|
|
12886
|
+
const excessJob = firstTimer(clock);
|
|
12887
|
+
reject(getInfiniteLoopError(clock, excessJob));
|
|
12519
12888
|
} catch (e) {
|
|
12520
12889
|
reject(e);
|
|
12521
12890
|
}
|
|
@@ -12586,7 +12955,8 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`);
|
|
|
12586
12955
|
return clock;
|
|
12587
12956
|
}
|
|
12588
12957
|
function createIntervalTick(clock, delta) {
|
|
12589
|
-
|
|
12958
|
+
const intervalTick = doIntervalTick.bind(null, clock, delta);
|
|
12959
|
+
clock.attachedInterval = originalSetInterval(intervalTick, delta);
|
|
12590
12960
|
}
|
|
12591
12961
|
/**
|
|
12592
12962
|
* @param {Config=} [config] Optional config
|
|
@@ -12676,10 +13046,12 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`);
|
|
|
12676
13046
|
}
|
|
12677
13047
|
resolve(value);
|
|
12678
13048
|
}, delay);
|
|
12679
|
-
if (options.signal)
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
13049
|
+
if (options.signal) {
|
|
13050
|
+
if (options.signal.aborted) abort();
|
|
13051
|
+
else {
|
|
13052
|
+
options.signal.addEventListener("abort", abort);
|
|
13053
|
+
clock.abortListenerMap.set(abort, options.signal);
|
|
13054
|
+
}
|
|
12683
13055
|
}
|
|
12684
13056
|
});
|
|
12685
13057
|
} else if (nameOfMethodToReplace === "setImmediate") {
|
|
@@ -12701,10 +13073,12 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`);
|
|
|
12701
13073
|
}
|
|
12702
13074
|
resolve(value);
|
|
12703
13075
|
});
|
|
12704
|
-
if (options.signal)
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
13076
|
+
if (options.signal) {
|
|
13077
|
+
if (options.signal.aborted) abort();
|
|
13078
|
+
else {
|
|
13079
|
+
options.signal.addEventListener("abort", abort);
|
|
13080
|
+
clock.abortListenerMap.set(abort, options.signal);
|
|
13081
|
+
}
|
|
12708
13082
|
}
|
|
12709
13083
|
});
|
|
12710
13084
|
} else if (nameOfMethodToReplace === "setInterval") {
|
|
@@ -12739,10 +13113,12 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`);
|
|
|
12739
13113
|
done = true;
|
|
12740
13114
|
for (const resolvable of nextQueue) resolvable.resolve();
|
|
12741
13115
|
};
|
|
12742
|
-
if (options.signal)
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
13116
|
+
if (options.signal) {
|
|
13117
|
+
if (options.signal.aborted) done = true;
|
|
13118
|
+
else {
|
|
13119
|
+
options.signal.addEventListener("abort", abort);
|
|
13120
|
+
clock.abortListenerMap.set(abort, options.signal);
|
|
13121
|
+
}
|
|
12746
13122
|
}
|
|
12747
13123
|
return {
|
|
12748
13124
|
next: async () => {
|
|
@@ -13582,7 +13958,7 @@ function createExpect(test) {
|
|
|
13582
13958
|
const { assertionCalls } = getState(expect$1);
|
|
13583
13959
|
setState({ assertionCalls: assertionCalls + 1 }, expect$1);
|
|
13584
13960
|
const assert = expect(value, message);
|
|
13585
|
-
const _test = test ||
|
|
13961
|
+
const _test = test || void 0;
|
|
13586
13962
|
if (_test) return assert.withTest(_test);
|
|
13587
13963
|
else return assert;
|
|
13588
13964
|
});
|
|
@@ -13640,12 +14016,172 @@ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
|
13640
14016
|
writable: true,
|
|
13641
14017
|
configurable: true
|
|
13642
14018
|
});
|
|
14019
|
+
/**
|
|
14020
|
+
* Gives access to injected context provided from the main thread.
|
|
14021
|
+
* This usually returns a value provided by `globalSetup` or an external library.
|
|
14022
|
+
*/
|
|
14023
|
+
function inject(key) {
|
|
14024
|
+
return getWorkerState().providedContext[key];
|
|
14025
|
+
}
|
|
14026
|
+
var TestRunner = class {
|
|
14027
|
+
snapshotClient = getSnapshotClient();
|
|
14028
|
+
workerState = getWorkerState();
|
|
14029
|
+
moduleRunner;
|
|
14030
|
+
cancelRun = false;
|
|
14031
|
+
assertionsErrors = /* @__PURE__ */ new WeakMap();
|
|
14032
|
+
pool = this.workerState.ctx.pool;
|
|
14033
|
+
_otel;
|
|
14034
|
+
viteEnvironment;
|
|
14035
|
+
viteModuleRunner;
|
|
14036
|
+
constructor(config) {
|
|
14037
|
+
this.config = config;
|
|
14038
|
+
const environment = this.workerState.environment;
|
|
14039
|
+
this.viteEnvironment = environment.viteEnvironment || environment.name;
|
|
14040
|
+
this.viteModuleRunner = config.experimental.viteModuleRunner;
|
|
14041
|
+
}
|
|
14042
|
+
importFile(filepath, source) {
|
|
14043
|
+
if (source === "setup") {
|
|
14044
|
+
const moduleNode = this.workerState.evaluatedModules.getModuleById(filepath);
|
|
14045
|
+
if (moduleNode) this.workerState.evaluatedModules.invalidateModule(moduleNode);
|
|
14046
|
+
}
|
|
14047
|
+
return this._otel.$(`vitest.module.import_${source === "setup" ? "setup" : "spec"}`, { attributes: { "code.file.path": filepath } }, () => {
|
|
14048
|
+
if (!this.viteModuleRunner) filepath = `${filepath}?vitest=${Date.now()}`;
|
|
14049
|
+
return this.moduleRunner.import(filepath);
|
|
14050
|
+
});
|
|
14051
|
+
}
|
|
14052
|
+
onCollectStart(file) {
|
|
14053
|
+
this.workerState.current = file;
|
|
14054
|
+
}
|
|
14055
|
+
onCleanupWorkerContext(listener) {
|
|
14056
|
+
this.workerState.onCleanup(listener);
|
|
14057
|
+
}
|
|
14058
|
+
onAfterRunFiles() {
|
|
14059
|
+
this.snapshotClient.clear();
|
|
14060
|
+
this.workerState.current = void 0;
|
|
14061
|
+
}
|
|
14062
|
+
async onAfterRunSuite(suite) {
|
|
14063
|
+
if (this.config.logHeapUsage && typeof process !== "undefined") suite.result.heap = process.memoryUsage().heapUsed;
|
|
14064
|
+
if (suite.mode !== "skip" && "filepath" in suite) {
|
|
14065
|
+
for (const test of getTests(suite)) if (test.mode === "skip") {
|
|
14066
|
+
const name = getNames(test).slice(1).join(" > ");
|
|
14067
|
+
this.snapshotClient.skipTest(suite.file.filepath, name);
|
|
14068
|
+
}
|
|
14069
|
+
const result = await this.snapshotClient.finish(suite.file.filepath);
|
|
14070
|
+
if (this.workerState.config.snapshotOptions.updateSnapshot === "none" && result.unchecked) {
|
|
14071
|
+
let message = `Obsolete snapshots found when no snapshot update is expected.\n`;
|
|
14072
|
+
for (const key of result.uncheckedKeys) message += `· ${key}\n`;
|
|
14073
|
+
suite.result.errors ??= [];
|
|
14074
|
+
suite.result.errors.push(processError(new Error(message)));
|
|
14075
|
+
suite.result.state = "fail";
|
|
14076
|
+
}
|
|
14077
|
+
await rpc().snapshotSaved(result);
|
|
14078
|
+
}
|
|
14079
|
+
this.workerState.current = suite.suite || suite.file;
|
|
14080
|
+
}
|
|
14081
|
+
onAfterRunTask(test) {
|
|
14082
|
+
if (this.config.logHeapUsage && typeof process !== "undefined") test.result.heap = process.memoryUsage().heapUsed;
|
|
14083
|
+
this.workerState.current = test.suite || test.file;
|
|
14084
|
+
}
|
|
14085
|
+
cancel(_reason) {
|
|
14086
|
+
this.cancelRun = true;
|
|
14087
|
+
}
|
|
14088
|
+
injectValue(key) {
|
|
14089
|
+
return inject(key);
|
|
14090
|
+
}
|
|
14091
|
+
async onBeforeRunTask(test) {
|
|
14092
|
+
if (this.cancelRun) test.mode = "skip";
|
|
14093
|
+
if (test.mode !== "run" && test.mode !== "queued") return;
|
|
14094
|
+
this.workerState.current = test;
|
|
14095
|
+
}
|
|
14096
|
+
async onBeforeRunSuite(suite) {
|
|
14097
|
+
if (this.cancelRun) suite.mode = "skip";
|
|
14098
|
+
if (suite.mode !== "skip" && "filepath" in suite) await this.snapshotClient.setup(suite.file.filepath, this.workerState.config.snapshotOptions);
|
|
14099
|
+
this.workerState.current = suite;
|
|
14100
|
+
}
|
|
14101
|
+
onBeforeTryTask(test) {
|
|
14102
|
+
clearModuleMocks(this.config);
|
|
14103
|
+
this.snapshotClient.clearTest(test.file.filepath, test.id);
|
|
14104
|
+
setState({
|
|
14105
|
+
assertionCalls: 0,
|
|
14106
|
+
isExpectingAssertions: false,
|
|
14107
|
+
isExpectingAssertionsError: null,
|
|
14108
|
+
expectedAssertionsNumber: null,
|
|
14109
|
+
expectedAssertionsNumberErrorGen: null,
|
|
14110
|
+
currentTestName: getTestName(test),
|
|
14111
|
+
snapshotState: this.snapshotClient.getSnapshotState(test.file.filepath)
|
|
14112
|
+
}, globalThis[GLOBAL_EXPECT]);
|
|
14113
|
+
}
|
|
14114
|
+
onAfterTryTask(test) {
|
|
14115
|
+
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
|
|
14116
|
+
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber) throw expectedAssertionsNumberErrorGen();
|
|
14117
|
+
if (isExpectingAssertions === true && assertionCalls === 0) throw isExpectingAssertionsError;
|
|
14118
|
+
if (this.config.expect.requireAssertions && assertionCalls === 0) throw this.assertionsErrors.get(test);
|
|
14119
|
+
}
|
|
14120
|
+
extendTaskContext(context) {
|
|
14121
|
+
if (this.config.expect.requireAssertions) this.assertionsErrors.set(context.task, /* @__PURE__ */ new Error("expected any number of assertion, but got none"));
|
|
14122
|
+
let _expect;
|
|
14123
|
+
Object.defineProperty(context, "expect", { get() {
|
|
14124
|
+
if (!_expect) _expect = createExpect(context.task);
|
|
14125
|
+
return _expect;
|
|
14126
|
+
} });
|
|
14127
|
+
Object.defineProperty(context, "_local", { get() {
|
|
14128
|
+
return _expect != null;
|
|
14129
|
+
} });
|
|
14130
|
+
return context;
|
|
14131
|
+
}
|
|
14132
|
+
getImportDurations() {
|
|
14133
|
+
const { limit } = this.config.experimental.importDurations;
|
|
14134
|
+
if (limit === 0) return {};
|
|
14135
|
+
const sortedEntries = [...this.workerState.moduleExecutionInfo?.entries() || []].sort(([, a], [, b]) => b.duration - a.duration).slice(0, limit);
|
|
14136
|
+
const importDurations = {};
|
|
14137
|
+
for (const [filepath, { duration, selfTime, external, importer }] of sortedEntries) importDurations[normalize(filepath)] = {
|
|
14138
|
+
selfTime,
|
|
14139
|
+
totalTime: duration,
|
|
14140
|
+
external,
|
|
14141
|
+
importer
|
|
14142
|
+
};
|
|
14143
|
+
return importDurations;
|
|
14144
|
+
}
|
|
14145
|
+
trace = (name, attributes, cb) => {
|
|
14146
|
+
const options = typeof attributes === "object" ? { attributes } : {};
|
|
14147
|
+
return this._otel.$(`vitest.test.runner.${name}`, options, cb || attributes);
|
|
14148
|
+
};
|
|
14149
|
+
__setTraces(traces) {
|
|
14150
|
+
this._otel = traces;
|
|
14151
|
+
}
|
|
14152
|
+
static createTaskCollector = createTaskCollector;
|
|
14153
|
+
static getCurrentSuite = getCurrentSuite$1;
|
|
14154
|
+
static getCurrentTest = getCurrentTest;
|
|
14155
|
+
static createChainable = createChainable;
|
|
14156
|
+
static getSuiteHooks = getHooks;
|
|
14157
|
+
static getTestFn = getFn;
|
|
14158
|
+
static setSuiteHooks = getHooks;
|
|
14159
|
+
static setTestFn = getFn;
|
|
14160
|
+
static matchesTags = matchesTags;
|
|
14161
|
+
/**
|
|
14162
|
+
* @deprecated
|
|
14163
|
+
*/
|
|
14164
|
+
static getBenchFn = getBenchFn;
|
|
14165
|
+
/**
|
|
14166
|
+
* @deprecated
|
|
14167
|
+
*/
|
|
14168
|
+
static getBenchOptions = getBenchOptions;
|
|
14169
|
+
};
|
|
14170
|
+
function clearModuleMocks(config) {
|
|
14171
|
+
const { clearMocks, mockReset, restoreMocks, unstubEnvs, unstubGlobals } = config;
|
|
14172
|
+
if (restoreMocks) vi.restoreAllMocks();
|
|
14173
|
+
if (mockReset) vi.resetAllMocks();
|
|
14174
|
+
if (clearMocks) vi.clearAllMocks();
|
|
14175
|
+
if (unstubEnvs) vi.unstubAllEnvs();
|
|
14176
|
+
if (unstubGlobals) vi.unstubAllGlobals();
|
|
14177
|
+
}
|
|
13643
14178
|
//#endregion
|
|
13644
|
-
//#region ../../../node_modules/.pnpm/@effect+vitest@4.0.0-
|
|
14179
|
+
//#region ../../../node_modules/.pnpm/@effect+vitest@4.0.0-rc.111_effect@4.0.0-rc.111_vitest@4.1.11_@types+node@26.2.0_vite@7_0a4161190c2476edad4e3173ad651095/node_modules/@effect/vitest/dist/internal/internal.js
|
|
13645
14180
|
/**
|
|
13646
14181
|
* @since 4.0.0
|
|
13647
14182
|
*/
|
|
13648
|
-
const
|
|
14183
|
+
const getCurrentSuite = TestRunner.getCurrentSuite;
|
|
14184
|
+
const runPromise = /*#__PURE__*/ Effect.fnUntraced(function* (effect, _ctx) {
|
|
13649
14185
|
const exit = yield* Effect.exit(effect);
|
|
13650
14186
|
if (Exit.isFailure(exit)) {
|
|
13651
14187
|
const errors = Cause.prettyErrors(exit.cause);
|
|
@@ -13655,7 +14191,7 @@ const runPromise = /* @__PURE__ */ Effect.fnUntraced(function* (effect, _ctx) {
|
|
|
13655
14191
|
}, (effect, _, ctx) => Effect.runPromise(effect, { signal: ctx?.signal }));
|
|
13656
14192
|
/** @internal */
|
|
13657
14193
|
const runTest = (ctx) => (effect) => runPromise(effect, ctx);
|
|
13658
|
-
const TestEnv =
|
|
14194
|
+
const TestEnv = /*#__PURE__*/ Layer.mergeAll(TestConsole.layer, /*#__PURE__*/ TestClock.layer());
|
|
13659
14195
|
/** @internal */
|
|
13660
14196
|
const testOptions = (timeout) => typeof timeout === "number" ? { timeout } : timeout ?? {};
|
|
13661
14197
|
const hookTimeout = (timeout) => timeout === void 0 ? void 0 : Duration.toMillis(Duration.fromInputUnsafe(timeout));
|
|
@@ -13664,9 +14200,8 @@ const makeItProxy = (it, overrides) => new Proxy(it, {
|
|
|
13664
14200
|
return Reflect.apply(target, thisArg, argArray);
|
|
13665
14201
|
},
|
|
13666
14202
|
get(target, property, receiver) {
|
|
13667
|
-
if (property
|
|
13668
|
-
|
|
13669
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
14203
|
+
if (Object.hasOwn(overrides, property)) return Reflect.get(overrides, property);
|
|
14204
|
+
return Reflect.get(target, property, receiver);
|
|
13670
14205
|
}
|
|
13671
14206
|
});
|
|
13672
14207
|
const collectTasks = (tasks, acc = []) => {
|
|
@@ -13690,15 +14225,14 @@ const makeTester = (mapEffect, it = it$1) => {
|
|
|
13690
14225
|
const prop = (name, arbitraries, self, timeout) => {
|
|
13691
14226
|
if (Array.isArray(arbitraries)) {
|
|
13692
14227
|
const arbs = arbitraries.map((arbitrary) => {
|
|
13693
|
-
if (Schema.isSchema(arbitrary)) return Schema.toArbitrary(arbitrary);
|
|
14228
|
+
if (Schema.isSchema(arbitrary)) return Schema.toArbitrary(arbitrary)(fc);
|
|
13694
14229
|
return arbitrary;
|
|
13695
14230
|
});
|
|
13696
14231
|
return it(name, testOptions(timeout), (ctx) => fc.assert(fc.asyncProperty(...arbs, (...as) => run(ctx, [as, ctx], self)), isObject(timeout) ? timeout?.fastCheck : {}));
|
|
13697
14232
|
}
|
|
13698
14233
|
const arbs = fc.record(Object.keys(arbitraries).reduce(function(result, key) {
|
|
13699
14234
|
const arb = arbitraries[key];
|
|
13700
|
-
|
|
13701
|
-
result[key] = arb;
|
|
14235
|
+
Rec.assignProperty(result, key, Schema.isSchema(arb) ? Schema.toArbitrary(arb)(fc) : arb);
|
|
13702
14236
|
return result;
|
|
13703
14237
|
}, {}));
|
|
13704
14238
|
return it(name, testOptions(timeout), (ctx) => fc.assert(fc.asyncProperty(arbs, (...as) => run(ctx, [as[0], ctx], self)), isObject(timeout) ? timeout?.fastCheck : {}));
|
|
@@ -13725,7 +14259,7 @@ const prop = (name, arbitraries, self, timeout) => {
|
|
|
13725
14259
|
const arbs = fc.record(Object.keys(arbitraries).reduce(function(result, key) {
|
|
13726
14260
|
const arb = arbitraries[key];
|
|
13727
14261
|
if (Schema.isSchema(arb)) throw new Error("Schemas are not supported yet");
|
|
13728
|
-
result
|
|
14262
|
+
Rec.assignProperty(result, key, arb);
|
|
13729
14263
|
return result;
|
|
13730
14264
|
}, {}));
|
|
13731
14265
|
return it$1(name, testOptions(timeout), (ctx) => fc.assert(fc.property(arbs, (as) => self(as, ctx)), isObject(timeout) ? timeout?.fastCheck : {}));
|
|
@@ -13794,17 +14328,17 @@ const makeMethods = (it) => makeItProxy(it, {
|
|
|
13794
14328
|
prop
|
|
13795
14329
|
});
|
|
13796
14330
|
/** @internal */
|
|
13797
|
-
const { effect, live } =
|
|
14331
|
+
const { effect, live } = /*#__PURE__*/ makeMethods(it$1);
|
|
13798
14332
|
//#endregion
|
|
13799
|
-
//#region ../../../node_modules/.pnpm/@effect+vitest@4.0.0-
|
|
14333
|
+
//#region ../../../node_modules/.pnpm/@effect+vitest@4.0.0-rc.111_effect@4.0.0-rc.111_vitest@4.1.11_@types+node@26.2.0_vite@7_0a4161190c2476edad4e3173ad651095/node_modules/@effect/vitest/dist/index.js
|
|
13800
14334
|
/**
|
|
13801
14335
|
* @since 4.0.0
|
|
13802
14336
|
*/
|
|
13803
14337
|
/**
|
|
13804
14338
|
* @since 4.0.0
|
|
13805
14339
|
*/
|
|
13806
|
-
const it =
|
|
14340
|
+
const it = /*#__PURE__*/ makeMethods(it$1);
|
|
13807
14341
|
//#endregion
|
|
13808
14342
|
export { globalExpect as n, describe as r, it as t };
|
|
13809
14343
|
|
|
13810
|
-
//# sourceMappingURL=dist-
|
|
14344
|
+
//# sourceMappingURL=dist-CGDqr3r6.mjs.map
|