@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.
@@ -7857,7 +7857,14 @@ function clone(val, seen, options = defaultCloneOptions) {
7857
7857
  if (!descriptor)
7858
7858
  continue;
7859
7859
  const cloned = clone(val[k22], seen, options);
7860
- if ("get" in descriptor) {
7860
+ if (options.forceWritable) {
7861
+ Object.defineProperty(out, k22, {
7862
+ enumerable: descriptor.enumerable,
7863
+ configurable: true,
7864
+ writable: true,
7865
+ value: cloned
7866
+ });
7867
+ } else if ("get" in descriptor) {
7861
7868
  Object.defineProperty(out, k22, {
7862
7869
  ...descriptor,
7863
7870
  get() {
@@ -7867,7 +7874,6 @@ function clone(val, seen, options = defaultCloneOptions) {
7867
7874
  } else {
7868
7875
  Object.defineProperty(out, k22, {
7869
7876
  ...descriptor,
7870
- writable: options.forceWritable ? true : descriptor.writable,
7871
7877
  value: cloned
7872
7878
  });
7873
7879
  }
@@ -8029,7 +8035,7 @@ function objDisplay(obj, options = {}) {
8029
8035
  if (options.truncate && str.length >= options.truncate) {
8030
8036
  if (type2 === "[object Function]") {
8031
8037
  const fn2 = obj;
8032
- return !fn2.name || fn2.name === "" ? "[Function]" : `[Function: ${fn2.name}]`;
8038
+ return !fn2.name ? "[Function]" : `[Function: ${fn2.name}]`;
8033
8039
  } else if (type2 === "[object Array]") {
8034
8040
  return `[ Array(${obj.length}) ]`;
8035
8041
  } else if (type2 === "[object Object]") {
@@ -8469,6 +8475,7 @@ function joinAlignedDiffsExpand(diffs, options) {
8469
8475
  }
8470
8476
  var noColor = (string3) => string3;
8471
8477
  var DIFF_CONTEXT_DEFAULT = 5;
8478
+ var DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
8472
8479
  function getDefaultOptions() {
8473
8480
  const c2 = getColors();
8474
8481
  return {
@@ -8489,7 +8496,10 @@ function getDefaultOptions() {
8489
8496
  expand: true,
8490
8497
  includeChangeCounts: false,
8491
8498
  omitAnnotationLines: false,
8492
- patchColor: c2.yellow
8499
+ patchColor: c2.yellow,
8500
+ truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
8501
+ truncateAnnotation: "... Diff result is truncated",
8502
+ truncateAnnotationColor: noColor
8493
8503
  };
8494
8504
  }
8495
8505
  function getCompareKeys(compareKeys) {
@@ -8557,16 +8567,21 @@ ${bColor(b2)}
8557
8567
 
8558
8568
  `;
8559
8569
  }
8560
- function printDiffLines(diffs, options) {
8561
- return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options));
8570
+ function printDiffLines(diffs, truncated, options) {
8571
+ return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options)) + (truncated ? options.truncateAnnotationColor(`
8572
+ ${options.truncateAnnotation}`) : "");
8562
8573
  }
8563
8574
  function diffLinesUnified(aLines, bLines, options) {
8575
+ const normalizedOptions = normalizeDiffOptions(options);
8576
+ const [diffs, truncated] = diffLinesRaw(
8577
+ isEmptyString(aLines) ? [] : aLines,
8578
+ isEmptyString(bLines) ? [] : bLines,
8579
+ normalizedOptions
8580
+ );
8564
8581
  return printDiffLines(
8565
- diffLinesRaw(
8566
- isEmptyString(aLines) ? [] : aLines,
8567
- isEmptyString(bLines) ? [] : bLines
8568
- ),
8569
- normalizeDiffOptions(options)
8582
+ diffs,
8583
+ truncated,
8584
+ normalizedOptions
8570
8585
  );
8571
8586
  }
8572
8587
  function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options) {
@@ -8581,7 +8596,7 @@ function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCo
8581
8596
  if (aLinesDisplay.length !== aLinesCompare.length || bLinesDisplay.length !== bLinesCompare.length) {
8582
8597
  return diffLinesUnified(aLinesDisplay, bLinesDisplay, options);
8583
8598
  }
8584
- const diffs = diffLinesRaw(aLinesCompare, bLinesCompare);
8599
+ const [diffs, truncated] = diffLinesRaw(aLinesCompare, bLinesCompare, options);
8585
8600
  let aIndex = 0;
8586
8601
  let bIndex = 0;
8587
8602
  diffs.forEach((diff2) => {
@@ -8600,11 +8615,14 @@ function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCo
8600
8615
  bIndex += 1;
8601
8616
  }
8602
8617
  });
8603
- return printDiffLines(diffs, normalizeDiffOptions(options));
8604
- }
8605
- function diffLinesRaw(aLines, bLines) {
8606
- const aLength = aLines.length;
8607
- const bLength = bLines.length;
8618
+ return printDiffLines(diffs, truncated, normalizeDiffOptions(options));
8619
+ }
8620
+ function diffLinesRaw(aLines, bLines, options) {
8621
+ const truncate2 = (options == null ? void 0 : options.truncateThreshold) ?? false;
8622
+ const truncateThreshold = Math.max(Math.floor((options == null ? void 0 : options.truncateThreshold) ?? 0), 0);
8623
+ const aLength = truncate2 ? Math.min(aLines.length, truncateThreshold) : aLines.length;
8624
+ const bLength = truncate2 ? Math.min(bLines.length, truncateThreshold) : bLines.length;
8625
+ const truncated = aLength !== aLines.length || bLength !== bLines.length;
8608
8626
  const isCommon = (aIndex2, bIndex2) => aLines[aIndex2] === bLines[bIndex2];
8609
8627
  const diffs = [];
8610
8628
  let aIndex = 0;
@@ -8623,7 +8641,7 @@ function diffLinesRaw(aLines, bLines) {
8623
8641
  diffs.push(new Diff(DIFF_DELETE, aLines[aIndex]));
8624
8642
  for (; bIndex !== bLength; bIndex += 1)
8625
8643
  diffs.push(new Diff(DIFF_INSERT, bLines[bIndex]));
8626
- return diffs;
8644
+ return [diffs, truncated];
8627
8645
  }
8628
8646
  function getCommonMessage(message, options) {
8629
8647
  const { commonColor } = normalizeDiffOptions(options);
@@ -8793,6 +8811,8 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
8793
8811
  return val.tagName;
8794
8812
  if (typeof val.asymmetricMatch === "function")
8795
8813
  return `${val.toString()} ${format(val.sample)}`;
8814
+ if (typeof val.toJSON === "function")
8815
+ return val.toJSON();
8796
8816
  if (seen.has(val))
8797
8817
  return seen.get(val);
8798
8818
  if (Array.isArray(val)) {
@@ -9525,8 +9545,8 @@ var collectorContext = {
9525
9545
  currentSuite: null
9526
9546
  };
9527
9547
  function collectTask(task) {
9528
- var _a2;
9529
- (_a2 = collectorContext.currentSuite) == null ? void 0 : _a2.tasks.push(task);
9548
+ var _a;
9549
+ (_a = collectorContext.currentSuite) == null ? void 0 : _a.tasks.push(task);
9530
9550
  }
9531
9551
  async function runWithSuite(suite2, fn2) {
9532
9552
  const prev = collectorContext.currentSuite;
@@ -9540,17 +9560,17 @@ function withTimeout(fn2, timeout, isHook = false) {
9540
9560
  const { setTimeout, clearTimeout } = getSafeTimers();
9541
9561
  return (...args) => {
9542
9562
  return Promise.race([fn2(...args), new Promise((resolve3, reject) => {
9543
- var _a2;
9563
+ var _a;
9544
9564
  const timer = setTimeout(() => {
9545
9565
  clearTimeout(timer);
9546
9566
  reject(new Error(makeTimeoutMsg(isHook, timeout)));
9547
9567
  }, timeout);
9548
- (_a2 = timer.unref) == null ? void 0 : _a2.call(timer);
9568
+ (_a = timer.unref) == null ? void 0 : _a.call(timer);
9549
9569
  })]);
9550
9570
  };
9551
9571
  }
9552
9572
  function createTestContext(test3, runner2) {
9553
- var _a2;
9573
+ var _a;
9554
9574
  const context = function() {
9555
9575
  throw new Error("done() callback is deprecated, use promise instead");
9556
9576
  };
@@ -9567,7 +9587,7 @@ function createTestContext(test3, runner2) {
9567
9587
  test3.onFinished || (test3.onFinished = []);
9568
9588
  test3.onFinished.push(fn2);
9569
9589
  };
9570
- return ((_a2 = runner2.extendTaskContext) == null ? void 0 : _a2.call(runner2, context)) || context;
9590
+ return ((_a = runner2.extendTaskContext) == null ? void 0 : _a.call(runner2, context)) || context;
9571
9591
  }
9572
9592
  function makeTimeoutMsg(isHook, timeout) {
9573
9593
  return `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
@@ -9813,10 +9833,10 @@ function createSuiteCollector(name, factory = () => {
9813
9833
  }
9814
9834
  if (runner.config.includeTaskLocation) {
9815
9835
  const limit = Error.stackTraceLimit;
9816
- Error.stackTraceLimit = 10;
9836
+ Error.stackTraceLimit = 15;
9817
9837
  const error = new Error("stacktrace").stack;
9818
9838
  Error.stackTraceLimit = limit;
9819
- const stack = findStackTrace(error, task2.each ?? false);
9839
+ const stack = findTestFileStackTrace(error, task2.each ?? false);
9820
9840
  if (stack)
9821
9841
  task2.location = stack;
9822
9842
  }
@@ -9869,18 +9889,12 @@ function createSuiteCollector(name, factory = () => {
9869
9889
  };
9870
9890
  if (runner && includeLocation && runner.config.includeTaskLocation) {
9871
9891
  const limit = Error.stackTraceLimit;
9872
- Error.stackTraceLimit = 5;
9892
+ Error.stackTraceLimit = 15;
9873
9893
  const error = new Error("stacktrace").stack;
9874
9894
  Error.stackTraceLimit = limit;
9875
- const stack = parseSingleStack(error.split("\n")[5]);
9876
- if (stack) {
9877
- suite2.location = {
9878
- line: stack.line,
9879
- // because source map is boundary based, this line leads to ")" in test.each()[(]),
9880
- // but it should be the next opening bracket - here we assume it's on the same line
9881
- column: each ? stack.column + 1 : stack.column
9882
- };
9883
- }
9895
+ const stack = findTestFileStackTrace(error, suite2.each ?? false);
9896
+ if (stack)
9897
+ suite2.location = stack;
9884
9898
  }
9885
9899
  setHooks(suite2, createSuiteHooks());
9886
9900
  }
@@ -9934,9 +9948,14 @@ function createSuite() {
9934
9948
  optionsOrFn,
9935
9949
  fnOrOptions
9936
9950
  );
9951
+ const fnFirst = typeof optionsOrFn === "function";
9937
9952
  cases.forEach((i2, idx) => {
9938
9953
  const items = Array.isArray(i2) ? i2 : [i2];
9939
- arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i2));
9954
+ if (fnFirst) {
9955
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), () => handler(...items), options) : suite2(formatTitle(_name, items, idx), () => handler(i2), options);
9956
+ } else {
9957
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i2));
9958
+ }
9940
9959
  });
9941
9960
  this.setContext("each", void 0);
9942
9961
  };
@@ -9962,9 +9981,14 @@ function createTaskCollector(fn2, context) {
9962
9981
  optionsOrFn,
9963
9982
  fnOrOptions
9964
9983
  );
9984
+ const fnFirst = typeof optionsOrFn === "function";
9965
9985
  cases.forEach((i2, idx) => {
9966
9986
  const items = Array.isArray(i2) ? i2 : [i2];
9967
- arrayOnlyCases ? test22(formatTitle(_name, items, idx), options, () => handler(...items)) : test22(formatTitle(_name, items, idx), options, () => handler(i2));
9987
+ if (fnFirst) {
9988
+ arrayOnlyCases ? test22(formatTitle(_name, items, idx), () => handler(...items), options) : test22(formatTitle(_name, items, idx), () => handler(i2), options);
9989
+ } else {
9990
+ arrayOnlyCases ? test22(formatTitle(_name, items, idx), options, () => handler(...items)) : test22(formatTitle(_name, items, idx), options, () => handler(i2));
9991
+ }
9968
9992
  });
9969
9993
  this.setContext("each", void 0);
9970
9994
  };
@@ -10006,8 +10030,8 @@ function formatTitle(template, items, idx) {
10006
10030
  /\$([$\w_.]+)/g,
10007
10031
  // https://github.com/chaijs/chai/pull/1490
10008
10032
  (_, key) => {
10009
- var _a2, _b;
10010
- return objDisplay(objectAttr(items[0], key), { truncate: (_b = (_a2 = runner == null ? void 0 : runner.config) == null ? void 0 : _a2.chaiConfig) == null ? void 0 : _b.truncateThreshold });
10033
+ var _a, _b;
10034
+ 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 });
10011
10035
  }
10012
10036
  );
10013
10037
  }
@@ -10024,8 +10048,8 @@ function formatTemplateString(cases, args) {
10024
10048
  }
10025
10049
  return res;
10026
10050
  }
