@procore/hammer-test-jest 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/index.d.mts +8 -17
- package/dist/index.d.ts +8 -17
- package/dist/index.js +7 -30
- package/dist/index.mjs +7 -29
- package/dist/transforms/file.test.js +207 -109
- package/dist/transforms/file.test.mjs +207 -109
- package/dist/transforms/reactSvg.test.js +207 -109
- package/dist/transforms/reactSvg.test.mjs +207 -109
- package/package.json +19 -20
|
@@ -7783,7 +7783,14 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
|
7783
7783
|
if (!descriptor)
|
|
7784
7784
|
continue;
|
|
7785
7785
|
const cloned = clone(val[k22], seen, options);
|
|
7786
|
-
if (
|
|
7786
|
+
if (options.forceWritable) {
|
|
7787
|
+
Object.defineProperty(out, k22, {
|
|
7788
|
+
enumerable: descriptor.enumerable,
|
|
7789
|
+
configurable: true,
|
|
7790
|
+
writable: true,
|
|
7791
|
+
value: cloned
|
|
7792
|
+
});
|
|
7793
|
+
} else if ("get" in descriptor) {
|
|
7787
7794
|
Object.defineProperty(out, k22, {
|
|
7788
7795
|
...descriptor,
|
|
7789
7796
|
get() {
|
|
@@ -7793,7 +7800,6 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
|
7793
7800
|
} else {
|
|
7794
7801
|
Object.defineProperty(out, k22, {
|
|
7795
7802
|
...descriptor,
|
|
7796
|
-
writable: options.forceWritable ? true : descriptor.writable,
|
|
7797
7803
|
value: cloned
|
|
7798
7804
|
});
|
|
7799
7805
|
}
|
|
@@ -7955,7 +7961,7 @@ function objDisplay(obj, options = {}) {
|
|
|
7955
7961
|
if (options.truncate && str.length >= options.truncate) {
|
|
7956
7962
|
if (type2 === "[object Function]") {
|
|
7957
7963
|
const fn2 = obj;
|
|
7958
|
-
return !fn2.name
|
|
7964
|
+
return !fn2.name ? "[Function]" : `[Function: ${fn2.name}]`;
|
|
7959
7965
|
} else if (type2 === "[object Array]") {
|
|
7960
7966
|
return `[ Array(${obj.length}) ]`;
|
|
7961
7967
|
} else if (type2 === "[object Object]") {
|
|
@@ -8395,6 +8401,7 @@ function joinAlignedDiffsExpand(diffs, options) {
|
|
|
8395
8401
|
}
|
|
8396
8402
|
var noColor = (string3) => string3;
|
|
8397
8403
|
var DIFF_CONTEXT_DEFAULT = 5;
|
|
8404
|
+
var DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
|
|
8398
8405
|
function getDefaultOptions() {
|
|
8399
8406
|
const c2 = getColors();
|
|
8400
8407
|
return {
|
|
@@ -8415,7 +8422,10 @@ function getDefaultOptions() {
|
|
|
8415
8422
|
expand: true,
|
|
8416
8423
|
includeChangeCounts: false,
|
|
8417
8424
|
omitAnnotationLines: false,
|
|
8418
|
-
patchColor: c2.yellow
|
|
8425
|
+
patchColor: c2.yellow,
|
|
8426
|
+
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
|
|
8427
|
+
truncateAnnotation: "... Diff result is truncated",
|
|
8428
|
+
truncateAnnotationColor: noColor
|
|
8419
8429
|
};
|
|
8420
8430
|
}
|
|
8421
8431
|
function getCompareKeys(compareKeys) {
|
|
@@ -8483,16 +8493,21 @@ ${bColor(b2)}
|
|
|
8483
8493
|
|
|
8484
8494
|
`;
|
|
8485
8495
|
}
|
|
8486
|
-
function printDiffLines(diffs, options) {
|
|
8487
|
-
return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options))
|
|
8496
|
+
function printDiffLines(diffs, truncated, options) {
|
|
8497
|
+
return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options)) + (truncated ? options.truncateAnnotationColor(`
|
|
8498
|
+
${options.truncateAnnotation}`) : "");
|
|
8488
8499
|
}
|
|
8489
8500
|
function diffLinesUnified(aLines, bLines, options) {
|
|
8501
|
+
const normalizedOptions = normalizeDiffOptions(options);
|
|
8502
|
+
const [diffs, truncated] = diffLinesRaw(
|
|
8503
|
+
isEmptyString(aLines) ? [] : aLines,
|
|
8504
|
+
isEmptyString(bLines) ? [] : bLines,
|
|
8505
|
+
normalizedOptions
|
|
8506
|
+
);
|
|
8490
8507
|
return printDiffLines(
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
),
|
|
8495
|
-
normalizeDiffOptions(options)
|
|
8508
|
+
diffs,
|
|
8509
|
+
truncated,
|
|
8510
|
+
normalizedOptions
|
|
8496
8511
|
);
|
|
8497
8512
|
}
|
|
8498
8513
|
function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options) {
|
|
@@ -8507,7 +8522,7 @@ function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCo
|
|
|
8507
8522
|
if (aLinesDisplay.length !== aLinesCompare.length || bLinesDisplay.length !== bLinesCompare.length) {
|
|
8508
8523
|
return diffLinesUnified(aLinesDisplay, bLinesDisplay, options);
|
|
8509
8524
|
}
|
|
8510
|
-
const diffs = diffLinesRaw(aLinesCompare, bLinesCompare);
|
|
8525
|
+
const [diffs, truncated] = diffLinesRaw(aLinesCompare, bLinesCompare, options);
|
|
8511
8526
|
let aIndex = 0;
|
|
8512
8527
|
let bIndex = 0;
|
|
8513
8528
|
diffs.forEach((diff2) => {
|
|
@@ -8526,11 +8541,14 @@ function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCo
|
|
|
8526
8541
|
bIndex += 1;
|
|
8527
8542
|
}
|
|
8528
8543
|
});
|
|
8529
|
-
return printDiffLines(diffs, normalizeDiffOptions(options));
|
|
8530
|
-
}
|
|
8531
|
-
function diffLinesRaw(aLines, bLines) {
|
|
8532
|
-
const
|
|
8533
|
-
const
|
|
8544
|
+
return printDiffLines(diffs, truncated, normalizeDiffOptions(options));
|
|
8545
|
+
}
|
|
8546
|
+
function diffLinesRaw(aLines, bLines, options) {
|
|
8547
|
+
const truncate2 = (options == null ? void 0 : options.truncateThreshold) ?? false;
|
|
8548
|
+
const truncateThreshold = Math.max(Math.floor((options == null ? void 0 : options.truncateThreshold) ?? 0), 0);
|
|
8549
|
+
const aLength = truncate2 ? Math.min(aLines.length, truncateThreshold) : aLines.length;
|
|
8550
|
+
const bLength = truncate2 ? Math.min(bLines.length, truncateThreshold) : bLines.length;
|
|
8551
|
+
const truncated = aLength !== aLines.length || bLength !== bLines.length;
|
|
8534
8552
|
const isCommon = (aIndex2, bIndex2) => aLines[aIndex2] === bLines[bIndex2];
|
|
8535
8553
|
const diffs = [];
|
|
8536
8554
|
let aIndex = 0;
|
|
@@ -8549,7 +8567,7 @@ function diffLinesRaw(aLines, bLines) {
|
|
|
8549
8567
|
diffs.push(new Diff(DIFF_DELETE, aLines[aIndex]));
|
|
8550
8568
|
for (; bIndex !== bLength; bIndex += 1)
|
|
8551
8569
|
diffs.push(new Diff(DIFF_INSERT, bLines[bIndex]));
|
|
8552
|
-
return diffs;
|
|
8570
|
+
return [diffs, truncated];
|
|
8553
8571
|
}
|
|
8554
8572
|
function getCommonMessage(message, options) {
|
|
8555
8573
|
const { commonColor } = normalizeDiffOptions(options);
|
|
@@ -8719,6 +8737,8 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
8719
8737
|
return val.tagName;
|
|
8720
8738
|
if (typeof val.asymmetricMatch === "function")
|
|
8721
8739
|
return `${val.toString()} ${format(val.sample)}`;
|
|
8740
|
+
if (typeof val.toJSON === "function")
|
|
8741
|
+
return val.toJSON();
|
|
8722
8742
|
if (seen.has(val))
|
|
8723
8743
|
return seen.get(val);
|
|
8724
8744
|
if (Array.isArray(val)) {
|
|
@@ -9451,8 +9471,8 @@ var collectorContext = {
|
|
|
9451
9471
|
currentSuite: null
|
|
9452
9472
|
};
|
|
9453
9473
|
function collectTask(task) {
|
|
9454
|
-
var
|
|
9455
|
-
(
|
|
9474
|
+
var _a;
|
|
9475
|
+
(_a = collectorContext.currentSuite) == null ? void 0 : _a.tasks.push(task);
|
|
9456
9476
|
}
|
|
9457
9477
|
async function runWithSuite(suite2, fn2) {
|
|
9458
9478
|
const prev = collectorContext.currentSuite;
|
|
@@ -9466,17 +9486,17 @@ function withTimeout(fn2, timeout, isHook = false) {
|
|
|
9466
9486
|
const { setTimeout, clearTimeout } = getSafeTimers();
|
|
9467
9487
|
return (...args) => {
|
|
9468
9488
|
return Promise.race([fn2(...args), new Promise((resolve3, reject) => {
|
|
9469
|
-
var
|
|
9489
|
+
var _a;
|
|
9470
9490
|
const timer = setTimeout(() => {
|
|
9471
9491
|
clearTimeout(timer);
|
|
9472
9492
|
reject(new Error(makeTimeoutMsg(isHook, timeout)));
|
|
9473
9493
|
}, timeout);
|
|
9474
|
-
(
|
|
9494
|
+
(_a = timer.unref) == null ? void 0 : _a.call(timer);
|
|
9475
9495
|
})]);
|
|
9476
9496
|
};
|
|
9477
9497
|
}
|
|
9478
9498
|
function createTestContext(test3, runner2) {
|
|
9479
|
-
var
|
|
9499
|
+
var _a;
|
|
9480
9500
|
const context = function() {
|
|
9481
9501
|
throw new Error("done() callback is deprecated, use promise instead");
|
|
9482
9502
|
};
|
|
@@ -9493,7 +9513,7 @@ function createTestContext(test3, runner2) {
|
|
|
9493
9513
|
test3.onFinished || (test3.onFinished = []);
|
|
9494
9514
|
test3.onFinished.push(fn2);
|
|
9495
9515
|
};
|
|
9496
|
-
return ((
|
|
9516
|
+
return ((_a = runner2.extendTaskContext) == null ? void 0 : _a.call(runner2, context)) || context;
|
|
9497
9517
|
}
|
|
9498
9518
|
function makeTimeoutMsg(isHook, timeout) {
|
|
9499
9519
|
return `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
|
|
@@ -9739,10 +9759,10 @@ function createSuiteCollector(name, factory = () => {
|
|
|
9739
9759
|
}
|
|
9740
9760
|
if (runner.config.includeTaskLocation) {
|
|
9741
9761
|
const limit = Error.stackTraceLimit;
|
|
9742
|
-
Error.stackTraceLimit =
|
|
9762
|
+
Error.stackTraceLimit = 15;
|
|
9743
9763
|
const error = new Error("stacktrace").stack;
|
|
9744
9764
|
Error.stackTraceLimit = limit;
|
|
9745
|
-
const stack =
|
|
9765
|
+
const stack = findTestFileStackTrace(error, task2.each ?? false);
|
|
9746
9766
|
if (stack)
|
|
9747
9767
|
task2.location = stack;
|
|
9748
9768
|
}
|
|
@@ -9795,18 +9815,12 @@ function createSuiteCollector(name, factory = () => {
|
|
|
9795
9815
|
};
|
|
9796
9816
|
if (runner && includeLocation && runner.config.includeTaskLocation) {
|
|
9797
9817
|
const limit = Error.stackTraceLimit;
|
|
9798
|
-
Error.stackTraceLimit =
|
|
9818
|
+
Error.stackTraceLimit = 15;
|
|
9799
9819
|
const error = new Error("stacktrace").stack;
|
|
9800
9820
|
Error.stackTraceLimit = limit;
|
|
9801
|
-
const stack =
|
|
9802
|
-
if (stack)
|
|
9803
|
-
suite2.location =
|
|
9804
|
-
line: stack.line,
|
|
9805
|
-
// because source map is boundary based, this line leads to ")" in test.each()[(]),
|
|
9806
|
-
// but it should be the next opening bracket - here we assume it's on the same line
|
|
9807
|
-
column: each ? stack.column + 1 : stack.column
|
|
9808
|
-
};
|
|
9809
|
-
}
|
|
9821
|
+
const stack = findTestFileStackTrace(error, suite2.each ?? false);
|
|
9822
|
+
if (stack)
|
|
9823
|
+
suite2.location = stack;
|
|
9810
9824
|
}
|
|
9811
9825
|
setHooks(suite2, createSuiteHooks());
|
|
9812
9826
|
}
|
|
@@ -9860,9 +9874,14 @@ function createSuite() {
|
|
|
9860
9874
|
optionsOrFn,
|
|
9861
9875
|
fnOrOptions
|
|
9862
9876
|
);
|
|
9877
|
+
const fnFirst = typeof optionsOrFn === "function";
|
|
9863
9878
|
cases.forEach((i2, idx) => {
|
|
9864
9879
|
const items = Array.isArray(i2) ? i2 : [i2];
|
|
9865
|
-
|
|
9880
|
+
if (fnFirst) {
|
|
9881
|
+
arrayOnlyCases ? suite2(formatTitle(_name, items, idx), () => handler(...items), options) : suite2(formatTitle(_name, items, idx), () => handler(i2), options);
|
|
9882
|
+
} else {
|
|
9883
|
+
arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i2));
|
|
9884
|
+
}
|
|
9866
9885
|
});
|
|
9867
9886
|
this.setContext("each", void 0);
|
|
9868
9887
|
};
|
|
@@ -9888,9 +9907,14 @@ function createTaskCollector(fn2, context) {
|
|
|
9888
9907
|
optionsOrFn,
|
|
9889
9908
|
fnOrOptions
|
|
9890
9909
|
);
|
|
9910
|
+
const fnFirst = typeof optionsOrFn === "function";
|
|
9891
9911
|
cases.forEach((i2, idx) => {
|
|
9892
9912
|
const items = Array.isArray(i2) ? i2 : [i2];
|
|
9893
|
-
|
|
9913
|
+
if (fnFirst) {
|
|
9914
|
+
arrayOnlyCases ? test22(formatTitle(_name, items, idx), () => handler(...items), options) : test22(formatTitle(_name, items, idx), () => handler(i2), options);
|
|
9915
|
+
} else {
|
|
9916
|
+
arrayOnlyCases ? test22(formatTitle(_name, items, idx), options, () => handler(...items)) : test22(formatTitle(_name, items, idx), options, () => handler(i2));
|
|
9917
|
+
}
|
|
9894
9918
|
});
|
|
9895
9919
|
this.setContext("each", void 0);
|
|
9896
9920
|
};
|
|
@@ -9932,8 +9956,8 @@ function formatTitle(template, items, idx) {
|
|
|
9932
9956
|
/\$([$\w_.]+)/g,
|
|
9933
9957
|
// https://github.com/chaijs/chai/pull/1490
|
|
9934
9958
|
(_, key) => {
|
|
9935
|
-
var
|
|
9936
|
-
return objDisplay(objectAttr(items[0], key), { truncate: (_b = (
|
|
9959
|
+
var _a, _b;
|
|
9960
|
+
return objDisplay(objectAttr(items[0], key), { truncate: (_b = (_a = runner == null ? void 0 : runner.config) == null ? void 0 : _a.chaiConfig) == null ? void 0 : _b.truncateThreshold });
|
|
9937
9961
|
}
|
|
9938
9962
|
);
|
|
9939
9963
|
}
|
|
@@ -9950,8 +9974,8 @@ function formatTemplateString(cases, args) {
|
|
|
9950
9974
|
}
|
|
9951
9975
|
return res;
|
|
9952
9976
|
}
|
|
9953
|
-
function
|
|
9954
|
-
const lines = error.split("\n").slice(
|
|
9977
|
+
function findTestFileStackTrace(error, each) {
|
|
9978
|
+
const lines = error.split("\n").slice(1);
|
|
9955
9979
|
for (const line of lines) {
|
|
9956
9980
|
const stack = parseSingleStack(line);
|
|
9957
9981
|
if (stack && stack.file === getTestFilepath()) {
|
|
@@ -10002,13 +10026,13 @@ function createTestHook(name, handler) {
|
|
|
10002
10026
|
};
|
|
10003
10027
|
}
|
|
10004
10028
|
|
|
10005
|
-
// ../../node_modules/vitest/dist/vendor/benchmark.
|
|
10029
|
+
// ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
|
|
10006
10030
|
init_esm_shims();
|
|
10007
10031
|
|
|
10008
10032
|
// ../../node_modules/@vitest/runner/dist/utils.js
|
|
10009
10033
|
init_esm_shims();
|
|
10010
10034
|
|
|
10011
|
-
// ../../node_modules/vitest/dist/vendor/index.
|
|
10035
|
+
// ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
|
|
10012
10036
|
init_esm_shims();
|
|
10013
10037
|
|
|
10014
10038
|
// ../../node_modules/vitest/dist/vendor/global.CkGT_TMy.js
|
|
@@ -10026,10 +10050,7 @@ function getCurrentEnvironment() {
|
|
|
10026
10050
|
return state == null ? void 0 : state.environment.name;
|
|
10027
10051
|
}
|
|
10028
10052
|
|
|
10029
|
-
// ../../node_modules/vitest/dist/vendor/index.
|
|
10030
|
-
var _a;
|
|
10031
|
-
var isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
10032
|
-
var isWindows = isNode && process.platform === "win32";
|
|
10053
|
+
// ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
|
|
10033
10054
|
function getRunMode() {
|
|
10034
10055
|
return getWorkerState().config.mode;
|
|
10035
10056
|
}
|
|
@@ -10037,7 +10058,7 @@ function isRunningInBenchmark() {
|
|
|
10037
10058
|
return getRunMode() === "benchmark";
|
|
10038
10059
|
}
|
|
10039
10060
|
|
|
10040
|
-
// ../../node_modules/vitest/dist/vendor/benchmark.
|
|
10061
|
+
// ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
|
|
10041
10062
|
var benchFns = /* @__PURE__ */ new WeakMap();
|
|
10042
10063
|
var benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
10043
10064
|
var bench = createBenchmark(
|
|
@@ -10090,7 +10111,7 @@ function isFirstRun() {
|
|
|
10090
10111
|
return firstRun;
|
|
10091
10112
|
}
|
|
10092
10113
|
|
|
10093
|
-
// ../../node_modules/vitest/dist/vendor/vi.
|
|
10114
|
+
// ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
|
|
10094
10115
|
init_esm_shims();
|
|
10095
10116
|
|
|
10096
10117
|
// ../../node_modules/chai/index.mjs
|
|
@@ -10618,7 +10639,7 @@ function iterableEquality(a, b2, customTesters = [], aStack = [], bStack = []) {
|
|
|
10618
10639
|
return iterableEquality(
|
|
10619
10640
|
a2,
|
|
10620
10641
|
b22,
|
|
10621
|
-
[...
|
|
10642
|
+
[...customTesters],
|
|
10622
10643
|
[...aStack],
|
|
10623
10644
|
[...bStack]
|
|
10624
10645
|
);
|
|
@@ -10677,6 +10698,10 @@ function iterableEquality(a, b2, customTesters = [], aStack = [], bStack = []) {
|
|
|
10677
10698
|
}
|
|
10678
10699
|
if (!bIterator.next().done)
|
|
10679
10700
|
return false;
|
|
10701
|
+
const aEntries = Object.entries(a);
|
|
10702
|
+
const bEntries = Object.entries(b2);
|
|
10703
|
+
if (!equals(aEntries, bEntries))
|
|
10704
|
+
return false;
|
|
10680
10705
|
aStack.pop();
|
|
10681
10706
|
bStack.pop();
|
|
10682
10707
|
return true;
|
|
@@ -10696,7 +10721,7 @@ function subsetEquality(object2, subset, customTesters = []) {
|
|
|
10696
10721
|
if (!isObjectWithKeys(subset2))
|
|
10697
10722
|
return void 0;
|
|
10698
10723
|
return Object.keys(subset2).every((key) => {
|
|
10699
|
-
if (
|
|
10724
|
+
if (subset2[key] != null && typeof subset2[key] === "object") {
|
|
10700
10725
|
if (seenReferences.has(subset2[key]))
|
|
10701
10726
|
return equals(object22[key], subset2[key], filteredCustomTesters);
|
|
10702
10727
|
seenReferences.set(subset2[key], true);
|
|
@@ -10760,6 +10785,57 @@ Received: serializes to the same string
|
|
|
10760
10785
|
function pluralize(word, count) {
|
|
10761
10786
|
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
10762
10787
|
}
|
|
10788
|
+
function getObjectKeys(object2) {
|
|
10789
|
+
return [
|
|
10790
|
+
...Object.keys(object2),
|
|
10791
|
+
...Object.getOwnPropertySymbols(object2).filter(
|
|
10792
|
+
(s) => {
|
|
10793
|
+
var _a;
|
|
10794
|
+
return (_a = Object.getOwnPropertyDescriptor(object2, s)) == null ? void 0 : _a.enumerable;
|
|
10795
|
+
}
|
|
10796
|
+
)
|
|
10797
|
+
];
|
|
10798
|
+
}
|
|
10799
|
+
function getObjectSubset(object2, subset, customTesters = []) {
|
|
10800
|
+
let stripped = 0;
|
|
10801
|
+
const getObjectSubsetWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object22, subset2) => {
|
|
10802
|
+
if (Array.isArray(object22)) {
|
|
10803
|
+
if (Array.isArray(subset2) && subset2.length === object22.length) {
|
|
10804
|
+
return subset2.map(
|
|
10805
|
+
(sub, i2) => getObjectSubsetWithContext(seenReferences)(object22[i2], sub)
|
|
10806
|
+
);
|
|
10807
|
+
}
|
|
10808
|
+
} else if (object22 instanceof Date) {
|
|
10809
|
+
return object22;
|
|
10810
|
+
} else if (isObject(object22) && isObject(subset2)) {
|
|
10811
|
+
if (equals(object22, subset2, [
|
|
10812
|
+
...customTesters,
|
|
10813
|
+
iterableEquality,
|
|
10814
|
+
subsetEquality
|
|
10815
|
+
])) {
|
|
10816
|
+
return subset2;
|
|
10817
|
+
}
|
|
10818
|
+
const trimmed = {};
|
|
10819
|
+
seenReferences.set(object22, trimmed);
|
|
10820
|
+
for (const key of getObjectKeys(object22)) {
|
|
10821
|
+
if (hasPropertyInObject(subset2, key)) {
|
|
10822
|
+
trimmed[key] = seenReferences.has(object22[key]) ? seenReferences.get(object22[key]) : getObjectSubsetWithContext(seenReferences)(object22[key], subset2[key]);
|
|
10823
|
+
} else {
|
|
10824
|
+
if (!seenReferences.has(object22[key])) {
|
|
10825
|
+
stripped += 1;
|
|
10826
|
+
if (isObject(object22[key]))
|
|
10827
|
+
stripped += getObjectKeys(object22[key]).length;
|
|
10828
|
+
getObjectSubsetWithContext(seenReferences)(object22[key], subset2[key]);
|
|
10829
|
+
}
|
|
10830
|
+
}
|
|
10831
|
+
}
|
|
10832
|
+
if (getObjectKeys(trimmed).length > 0)
|
|
10833
|
+
return trimmed;
|
|
10834
|
+
}
|
|
10835
|
+
return object22;
|
|
10836
|
+
};
|
|
10837
|
+
return { subset: getObjectSubsetWithContext()(object2, subset), stripped };
|
|
10838
|
+
}
|
|
10763
10839
|
var AsymmetricMatcher3 = class {
|
|
10764
10840
|
constructor(sample, inverse = false) {
|
|
10765
10841
|
this.sample = sample;
|
|
@@ -11050,7 +11126,7 @@ function recordAsyncExpect(test3, promise) {
|
|
|
11050
11126
|
}
|
|
11051
11127
|
function wrapSoft(utils, fn2) {
|
|
11052
11128
|
return function(...args) {
|
|
11053
|
-
var
|
|
11129
|
+
var _a;
|
|
11054
11130
|
const test3 = utils.flag(this, "vitest-test");
|
|
11055
11131
|
const state = (test3 == null ? void 0 : test3.context._local) ? test3.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
|
|
11056
11132
|
if (!state.soft)
|
|
@@ -11062,7 +11138,7 @@ function wrapSoft(utils, fn2) {
|
|
|
11062
11138
|
} catch (err) {
|
|
11063
11139
|
test3.result || (test3.result = { state: "fail" });
|
|
11064
11140
|
test3.result.state = "fail";
|
|
11065
|
-
(
|
|
11141
|
+
(_a = test3.result).errors || (_a.errors = []);
|
|
11066
11142
|
test3.result.errors.push(processError(err));
|
|
11067
11143
|
}
|
|
11068
11144
|
};
|
|
@@ -11187,16 +11263,30 @@ var JestChaiExpect = (chai3, utils) => {
|
|
|
11187
11263
|
});
|
|
11188
11264
|
def("toMatchObject", function(expected) {
|
|
11189
11265
|
const actual = this._obj;
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11266
|
+
const pass = equals(actual, expected, [...customTesters, iterableEquality, subsetEquality]);
|
|
11267
|
+
const isNot = utils.flag(this, "negate");
|
|
11268
|
+
const { subset: actualSubset, stripped } = getObjectSubset(actual, expected);
|
|
11269
|
+
if (pass && isNot || !pass && !isNot) {
|
|
11270
|
+
const msg = utils.getMessage(
|
|
11271
|
+
this,
|
|
11272
|
+
[
|
|
11273
|
+
pass,
|
|
11274
|
+
"expected #{this} to match object #{exp}",
|
|
11275
|
+
"expected #{this} to not match object #{exp}",
|
|
11276
|
+
expected,
|
|
11277
|
+
actualSubset,
|
|
11278
|
+
false
|
|
11279
|
+
]
|
|
11280
|
+
);
|
|
11281
|
+
const message = stripped === 0 ? msg : `${msg}
|
|
11282
|
+
(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
|
|
11283
|
+
throw new AssertionError2(message, { showDiff: true, expected, actual: actualSubset });
|
|
11284
|
+
}
|
|
11197
11285
|
});
|
|
11198
11286
|
def("toMatch", function(expected) {
|
|
11199
11287
|
const actual = this._obj;
|
|
11288
|
+
if (typeof actual !== "string")
|
|
11289
|
+
throw new TypeError(`.toMatch() expects to receive a string, but got ${typeof actual}`);
|
|
11200
11290
|
return this.assert(
|
|
11201
11291
|
typeof expected === "string" ? actual.includes(expected) : actual.match(expected),
|
|
11202
11292
|
`expected #{this} to match #{exp}`,
|
|
@@ -11538,12 +11628,15 @@ Number of calls: ${c2().bold(spy.mock.calls.length)}
|
|
|
11538
11628
|
const spy = getSpy(this);
|
|
11539
11629
|
const spyName = spy.getMockName();
|
|
11540
11630
|
const nthCall = spy.mock.calls[times - 1];
|
|
11631
|
+
const callCount = spy.mock.calls.length;
|
|
11632
|
+
const isCalled = times <= callCount;
|
|
11541
11633
|
this.assert(
|
|
11542
11634
|
equals(nthCall, args, [...customTesters, iterableEquality]),
|
|
11543
|
-
`expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}`,
|
|
11635
|
+
`expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}${isCalled ? `` : `, but called only ${callCount} times`}`,
|
|
11544
11636
|
`expected ${ordinalOf(times)} "${spyName}" call to not have been called with #{exp}`,
|
|
11545
11637
|
args,
|
|
11546
|
-
nthCall
|
|
11638
|
+
nthCall,
|
|
11639
|
+
isCalled
|
|
11547
11640
|
);
|
|
11548
11641
|
});
|
|
11549
11642
|
def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) {
|
|
@@ -12165,9 +12258,9 @@ ${snapshots.join("\n\n")}
|
|
|
12165
12258
|
}
|
|
12166
12259
|
function prepareExpected(expected) {
|
|
12167
12260
|
function findStartIndent() {
|
|
12168
|
-
var
|
|
12261
|
+
var _a, _b;
|
|
12169
12262
|
const matchObject = /^( +)}\s+$/m.exec(expected || "");
|
|
12170
|
-
const objectIndent = (
|
|
12263
|
+
const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length;
|
|
12171
12264
|
if (objectIndent)
|
|
12172
12265
|
return objectIndent;
|
|
12173
12266
|
const matchText = /^\n( +)"/.exec(expected || "");
|
|
@@ -12734,8 +12827,8 @@ function parseStacktrace(stack, options = {}) {
|
|
|
12734
12827
|
if (ignoreStackEntries.length)
|
|
12735
12828
|
stacks = stacks.filter((stack2) => !ignoreStackEntries.some((p) => stack2.file.match(p)));
|
|
12736
12829
|
return stacks.map((stack2) => {
|
|
12737
|
-
var
|
|
12738
|
-
const map2 = (
|
|
12830
|
+
var _a;
|
|
12831
|
+
const map2 = (_a = options.getSourceMap) == null ? void 0 : _a.call(options, stack2.file);
|
|
12739
12832
|
if (!map2 || typeof map2 !== "object" || !map2.version)
|
|
12740
12833
|
return stack2;
|
|
12741
12834
|
const traceMap = new TraceMap(map2);
|
|
@@ -13147,10 +13240,10 @@ var SnapshotClient = class {
|
|
|
13147
13240
|
snapshotState;
|
|
13148
13241
|
snapshotStateMap = /* @__PURE__ */ new Map();
|
|
13149
13242
|
async startCurrentRun(filepath, name, options) {
|
|
13150
|
-
var
|
|
13243
|
+
var _a;
|
|
13151
13244
|
this.filepath = filepath;
|
|
13152
13245
|
this.name = name;
|
|
13153
|
-
if (((
|
|
13246
|
+
if (((_a = this.snapshotState) == null ? void 0 : _a.testFilePath) !== filepath) {
|
|
13154
13247
|
await this.finishCurrentRun();
|
|
13155
13248
|
if (!this.getSnapshotState(filepath)) {
|
|
13156
13249
|
this.snapshotStateMap.set(
|
|
@@ -13172,11 +13265,11 @@ var SnapshotClient = class {
|
|
|
13172
13265
|
this.name = void 0;
|
|
13173
13266
|
}
|
|
13174
13267
|
skipTestSnapshots(name) {
|
|
13175
|
-
var
|
|
13176
|
-
(
|
|
13268
|
+
var _a;
|
|
13269
|
+
(_a = this.snapshotState) == null ? void 0 : _a.markSnapshotsAsCheckedForTest(name);
|
|
13177
13270
|
}
|
|
13178
13271
|
assert(options) {
|
|
13179
|
-
var
|
|
13272
|
+
var _a, _b, _c, _d;
|
|
13180
13273
|
const {
|
|
13181
13274
|
filepath = this.filepath,
|
|
13182
13275
|
name = this.name,
|
|
@@ -13195,7 +13288,7 @@ var SnapshotClient = class {
|
|
|
13195
13288
|
if (typeof received !== "object" || !received)
|
|
13196
13289
|
throw new Error("Received value must be an object when the matcher has properties");
|
|
13197
13290
|
try {
|
|
13198
|
-
const pass2 = ((_b = (
|
|
13291
|
+
const pass2 = ((_b = (_a = this.options).isEqual) == null ? void 0 : _b.call(_a, received, properties)) ?? false;
|
|
13199
13292
|
if (!pass2)
|
|
13200
13293
|
throw createMismatchError("Snapshot properties mismatched", (_c = this.snapshotState) == null ? void 0 : _c.expand, received, properties);
|
|
13201
13294
|
else
|
|
@@ -13256,7 +13349,7 @@ function getFullName(task, separator = " > ") {
|
|
|
13256
13349
|
return getNames(task).join(separator);
|
|
13257
13350
|
}
|
|
13258
13351
|
|
|
13259
|
-
// ../../node_modules/vitest/dist/vendor/base.
|
|
13352
|
+
// ../../node_modules/vitest/dist/vendor/base.5NT-gWu5.js
|
|
13260
13353
|
init_esm_shims();
|
|
13261
13354
|
function isChildProcess() {
|
|
13262
13355
|
return typeof process !== "undefined" && !!process.send;
|
|
@@ -13314,7 +13407,7 @@ function resetDate() {
|
|
|
13314
13407
|
globalThis.Date = RealDate;
|
|
13315
13408
|
}
|
|
13316
13409
|
|
|
13317
|
-
// ../../node_modules/vitest/dist/vendor/vi.
|
|
13410
|
+
// ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
|
|
13318
13411
|
function resetModules(modules, resetMocks = false) {
|
|
13319
13412
|
const skipPaths = [
|
|
13320
13413
|
// Vitest
|
|
@@ -13495,11 +13588,11 @@ function getError(expected, promise) {
|
|
|
13495
13588
|
}
|
|
13496
13589
|
var SnapshotPlugin = (chai3, utils) => {
|
|
13497
13590
|
const getTestNames = (test3) => {
|
|
13498
|
-
var
|
|
13591
|
+
var _a;
|
|
13499
13592
|
if (!test3)
|
|
13500
13593
|
return {};
|
|
13501
13594
|
return {
|
|
13502
|
-
filepath: (
|
|
13595
|
+
filepath: (_a = test3.file) == null ? void 0 : _a.filepath,
|
|
13503
13596
|
name: getNames(test3).slice(1).join(" > ")
|
|
13504
13597
|
};
|
|
13505
13598
|
};
|
|
@@ -13556,12 +13649,12 @@ var SnapshotPlugin = (chai3, utils) => {
|
|
|
13556
13649
|
chai3.Assertion.prototype,
|
|
13557
13650
|
"toMatchInlineSnapshot",
|
|
13558
13651
|
function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
13559
|
-
var
|
|
13652
|
+
var _a;
|
|
13560
13653
|
const isNot = utils.flag(this, "negate");
|
|
13561
13654
|
if (isNot)
|
|
13562
13655
|
throw new Error('toMatchInlineSnapshot cannot be used with "not"');
|
|
13563
13656
|
const test3 = utils.flag(this, "vitest-test");
|
|
13564
|
-
const isInsideEach = test3 && (test3.each || ((
|
|
13657
|
+
const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
|
|
13565
13658
|
if (isInsideEach)
|
|
13566
13659
|
throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
13567
13660
|
const expected = utils.flag(this, "object");
|
|
@@ -13609,12 +13702,12 @@ var SnapshotPlugin = (chai3, utils) => {
|
|
|
13609
13702
|
chai3.Assertion.prototype,
|
|
13610
13703
|
"toThrowErrorMatchingInlineSnapshot",
|
|
13611
13704
|
function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
13612
|
-
var
|
|
13705
|
+
var _a;
|
|
13613
13706
|
const isNot = utils.flag(this, "negate");
|
|
13614
13707
|
if (isNot)
|
|
13615
13708
|
throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
|
|
13616
13709
|
const test3 = utils.flag(this, "vitest-test");
|
|
13617
|
-
const isInsideEach = test3 && (test3.each || ((
|
|
13710
|
+
const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
|
|
13618
13711
|
if (isInsideEach)
|
|
13619
13712
|
throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
13620
13713
|
const expected = utils.flag(this, "object");
|
|
@@ -13646,7 +13739,7 @@ use(Subset);
|
|
|
13646
13739
|
use(SnapshotPlugin);
|
|
13647
13740
|
use(JestAsymmetricMatchers);
|
|
13648
13741
|
function createExpect(test3) {
|
|
13649
|
-
var
|
|
13742
|
+
var _a;
|
|
13650
13743
|
const expect2 = (value, message) => {
|
|
13651
13744
|
const { assertionCalls } = getState(expect2);
|
|
13652
13745
|
setState({ assertionCalls: assertionCalls + 1, soft: false }, expect2);
|
|
@@ -13671,7 +13764,7 @@ function createExpect(test3) {
|
|
|
13671
13764
|
expectedAssertionsNumber: null,
|
|
13672
13765
|
expectedAssertionsNumberErrorGen: null,
|
|
13673
13766
|
environment: getCurrentEnvironment(),
|
|
13674
|
-
testPath: test3 ? (
|
|
13767
|
+
testPath: test3 ? (_a = test3.suite.file) == null ? void 0 : _a.filepath : globalState.testPath,
|
|
13675
13768
|
currentTestName: test3 ? getFullName(test3) : globalState.currentTestName
|
|
13676
13769
|
}, expect2);
|
|
13677
13770
|
expect2.extend = (matchers) => expect.extend(expect2, matchers);
|
|
@@ -15246,7 +15339,7 @@ var FakeTimers = class {
|
|
|
15246
15339
|
}
|
|
15247
15340
|
}
|
|
15248
15341
|
useFakeTimers() {
|
|
15249
|
-
var
|
|
15342
|
+
var _a, _b, _c;
|
|
15250
15343
|
if (this._fakingDate) {
|
|
15251
15344
|
throw new Error(
|
|
15252
15345
|
'"setSystemTime" was called already and date was mocked. Reset timers using `vi.useRealTimers()` if you want to use fake timers again.'
|
|
@@ -15254,7 +15347,7 @@ var FakeTimers = class {
|
|
|
15254
15347
|
}
|
|
15255
15348
|
if (!this._fakingTime) {
|
|
15256
15349
|
const toFake = Object.keys(this._fakeTimers.timers).filter((timer) => timer !== "nextTick");
|
|
15257
|
-
if (((_b = (
|
|
15350
|
+
if (((_b = (_a = this._userConfig) == null ? void 0 : _a.toFake) == null ? void 0 : _b.includes("nextTick")) && isChildProcess())
|
|
15258
15351
|
throw new Error("process.nextTick cannot be mocked inside child_process");
|
|
15259
15352
|
const existingFakedMethods = (((_c = this._userConfig) == null ? void 0 : _c.toFake) || toFake).filter((method) => {
|
|
15260
15353
|
switch (method) {
|
|
@@ -15439,12 +15532,14 @@ function createVitest() {
|
|
|
15439
15532
|
let _mockedDate = null;
|
|
15440
15533
|
let _config = null;
|
|
15441
15534
|
const workerState = getWorkerState();
|
|
15442
|
-
|
|
15535
|
+
let _timers;
|
|
15536
|
+
const timers = () => _timers || (_timers = new FakeTimers({
|
|
15443
15537
|
global: globalThis,
|
|
15444
15538
|
config: workerState.config.fakeTimers
|
|
15445
|
-
});
|
|
15539
|
+
}));
|
|
15446
15540
|
const _stubsGlobal = /* @__PURE__ */ new Map();
|
|
15447
15541
|
const _stubsEnv = /* @__PURE__ */ new Map();
|
|
15542
|
+
const _envBooleans = ["PROD", "DEV", "SSR"];
|
|
15448
15543
|
const getImporter = () => {
|
|
15449
15544
|
const stackTrace = createSimpleStackTrace({ stackTraceLimit: 4 });
|
|
15450
15545
|
const importerStack = stackTrace.split("\n")[4];
|
|
@@ -15453,82 +15548,82 @@ function createVitest() {
|
|
|
15453
15548
|
};
|
|
15454
15549
|
const utils = {
|
|
15455
15550
|
useFakeTimers(config2) {
|
|
15456
|
-
var
|
|
15551
|
+
var _a, _b, _c, _d;
|
|
15457
15552
|
if (isChildProcess()) {
|
|
15458
|
-
if (((
|
|
15553
|
+
if (((_a = config2 == null ? void 0 : config2.toFake) == null ? void 0 : _a.includes("nextTick")) || ((_d = (_c = (_b = workerState.config) == null ? void 0 : _b.fakeTimers) == null ? void 0 : _c.toFake) == null ? void 0 : _d.includes("nextTick"))) {
|
|
15459
15554
|
throw new Error(
|
|
15460
15555
|
'vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.'
|
|
15461
15556
|
);
|
|
15462
15557
|
}
|
|
15463
15558
|
}
|
|
15464
15559
|
if (config2)
|
|
15465
|
-
|
|
15560
|
+
timers().configure({ ...workerState.config.fakeTimers, ...config2 });
|
|
15466
15561
|
else
|
|
15467
|
-
|
|
15468
|
-
|
|
15562
|
+
timers().configure(workerState.config.fakeTimers);
|
|
15563
|
+
timers().useFakeTimers();
|
|
15469
15564
|
return utils;
|
|
15470
15565
|
},
|
|
15471
15566
|
isFakeTimers() {
|
|
15472
|
-
return
|
|
15567
|
+
return timers().isFakeTimers();
|
|
15473
15568
|
},
|
|
15474
15569
|
useRealTimers() {
|
|
15475
|
-
|
|
15570
|
+
timers().useRealTimers();
|
|
15476
15571
|
_mockedDate = null;
|
|
15477
15572
|
return utils;
|
|
15478
15573
|
},
|
|
15479
15574
|
runOnlyPendingTimers() {
|
|
15480
|
-
|
|
15575
|
+
timers().runOnlyPendingTimers();
|
|
15481
15576
|
return utils;
|
|
15482
15577
|
},
|
|
15483
15578
|
async runOnlyPendingTimersAsync() {
|
|
15484
|
-
await
|
|
15579
|
+
await timers().runOnlyPendingTimersAsync();
|
|
15485
15580
|
return utils;
|
|
15486
15581
|
},
|
|
15487
15582
|
runAllTimers() {
|
|
15488
|
-
|
|
15583
|
+
timers().runAllTimers();
|
|
15489
15584
|
return utils;
|
|
15490
15585
|
},
|
|
15491
15586
|
async runAllTimersAsync() {
|
|
15492
|
-
await
|
|
15587
|
+
await timers().runAllTimersAsync();
|
|
15493
15588
|
return utils;
|
|
15494
15589
|
},
|
|
15495
15590
|
runAllTicks() {
|
|
15496
|
-
|
|
15591
|
+
timers().runAllTicks();
|
|
15497
15592
|
return utils;
|
|
15498
15593
|
},
|
|
15499
15594
|
advanceTimersByTime(ms) {
|
|
15500
|
-
|
|
15595
|
+
timers().advanceTimersByTime(ms);
|
|
15501
15596
|
return utils;
|
|
15502
15597
|
},
|
|
15503
15598
|
async advanceTimersByTimeAsync(ms) {
|
|
15504
|
-
await
|
|
15599
|
+
await timers().advanceTimersByTimeAsync(ms);
|
|
15505
15600
|
return utils;
|
|
15506
15601
|
},
|
|
15507
15602
|
advanceTimersToNextTimer() {
|
|
15508
|
-
|
|
15603
|
+
timers().advanceTimersToNextTimer();
|
|
15509
15604
|
return utils;
|
|
15510
15605
|
},
|
|
15511
15606
|
async advanceTimersToNextTimerAsync() {
|
|
15512
|
-
await
|
|
15607
|
+
await timers().advanceTimersToNextTimerAsync();
|
|
15513
15608
|
return utils;
|
|
15514
15609
|
},
|
|
15515
15610
|
getTimerCount() {
|
|
15516
|
-
return
|
|
15611
|
+
return timers().getTimerCount();
|
|
15517
15612
|
},
|
|
15518
15613
|
setSystemTime(time) {
|
|
15519
15614
|
const date = time instanceof Date ? time : new Date(time);
|
|
15520
15615
|
_mockedDate = date;
|
|
15521
|
-
|
|
15616
|
+
timers().setSystemTime(date);
|
|
15522
15617
|
return utils;
|
|
15523
15618
|
},
|
|
15524
15619
|
getMockedSystemTime() {
|
|
15525
15620
|
return _mockedDate;
|
|
15526
15621
|
},
|
|
15527
15622
|
getRealSystemTime() {
|
|
15528
|
-
return
|
|
15623
|
+
return timers().getRealSystemTime();
|
|
15529
15624
|
},
|
|
15530
15625
|
clearAllTimers() {
|
|
15531
|
-
|
|
15626
|
+
timers().clearAllTimers();
|
|
15532
15627
|
return utils;
|
|
15533
15628
|
},
|
|
15534
15629
|
// mocks
|
|
@@ -15607,7 +15702,10 @@ function createVitest() {
|
|
|
15607
15702
|
stubEnv(name, value) {
|
|
15608
15703
|
if (!_stubsEnv.has(name))
|
|
15609
15704
|
_stubsEnv.set(name, process.env[name]);
|
|
15610
|
-
|
|
15705
|
+
if (_envBooleans.includes(name))
|
|
15706
|
+
process.env[name] = value ? "1" : "";
|
|
15707
|
+
else
|
|
15708
|
+
process.env[name] = String(value);
|
|
15611
15709
|
return utils;
|
|
15612
15710
|
},
|
|
15613
15711
|
unstubAllGlobals() {
|
|
@@ -15652,7 +15750,7 @@ function createVitest() {
|
|
|
15652
15750
|
var vitest = createVitest();
|
|
15653
15751
|
var vi = vitest;
|
|
15654
15752
|
|
|
15655
|
-
// ../../node_modules/vitest/dist/vendor/index.
|
|
15753
|
+
// ../../node_modules/vitest/dist/vendor/index.dI9lHwVn.js
|
|
15656
15754
|
init_esm_shims();
|
|
15657
15755
|
function getRunningMode() {
|
|
15658
15756
|
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|