10027
- function findStackTrace(error, each) {
10028
- const lines = error.split("\n").slice(4);
10051
+ function findTestFileStackTrace(error, each) {
10052
+ const lines = error.split("\n").slice(1);
10029
10053
  for (const line of lines) {
10030
10054
  const stack = parseSingleStack(line);
10031
10055
  if (stack && stack.file === getTestFilepath()) {
@@ -10076,13 +10100,13 @@ function createTestHook(name, handler) {
10076
10100
  };
10077
10101
  }
10078
10102
 
10079
- // ../../node_modules/vitest/dist/vendor/benchmark.eeqk2rd8.js
10103
+ // ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
10080
10104
  init_cjs_shims();
10081
10105
 
10082
10106
  // ../../node_modules/@vitest/runner/dist/utils.js
10083
10107
  init_cjs_shims();
10084
10108
 
10085
- // ../../node_modules/vitest/dist/vendor/index.ir9i0ywP.js
10109
+ // ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
10086
10110
  init_cjs_shims();
10087
10111
 
10088
10112
  // ../../node_modules/vitest/dist/vendor/global.CkGT_TMy.js
@@ -10100,10 +10124,7 @@ function getCurrentEnvironment() {
10100
10124
  return state == null ? void 0 : state.environment.name;
10101
10125
  }
10102
10126
 
10103
- // ../../node_modules/vitest/dist/vendor/index.ir9i0ywP.js
10104
- var _a;
10105
- var isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
10106
- var isWindows = isNode && process.platform === "win32";
10127
+ // ../../node_modules/vitest/dist/vendor/index.SMVOaj7F.js
10107
10128
  function getRunMode() {
10108
10129
  return getWorkerState().config.mode;
10109
10130
  }
@@ -10111,7 +10132,7 @@ function isRunningInBenchmark() {
10111
10132
  return getRunMode() === "benchmark";
10112
10133
  }
10113
10134
 
10114
- // ../../node_modules/vitest/dist/vendor/benchmark.eeqk2rd8.js
10135
+ // ../../node_modules/vitest/dist/vendor/benchmark.yGkUTKnC.js
10115
10136
  var benchFns = /* @__PURE__ */ new WeakMap();
10116
10137
  var benchOptsMap = /* @__PURE__ */ new WeakMap();
10117
10138
  var bench = createBenchmark(
@@ -10164,7 +10185,7 @@ function isFirstRun() {
10164
10185
  return firstRun;
10165
10186
  }
10166
10187
 
10167
- // ../../node_modules/vitest/dist/vendor/vi.JYQecGiw.js
10188
+ // ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
10168
10189
  init_cjs_shims();
10169
10190
 
10170
10191
  // ../../node_modules/chai/index.mjs
@@ -10692,7 +10713,7 @@ function iterableEquality(a, b2, customTesters = [], aStack = [], bStack = []) {
10692
10713
  return iterableEquality(
10693
10714
  a2,
10694
10715
  b22,
10695
- [...filteredCustomTesters],
10716
+ [...customTesters],
10696
10717
  [...aStack],
10697
10718
  [...bStack]
10698
10719
  );
@@ -10751,6 +10772,10 @@ function iterableEquality(a, b2, customTesters = [], aStack = [], bStack = []) {
10751
10772
  }
10752
10773
  if (!bIterator.next().done)
10753
10774
  return false;
10775
+ const aEntries = Object.entries(a);
10776
+ const bEntries = Object.entries(b2);
10777
+ if (!equals(aEntries, bEntries))
10778
+ return false;
10754
10779
  aStack.pop();
10755
10780
  bStack.pop();
10756
10781
  return true;
@@ -10770,7 +10795,7 @@ function subsetEquality(object2, subset, customTesters = []) {
10770
10795
  if (!isObjectWithKeys(subset2))
10771
10796
  return void 0;
10772
10797
  return Object.keys(subset2).every((key) => {
10773
- if (isObjectWithKeys(subset2[key])) {
10798
+ if (subset2[key] != null && typeof subset2[key] === "object") {
10774
10799
  if (seenReferences.has(subset2[key]))
10775
10800
  return equals(object22[key], subset2[key], filteredCustomTesters);
10776
10801
  seenReferences.set(subset2[key], true);
@@ -10834,6 +10859,57 @@ Received: serializes to the same string
10834
10859
  function pluralize(word, count) {
10835
10860
  return `${count} ${word}${count === 1 ? "" : "s"}`;
10836
10861
  }
10862
+ function getObjectKeys(object2) {
10863
+ return [
10864
+ ...Object.keys(object2),
10865
+ ...Object.getOwnPropertySymbols(object2).filter(
10866
+ (s) => {
10867
+ var _a;
10868
+ return (_a = Object.getOwnPropertyDescriptor(object2, s)) == null ? void 0 : _a.enumerable;
10869
+ }
10870
+ )
10871
+ ];
10872
+ }
10873
+ function getObjectSubset(object2, subset, customTesters = []) {
10874
+ let stripped = 0;
10875
+ const getObjectSubsetWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object22, subset2) => {
10876
+ if (Array.isArray(object22)) {
10877
+ if (Array.isArray(subset2) && subset2.length === object22.length) {
10878
+ return subset2.map(
10879
+ (sub, i2) => getObjectSubsetWithContext(seenReferences)(object22[i2], sub)
10880
+ );
10881
+ }
10882
+ } else if (object22 instanceof Date) {
10883
+ return object22;
10884
+ } else if (isObject(object22) && isObject(subset2)) {
10885
+ if (equals(object22, subset2, [
10886
+ ...customTesters,
10887
+ iterableEquality,
10888
+ subsetEquality
10889
+ ])) {
10890
+ return subset2;
10891
+ }
10892
+ const trimmed = {};
10893
+ seenReferences.set(object22, trimmed);
10894
+ for (const key of getObjectKeys(object22)) {
10895
+ if (hasPropertyInObject(subset2, key)) {
10896
+ trimmed[key] = seenReferences.has(object22[key]) ? seenReferences.get(object22[key]) : getObjectSubsetWithContext(seenReferences)(object22[key], subset2[key]);
10897
+ } else {
10898
+ if (!seenReferences.has(object22[key])) {
10899
+ stripped += 1;
10900
+ if (isObject(object22[key]))
10901
+ stripped += getObjectKeys(object22[key]).length;
10902
+ getObjectSubsetWithContext(seenReferences)(object22[key], subset2[key]);
10903
+ }
10904
+ }
10905
+ }
10906
+ if (getObjectKeys(trimmed).length > 0)
10907
+ return trimmed;
10908
+ }
10909
+ return object22;
10910
+ };
10911
+ return { subset: getObjectSubsetWithContext()(object2, subset), stripped };
10912
+ }
10837
10913
  var AsymmetricMatcher3 = class {
10838
10914
  constructor(sample, inverse = false) {
10839
10915
  this.sample = sample;
@@ -11124,7 +11200,7 @@ function recordAsyncExpect(test3, promise) {
11124
11200
  }
11125
11201
  function wrapSoft(utils, fn2) {
11126
11202
  return function(...args) {
11127
- var _a2;
11203
+ var _a;
11128
11204
  const test3 = utils.flag(this, "vitest-test");
11129
11205
  const state = (test3 == null ? void 0 : test3.context._local) ? test3.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
11130
11206
  if (!state.soft)
@@ -11136,7 +11212,7 @@ function wrapSoft(utils, fn2) {
11136
11212
  } catch (err) {
11137
11213
  test3.result || (test3.result = { state: "fail" });
11138
11214
  test3.result.state = "fail";
11139
- (_a2 = test3.result).errors || (_a2.errors = []);
11215
+ (_a = test3.result).errors || (_a.errors = []);
11140
11216
  test3.result.errors.push(processError(err));
11141
11217
  }
11142
11218
  };
@@ -11261,16 +11337,30 @@ var JestChaiExpect = (chai3, utils) => {
11261
11337
  });
11262
11338
  def("toMatchObject", function(expected) {
11263
11339
  const actual = this._obj;
11264
- return this.assert(
11265
- equals(actual, expected, [...customTesters, iterableEquality, subsetEquality]),
11266
- "expected #{this} to match object #{exp}",
11267
- "expected #{this} to not match object #{exp}",
11268
- expected,
11269
- actual
11270
- );
11340
+ const pass = equals(actual, expected, [...customTesters, iterableEquality, subsetEquality]);
11341
+ const isNot = utils.flag(this, "negate");
11342
+ const { subset: actualSubset, stripped } = getObjectSubset(actual, expected);
11343
+ if (pass && isNot || !pass && !isNot) {
11344
+ const msg = utils.getMessage(
11345
+ this,
11346
+ [
11347
+ pass,
11348
+ "expected #{this} to match object #{exp}",
11349
+ "expected #{this} to not match object #{exp}",
11350
+ expected,
11351
+ actualSubset,
11352
+ false
11353
+ ]
11354
+ );
11355
+ const message = stripped === 0 ? msg : `${msg}
11356
+ (${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
11357
+ throw new AssertionError2(message, { showDiff: true, expected, actual: actualSubset });
11358
+ }
11271
11359
  });
11272
11360
  def("toMatch", function(expected) {
11273
11361
  const actual = this._obj;
11362
+ if (typeof actual !== "string")
11363
+ throw new TypeError(`.toMatch() expects to receive a string, but got ${typeof actual}`);
11274
11364
  return this.assert(
11275
11365
  typeof expected === "string" ? actual.includes(expected) : actual.match(expected),
11276
11366
  `expected #{this} to match #{exp}`,
@@ -11612,12 +11702,15 @@ Number of calls: ${c2().bold(spy.mock.calls.length)}
11612
11702
  const spy = getSpy(this);
11613
11703
  const spyName = spy.getMockName();
11614
11704
  const nthCall = spy.mock.calls[times - 1];
11705
+ const callCount = spy.mock.calls.length;
11706
+ const isCalled = times <= callCount;
11615
11707
  this.assert(
11616
11708
  equals(nthCall, args, [...customTesters, iterableEquality]),
11617
- `expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}`,
11709
+ `expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}${isCalled ? `` : `, but called only ${callCount} times`}`,
11618
11710
  `expected ${ordinalOf(times)} "${spyName}" call to not have been called with #{exp}`,
11619
11711
  args,
11620
- nthCall
11712
+ nthCall,
11713
+ isCalled
11621
11714
  );
11622
11715
  });
11623
11716
  def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) {
@@ -12239,9 +12332,9 @@ ${snapshots.join("\n\n")}
12239
12332
  }
12240
12333
  function prepareExpected(expected) {
12241
12334
  function findStartIndent() {
12242
- var _a2, _b;
12335
+ var _a, _b;
12243
12336
  const matchObject = /^( +)}\s+$/m.exec(expected || "");
12244
- const objectIndent = (_a2 = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a2.length;
12337
+ const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length;
12245
12338
  if (objectIndent)
12246
12339
  return objectIndent;
12247
12340
  const matchText = /^\n( +)"/.exec(expected || "");
@@ -12808,8 +12901,8 @@ function parseStacktrace(stack, options = {}) {
12808
12901
  if (ignoreStackEntries.length)
12809
12902
  stacks = stacks.filter((stack2) => !ignoreStackEntries.some((p) => stack2.file.match(p)));
12810
12903
  return stacks.map((stack2) => {
12811
- var _a2;
12812
- const map2 = (_a2 = options.getSourceMap) == null ? void 0 : _a2.call(options, stack2.file);
12904
+ var _a;
12905
+ const map2 = (_a = options.getSourceMap) == null ? void 0 : _a.call(options, stack2.file);
12813
12906
  if (!map2 || typeof map2 !== "object" || !map2.version)
12814
12907
  return stack2;
12815
12908
  const traceMap = new TraceMap(map2);
@@ -13221,10 +13314,10 @@ var SnapshotClient = class {
13221
13314
  snapshotState;
13222
13315
  snapshotStateMap = /* @__PURE__ */ new Map();
13223
13316
  async startCurrentRun(filepath, name, options) {
13224
- var _a2;
13317
+ var _a;
13225
13318
  this.filepath = filepath;
13226
13319
  this.name = name;
13227
- if (((_a2 = this.snapshotState) == null ? void 0 : _a2.testFilePath) !== filepath) {
13320
+ if (((_a = this.snapshotState) == null ? void 0 : _a.testFilePath) !== filepath) {
13228
13321
  await this.finishCurrentRun();
13229
13322
  if (!this.getSnapshotState(filepath)) {
13230
13323
  this.snapshotStateMap.set(
@@ -13246,11 +13339,11 @@ var SnapshotClient = class {
13246
13339
  this.name = void 0;
13247
13340
  }
13248
13341
  skipTestSnapshots(name) {
13249
- var _a2;
13250
- (_a2 = this.snapshotState) == null ? void 0 : _a2.markSnapshotsAsCheckedForTest(name);
13342
+ var _a;
13343
+ (_a = this.snapshotState) == null ? void 0 : _a.markSnapshotsAsCheckedForTest(name);
13251
13344
  }
13252
13345
  assert(options) {
13253
- var _a2, _b, _c, _d;
13346
+ var _a, _b, _c, _d;
13254
13347
  const {
13255
13348
  filepath = this.filepath,
13256
13349
  name = this.name,
@@ -13269,7 +13362,7 @@ var SnapshotClient = class {
13269
13362
  if (typeof received !== "object" || !received)
13270
13363
  throw new Error("Received value must be an object when the matcher has properties");
13271
13364
  try {
13272
- const pass2 = ((_b = (_a2 = this.options).isEqual) == null ? void 0 : _b.call(_a2, received, properties)) ?? false;
13365
+ const pass2 = ((_b = (_a = this.options).isEqual) == null ? void 0 : _b.call(_a, received, properties)) ?? false;
13273
13366
  if (!pass2)
13274
13367
  throw createMismatchError("Snapshot properties mismatched", (_c = this.snapshotState) == null ? void 0 : _c.expand, received, properties);
13275
13368
  else
@@ -13330,7 +13423,7 @@ function getFullName(task, separator = " > ") {
13330
13423
  return getNames(task).join(separator);
13331
13424
  }
13332
13425
 
13333
- // ../../node_modules/vitest/dist/vendor/base.Xt0Omgh7.js
13426
+ // ../../node_modules/vitest/dist/vendor/base.5NT-gWu5.js
13334
13427
  init_cjs_shims();
13335
13428
  function isChildProcess() {
13336
13429
  return typeof process !== "undefined" && !!process.send;
@@ -13388,7 +13481,7 @@ function resetDate() {
13388
13481
  globalThis.Date = RealDate;
13389
13482
  }
13390
13483
 
13391
- // ../../node_modules/vitest/dist/vendor/vi.JYQecGiw.js
13484
+ // ../../node_modules/vitest/dist/vendor/vi.YFlodzP_.js
13392
13485
  function resetModules(modules, resetMocks = false) {
13393
13486
  const skipPaths = [
13394
13487
  // Vitest
@@ -13569,11 +13662,11 @@ function getError(expected, promise) {
13569
13662
  }
13570
13663
  var SnapshotPlugin = (chai3, utils) => {
13571
13664
  const getTestNames = (test3) => {
13572
- var _a2;
13665
+ var _a;
13573
13666
  if (!test3)
13574
13667
  return {};
13575
13668
  return {
13576
- filepath: (_a2 = test3.file) == null ? void 0 : _a2.filepath,
13669
+ filepath: (_a = test3.file) == null ? void 0 : _a.filepath,
13577
13670
  name: getNames(test3).slice(1).join(" > ")
13578
13671
  };
13579
13672
  };
@@ -13630,12 +13723,12 @@ var SnapshotPlugin = (chai3, utils) => {
13630
13723
  chai3.Assertion.prototype,
13631
13724
  "toMatchInlineSnapshot",
13632
13725
  function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
13633
- var _a2;
13726
+ var _a;
13634
13727
  const isNot = utils.flag(this, "negate");
13635
13728
  if (isNot)
13636
13729
  throw new Error('toMatchInlineSnapshot cannot be used with "not"');
13637
13730
  const test3 = utils.flag(this, "vitest-test");
13638
- const isInsideEach = test3 && (test3.each || ((_a2 = test3.suite) == null ? void 0 : _a2.each));
13731
+ const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
13639
13732
  if (isInsideEach)
13640
13733
  throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
13641
13734
  const expected = utils.flag(this, "object");
@@ -13683,12 +13776,12 @@ var SnapshotPlugin = (chai3, utils) => {
13683
13776
  chai3.Assertion.prototype,
13684
13777
  "toThrowErrorMatchingInlineSnapshot",
13685
13778
  function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
13686
- var _a2;
13779
+ var _a;
13687
13780
  const isNot = utils.flag(this, "negate");
13688
13781
  if (isNot)
13689
13782
  throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
13690
13783
  const test3 = utils.flag(this, "vitest-test");
13691
- const isInsideEach = test3 && (test3.each || ((_a2 = test3.suite) == null ? void 0 : _a2.each));
13784
+ const isInsideEach = test3 && (test3.each || ((_a = test3.suite) == null ? void 0 : _a.each));
13692
13785
  if (isInsideEach)
13693
13786
  throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
13694
13787
  const expected = utils.flag(this, "object");
@@ -13720,7 +13813,7 @@ use(Subset);
13720
13813
  use(SnapshotPlugin);
13721
13814
  use(JestAsymmetricMatchers);
13722
13815
  function createExpect(test3) {
13723
- var _a2;
13816
+ var _a;
13724
13817
  const expect2 = (value, message) => {
13725
13818
  const { assertionCalls } = getState(expect2);
13726
13819
  setState({ assertionCalls: assertionCalls + 1, soft: false }, expect2);
@@ -13745,7 +13838,7 @@ function createExpect(test3) {
13745
13838
  expectedAssertionsNumber: null,
13746
13839
  expectedAssertionsNumberErrorGen: null,
13747
13840
  environment: getCurrentEnvironment(),
13748
- testPath: test3 ? (_a2 = test3.suite.file) == null ? void 0 : _a2.filepath : globalState.testPath,
13841
+ testPath: test3 ? (_a = test3.suite.file) == null ? void 0 : _a.filepath : globalState.testPath,
13749
13842
  currentTestName: test3 ? getFullName(test3) : globalState.currentTestName
13750
13843
  }, expect2);
13751
13844
  expect2.extend = (matchers) => expect.extend(expect2, matchers);
@@ -15320,7 +15413,7 @@ var FakeTimers = class {
15320
15413
  }
15321
15414
  }
15322
15415
  useFakeTimers() {
15323
- var _a2, _b, _c;
15416
+ var _a, _b, _c;
15324
15417
  if (this._fakingDate) {
15325
15418
  throw new Error(
15326
15419
  '"setSystemTime" was called already and date was mocked. Reset timers using `vi.useRealTimers()` if you want to use fake timers again.'
@@ -15328,7 +15421,7 @@ var FakeTimers = class {
15328
15421
  }
15329
15422
  if (!this._fakingTime) {
15330
15423
  const toFake = Object.keys(this._fakeTimers.timers).filter((timer) => timer !== "nextTick");
15331
- if (((_b = (_a2 = this._userConfig) == null ? void 0 : _a2.toFake) == null ? void 0 : _b.includes("nextTick")) && isChildProcess())
15424
+ if (((_b = (_a = this._userConfig) == null ? void 0 : _a.toFake) == null ? void 0 : _b.includes("nextTick")) && isChildProcess())
15332
15425
  throw new Error("process.nextTick cannot be mocked inside child_process");
15333
15426
  const existingFakedMethods = (((_c = this._userConfig) == null ? void 0 : _c.toFake) || toFake).filter((method) => {
15334
15427
  switch (method) {
@@ -15513,12 +15606,14 @@ function createVitest() {
15513
15606
  let _mockedDate = null;
15514
15607
  let _config = null;
15515
15608
  const workerState = getWorkerState();
15516
- const _timers = new FakeTimers({
15609
+ let _timers;
15610
+ const timers = () => _timers || (_timers = new FakeTimers({
15517
15611
  global: globalThis,
15518
15612
  config: workerState.config.fakeTimers
15519
- });
15613
+ }));
15520
15614
  const _stubsGlobal = /* @__PURE__ */ new Map();
15521
15615
  const _stubsEnv = /* @__PURE__ */ new Map();
15616
+ const _envBooleans = ["PROD", "DEV", "SSR"];
15522
15617
  const getImporter = () => {
15523
15618
  const stackTrace = createSimpleStackTrace({ stackTraceLimit: 4 });
15524
15619
  const importerStack = stackTrace.split("\n")[4];
@@ -15527,82 +15622,82 @@ function createVitest() {
15527
15622
  };
15528
15623
  const utils = {
15529
15624
  useFakeTimers(config2) {
15530
- var _a2, _b, _c, _d;
15625
+ var _a, _b, _c, _d;
15531
15626
  if (isChildProcess()) {
15532
- if (((_a2 = config2 == null ? void 0 : config2.toFake) == null ? void 0 : _a2.includes("nextTick")) || ((_d = (_c = (_b = workerState.config) == null ? void 0 : _b.fakeTimers) == null ? void 0 : _c.toFake) == null ? void 0 : _d.includes("nextTick"))) {
15627
+ 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"))) {
15533
15628
  throw new Error(
15534
15629
  'vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.'
15535
15630
  );
15536
15631
  }
15537
15632
  }
15538
15633
  if (config2)
15539
- _timers.configure({ ...workerState.config.fakeTimers, ...config2 });
15634
+ timers().configure({ ...workerState.config.fakeTimers, ...config2 });
15540
15635
  else
15541
- _timers.configure(workerState.config.fakeTimers);
15542
- _timers.useFakeTimers();
15636
+ timers().configure(workerState.config.fakeTimers);
15637
+ timers().useFakeTimers();
15543
15638
  return utils;
15544
15639
  },
15545
15640
  isFakeTimers() {
15546
- return _timers.isFakeTimers();
15641
+ return timers().isFakeTimers();
15547
15642
  },
15548
15643
  useRealTimers() {
15549
- _timers.useRealTimers();
15644
+ timers().useRealTimers();
15550
15645
  _mockedDate = null;
15551
15646
  return utils;
15552
15647
  },
15553
15648
  runOnlyPendingTimers() {
15554
- _timers.runOnlyPendingTimers();
15649
+ timers().runOnlyPendingTimers();
15555
15650
  return utils;
15556
15651
  },
15557
15652
  async runOnlyPendingTimersAsync() {
15558
- await _timers.runOnlyPendingTimersAsync();
15653
+ await timers().runOnlyPendingTimersAsync();
15559
15654
  return utils;
15560
15655
  },
15561
15656
  runAllTimers() {
15562
- _timers.runAllTimers();
15657
+ timers().runAllTimers();
15563
15658
  return utils;
15564
15659
  },
15565
15660
  async runAllTimersAsync() {
15566
- await _timers.runAllTimersAsync();
15661
+ await timers().runAllTimersAsync();
15567
15662
  return utils;
15568
15663
  },
15569
15664
  runAllTicks() {
15570
- _timers.runAllTicks();
15665
+ timers().runAllTicks();
15571
15666
  return utils;
15572
15667
  },
15573
15668
  advanceTimersByTime(ms) {
15574
- _timers.advanceTimersByTime(ms);
15669
+ timers().advanceTimersByTime(ms);
15575
15670
  return utils;
15576
15671
  },
15577
15672
  async advanceTimersByTimeAsync(ms) {
15578
- await _timers.advanceTimersByTimeAsync(ms);
15673
+ await timers().advanceTimersByTimeAsync(ms);
15579
15674
  return utils;
15580
15675
  },
15581
15676
  advanceTimersToNextTimer() {
15582
- _timers.advanceTimersToNextTimer();
15677
+ timers().advanceTimersToNextTimer();
15583
15678
  return utils;
15584
15679
  },
15585
15680
  async advanceTimersToNextTimerAsync() {
15586
- await _timers.advanceTimersToNextTimerAsync();
15681
+ await timers().advanceTimersToNextTimerAsync();
15587
15682
  return utils;
15588
15683
  },
15589
15684
  getTimerCount() {
15590
- return _timers.getTimerCount();
15685
+ return timers().getTimerCount();
15591
15686
  },
15592
15687
  setSystemTime(time) {
15593
15688
  const date = time instanceof Date ? time : new Date(time);
15594
15689
  _mockedDate = date;
15595
- _timers.setSystemTime(date);
15690
+ timers().setSystemTime(date);
15596
15691
  return utils;
15597
15692
  },
15598
15693
  getMockedSystemTime() {
15599
15694
  return _mockedDate;
15600
15695
  },
15601
15696
  getRealSystemTime() {
15602
- return _timers.getRealSystemTime();
15697
+ return timers().getRealSystemTime();
15603
15698
  },
15604
15699
  clearAllTimers() {
15605
- _timers.clearAllTimers();
15700
+ timers().clearAllTimers();
15606
15701
  return utils;
15607
15702
  },
15608
15703
  // mocks
@@ -15681,7 +15776,10 @@ function createVitest() {
15681
15776
  stubEnv(name, value) {
15682
15777
  if (!_stubsEnv.has(name))
15683
15778
  _stubsEnv.set(name, process.env[name]);
15684
- process.env[name] = value;
15779
+ if (_envBooleans.includes(name))
15780
+ process.env[name] = value ? "1" : "";
15781
+ else
15782
+ process.env[name] = String(value);
15685
15783
  return utils;
15686
15784
  },
15687
15785
  unstubAllGlobals() {
@@ -15726,7 +15824,7 @@ function createVitest() {
15726
15824
  var vitest = createVitest();
15727
15825
  var vi = vitest;
15728
15826
 
15729
- // ../../node_modules/vitest/dist/vendor/index.BeX1oZht.js
15827
+ // ../../node_modules/vitest/dist/vendor/index.dI9lHwVn.js
15730
15828
  init_cjs_shims();
15731
15829
  function getRunningMode() {
15732
15830
  return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";