vitest 5.0.2 → 5.0.4

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.
Files changed (79) hide show
  1. package/LICENSE.md +29 -1
  2. package/browser/context.d.ts +7 -1
  3. package/browser/context.js +5 -5
  4. package/dist/browser.d.ts +4 -4
  5. package/dist/browser.js +11 -11
  6. package/dist/chunks/{base.5tQXSzMP.js → base.CYbb9pQW.js} +39 -15
  7. package/dist/chunks/{browser.d.g5Thl309.d.ts → browser.d.FGQ9_rK6.d.ts} +3 -3
  8. package/dist/chunks/{cac.BLbEtnDd.js → cac.DTXWs6Ni.js} +21 -23
  9. package/dist/chunks/cli-api.Bx28WXzL.js +13879 -0
  10. package/dist/chunks/{config.d.CU_b-wJj.d.ts → config.d.QBNYCgFU.d.ts} +33 -24
  11. package/dist/chunks/{console.B09ye7y0.js → console.DtI4yxfN.js} +5 -4
  12. package/dist/chunks/{coverage.AipniaqB.js → coverage.-bm5IxnW.js} +1 -1
  13. package/dist/chunks/{coverage.CX7NN5s7.js → coverage.cTDc4uSS.js} +1 -1
  14. package/dist/chunks/{creator.2VTnpYzN.js → creator.CLL8QFMS.js} +44 -54
  15. package/dist/chunks/{defaults.D2ip7f-X.js → defaults.B1FCaFfh.js} +2 -2
  16. package/dist/chunks/{display.pkpxlVcY.js → display.BlTmubjj.js} +1 -1
  17. package/dist/chunks/{doctor.BCXa6-1R.js → doctor.Bqc8NDDb.js} +40 -41
  18. package/dist/chunks/{env.DzFJjrmK.js → env.BKKtU2WC.js} +1 -1
  19. package/dist/chunks/{environment.d.C6xYahWA.d.ts → environment.d.BY56MoGs.d.ts} +1 -1
  20. package/dist/chunks/{globals.Brdv9iOs.js → globals.CTWMSIPL.js} +10 -10
  21. package/dist/chunks/{index.C-uw7tH9.js → index.B8VfM7Mf.js} +8606 -20822
  22. package/dist/chunks/{index.DXQx-kDM.js → index.BoyTG_B7.js} +9 -4
  23. package/dist/chunks/{index.hTNFpC24.js → index.CPNMO3h-.js} +73 -50
  24. package/dist/chunks/{index.M2dsQ_UQ.js → index.D0heQG4v.js} +557 -183
  25. package/dist/chunks/{index.BgwtGYxD.js → index.GYMZ12wH.js} +5 -5
  26. package/dist/chunks/{index.DGdajAO2.js → index.uwTEEBsB.js} +94 -71
  27. package/dist/chunks/{init-forks.CdGu3HUy.js → init-forks.CbYYa5xq.js} +1 -1
  28. package/dist/chunks/{init-threads.2f_lsHNK.js → init-threads.DtjdvxPl.js} +1 -1
  29. package/dist/chunks/{init.IsjtLXKe.js → init.DrHtV5zd.js} +7 -7
  30. package/dist/chunks/module-dependencies.CwNPkcV4.js +71 -0
  31. package/dist/chunks/{native.CF4uT5hY.js → native.cdzHIdmv.js} +48 -34
  32. package/dist/chunks/{nativeModuleMocker.DwRB4F9R.js → nativeModuleMocker.D8f4cW4A.js} +2 -2
  33. package/dist/chunks/{nativeModuleRunner.J0QLzNtK.js → nativeModuleRunner.xi64Afb2.js} +1 -1
  34. package/dist/chunks/{node.CfQ_OGWr.js → node.uQulW0ei.js} +1 -1
  35. package/dist/chunks/{pathe.M-eThtNZ.DwEga6ro.js → pathe.M-eThtNZ.Ba-7h1rE.js} +9 -7
  36. package/dist/chunks/{plugin.d.My_z-jmU.d.ts → plugin.d.C8mmycim.d.ts} +109 -68
  37. package/dist/chunks/{plugins.Cigb0uSy.js → plugins.DPQHVT0p.js} +1 -1
  38. package/dist/chunks/{resolver.NpfwMKt9.js → resolver.CtCcxIy1.js} +1 -1
  39. package/dist/chunks/{rpc.CJVl3hZH.js → rpc.DpkUyY1N.js} +3 -2
  40. package/dist/chunks/{rpc.d.DA9Utv4e.d.ts → rpc.d.Cft1biqy.d.ts} +2 -1
  41. package/dist/chunks/{run.C5UmxDPh.js → run.Cm2sd7-x.js} +122 -97
  42. package/dist/chunks/{setup-common.Ct8rQvjH.js → setup-common.BABL3z3m.js} +3 -3
  43. package/dist/chunks/{source-map.BH0bbrs9.js → source-map.DdKI5IHB.js} +15 -10
  44. package/dist/chunks/{source-map.d.YqWNcp4e.d.ts → source-map.d.kzFtk_dj.d.ts} +1 -1
  45. package/dist/chunks/{spy.KLHgXex_.js → spy.DDMXghXv.js} +63 -32
  46. package/dist/chunks/{task-utils.d.BZm4GSQD.d.ts → task-utils.d.PFh2BV6Q.d.ts} +1 -1
  47. package/dist/chunks/tinyrainbow.Do8I1XRG.js +88 -0
  48. package/dist/chunks/{utils.CJ0JImL8.js → utils.DSfl_w8V.js} +44 -42
  49. package/dist/chunks/{vm.KI2AYADz.js → vm.Uo_C9Uld.js} +16 -13
  50. package/dist/chunks/{worker.d.MLmnzOJE.d.ts → worker.d.BH-r1bPu.d.ts} +8 -3
  51. package/dist/cli.js +4 -4
  52. package/dist/config.cjs +1 -1
  53. package/dist/config.d.ts +9 -10
  54. package/dist/config.js +2 -2
  55. package/dist/index.d.ts +10 -10
  56. package/dist/index.js +10 -10
  57. package/dist/module-evaluator.d.ts +3 -2
  58. package/dist/module-evaluator.js +8 -5
  59. package/dist/node.d.ts +9 -10
  60. package/dist/node.js +27 -26
  61. package/dist/runtime.d.ts +6 -6
  62. package/dist/runtime.js +4 -4
  63. package/dist/spy.js +1 -1
  64. package/dist/task-utils.js +7 -4
  65. package/dist/worker.d.ts +4 -4
  66. package/dist/worker.js +21 -20
  67. package/dist/workers/forks.js +19 -18
  68. package/dist/workers/runVmTests.js +23 -14
  69. package/dist/workers/threads.js +19 -18
  70. package/dist/workers/vmForks.js +13 -13
  71. package/dist/workers/vmThreads.js +13 -13
  72. package/globals.d.ts +19 -19
  73. package/index.cjs +3 -3
  74. package/optional-runtime-types.d.ts +1 -1
  75. package/optional-types.d.ts +1 -1
  76. package/package.json +35 -29
  77. package/suppress-warnings.cjs +1 -1
  78. package/dist/chunks/cli-api.DL4Bd7Vh.js +0 -528
  79. package/dist/chunks/tinyrainbow.Ht9iggcq.js +0 -95
@@ -1,8 +1,8 @@
1
- import { f as format, p as plugins } from './index.M2dsQ_UQ.js';
2
- import { y } from './tinyrainbow.Ht9iggcq.js';
3
- import { s as stringify, f as format$1, a as formatRegExp, t as truncateString, i as inspect } from './display.pkpxlVcY.js';
4
- import { p as deepClone, q as getOwnProperties, g as getType$1, u as isObject, v as filterOutComments, w as ordinal, e as createDefer, x as assertTypes, t as toArray, y as isNegativeNaN, z as unique, A as objectAttr } from './pathe.M-eThtNZ.DwEga6ro.js';
5
- import { d as diffSequences, b as serializeValue, p as parseStacktrace, a as getSafeTimers } from './source-map.BH0bbrs9.js';
1
+ import { f as format, p as plugins } from './index.D0heQG4v.js';
2
+ import { $ } from './tinyrainbow.Do8I1XRG.js';
3
+ import { s as stringify, f as format$1, a as formatRegExp, t as truncateString, i as inspect } from './display.BlTmubjj.js';
4
+ import { p as deepClone, q as getOwnProperties, g as getType$1, u as isObject, v as filterOutComments, w as ordinal, e as createDefer, x as assertTypes, t as toArray, y as isNegativeNaN, z as unique, A as objectAttr } from './pathe.M-eThtNZ.Ba-7h1rE.js';
5
+ import { d as diffSequences, b as serializeValue, p as parseStacktrace, a as getSafeTimers } from './source-map.DdKI5IHB.js';
6
6
  import { createTaskName, createFileTask, calculateSuiteHash, interpretTaskModes, hasFailed } from '../task-utils.js';
7
7
 
8
8
  const RealDate = Date;
@@ -508,25 +508,27 @@ function joinAlignedDiffsNoExpand(diffs, options) {
508
508
  while (i !== iLength) {
509
509
  const iStart = i;
510
510
  while (i !== iLength && diffs[i][0] === DIFF_EQUAL) i += 1;
511
- if (iStart !== i) if (iStart === 0) {
512
- // at start
513
- if (i > nContextLines) {
514
- jLength -= i - nContextLines;
515
- hasExcessAtStartOrEnd = true;
516
- }
517
- } else if (i === iLength) {
518
- // at end
519
- const n = i - iStart;
520
- if (n > nContextLines) {
521
- jLength -= n - nContextLines;
522
- hasExcessAtStartOrEnd = true;
523
- }
524
- } else {
525
- // between changes
526
- const n = i - iStart;
527
- if (n > nContextLines2) {
528
- jLength -= n - nContextLines2;
529
- nExcessesBetweenChanges += 1;
511
+ if (iStart !== i) {
512
+ if (iStart === 0) {
513
+ // at start
514
+ if (i > nContextLines) {
515
+ jLength -= i - nContextLines;
516
+ hasExcessAtStartOrEnd = true;
517
+ }
518
+ } else if (i === iLength) {
519
+ // at end
520
+ const n = i - iStart;
521
+ if (n > nContextLines) {
522
+ jLength -= n - nContextLines;
523
+ hasExcessAtStartOrEnd = true;
524
+ }
525
+ } else {
526
+ // between changes
527
+ const n = i - iStart;
528
+ if (n > nContextLines2) {
529
+ jLength -= n - nContextLines2;
530
+ nExcessesBetweenChanges += 1;
531
+ }
530
532
  }
531
533
  }
532
534
  while (i !== iLength && diffs[i][0] !== DIFF_EQUAL) i += 1;
@@ -564,36 +566,38 @@ function joinAlignedDiffsNoExpand(diffs, options) {
564
566
  while (i !== iLength) {
565
567
  let iStart = i;
566
568
  while (i !== iLength && diffs[i][0] === DIFF_EQUAL) i += 1;
567
- if (iStart !== i) if (iStart === 0) {
568
- // at beginning
569
- if (i > nContextLines) {
570
- iStart = i - nContextLines;
571
- aStart = iStart;
572
- bStart = iStart;
573
- aEnd = aStart;
574
- bEnd = bStart;
575
- }
576
- for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
577
- } else if (i === iLength) {
578
- // at end
579
- const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i;
580
- for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
581
- } else {
582
- // between changes
583
- const nCommon = i - iStart;
584
- if (nCommon > nContextLines2) {
585
- const iEnd = iStart + nContextLines;
569
+ if (iStart !== i) {
570
+ if (iStart === 0) {
571
+ // at beginning
572
+ if (i > nContextLines) {
573
+ iStart = i - nContextLines;
574
+ aStart = iStart;
575
+ bStart = iStart;
576
+ aEnd = aStart;
577
+ bEnd = bStart;
578
+ }
579
+ for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
580
+ } else if (i === iLength) {
581
+ // at end
582
+ const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i;
586
583
  for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
587
- lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options);
588
- jPatchMark = lines.length;
589
- lines.push("");
590
- const nOmit = nCommon - nContextLines2;
591
- aStart = aEnd + nOmit;
592
- bStart = bEnd + nOmit;
593
- aEnd = aStart;
594
- bEnd = bStart;
595
- for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
596
- } else for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
584
+ } else {
585
+ // between changes
586
+ const nCommon = i - iStart;
587
+ if (nCommon > nContextLines2) {
588
+ const iEnd = iStart + nContextLines;
589
+ for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
590
+ lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options);
591
+ jPatchMark = lines.length;
592
+ lines.push("");
593
+ const nOmit = nCommon - nContextLines2;
594
+ aStart = aEnd + nOmit;
595
+ bStart = bEnd + nOmit;
596
+ aEnd = aStart;
597
+ bEnd = bStart;
598
+ for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
599
+ } else for (let iCommon = iStart; iCommon !== i; iCommon += 1) pushCommonLine(diffs[iCommon][1]);
600
+ }
597
601
  }
598
602
  while (i !== iLength && diffs[i][0] === DIFF_DELETE) {
599
603
  pushDeleteLine(diffs[i][1]);
@@ -629,14 +633,14 @@ const DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
629
633
  function getDefaultOptions() {
630
634
  return {
631
635
  aAnnotation: "Expected",
632
- aColor: y.green,
636
+ aColor: $.green,
633
637
  aIndicator: "-",
634
638
  bAnnotation: "Received",
635
- bColor: y.red,
639
+ bColor: $.red,
636
640
  bIndicator: "+",
637
- changeColor: y.inverse,
641
+ changeColor: $.inverse,
638
642
  changeLineTrailingSpaceColor: noColor,
639
- commonColor: y.dim,
643
+ commonColor: $.dim,
640
644
  commonIndicator: " ",
641
645
  commonLineTrailingSpaceColor: noColor,
642
646
  compareKeys: void 0,
@@ -645,7 +649,7 @@ function getDefaultOptions() {
645
649
  expand: false,
646
650
  includeChangeCounts: false,
647
651
  omitAnnotationLines: false,
648
- patchColor: y.yellow,
652
+ patchColor: $.yellow,
649
653
  printBasicPrototype: false,
650
654
  truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
651
655
  truncateAnnotation: "... Diff result is truncated",
@@ -1260,13 +1264,13 @@ function replaceTrailingSpaces(text) {
1260
1264
  return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
1261
1265
  }
1262
1266
  function printReceived(object) {
1263
- return y.red(replaceTrailingSpaces(stringify(object)));
1267
+ return $.red(replaceTrailingSpaces(stringify(object)));
1264
1268
  }
1265
1269
  function printExpected(value) {
1266
- return y.green(replaceTrailingSpaces(stringify(value)));
1270
+ return $.green(replaceTrailingSpaces(stringify(value)));
1267
1271
  }
1268
1272
  function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff) {
1269
- return diffs.reduce((reduced, diff) => reduced + (diff[0] === DIFF_EQUAL ? diff[1] : diff[0] === op ? hasCommonDiff ? y.inverse(diff[1]) : diff[1] : ""), "");
1273
+ return diffs.reduce((reduced, diff) => reduced + (diff[0] === DIFF_EQUAL ? diff[1] : diff[0] === op ? hasCommonDiff ? $.inverse(diff[1]) : diff[1] : ""), "");
1270
1274
  }
1271
1275
 
1272
1276
  function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
@@ -1658,8 +1662,12 @@ function withFixtures(fn, options) {
1658
1662
  // access the parent fixture ({ a: ({ a }) => {} })
1659
1663
  if (cachedFixtures.has(fixture)) continue;
1660
1664
  cachedFixtures.add(fixture);
1661
- const resolvedValue = await resolveTestFixtureValue(fixture, context, cleanupFnArray);
1662
- context[fixture.name] = resolvedValue;
1665
+ try {
1666
+ context[fixture.name] = await resolveTestFixtureValue(fixture, context, cleanupFnArray);
1667
+ } catch (error) {
1668
+ cachedFixtures.delete(fixture);
1669
+ throw error;
1670
+ }
1663
1671
  cleanupFnArray.push(() => {
1664
1672
  cachedFixtures.delete(fixture);
1665
1673
  });
@@ -1701,8 +1709,9 @@ async function resolveScopeFixtureValue(fixtures, suite, fixture) {
1701
1709
  ...fileContext
1702
1710
  } : fixtureContext, cleanupFnFileArray).then((value) => {
1703
1711
  fixtureContext[fixture.name] = value;
1704
- scopedFixturePromiseCache.delete(fixture);
1705
1712
  return value;
1713
+ }).finally(() => {
1714
+ scopedFixturePromiseCache.delete(fixture);
1706
1715
  });
1707
1716
  scopedFixturePromiseCache.set(fixture, promise);
1708
1717
  return promise;
@@ -1750,8 +1759,10 @@ function resolveDeps(usedFixtures, registrations, depSet = /* @__PURE__ */ new S
1750
1759
  pendingFixtures.push(fixture);
1751
1760
  return;
1752
1761
  }
1753
- if (depSet.has(fixture)) if (fixture.parent) fixture = fixture.parent;
1754
- else throw new Error(`Circular fixture dependency detected: ${fixture.name} <- ${[...depSet].reverse().map((d) => d.name).join(" <- ")}`);
1762
+ if (depSet.has(fixture)) {
1763
+ if (fixture.parent) fixture = fixture.parent;
1764
+ else throw new Error(`Circular fixture dependency detected: ${fixture.name} <- ${[...depSet].reverse().map((d) => d.name).join(" <- ")}`);
1765
+ }
1755
1766
  depSet.add(fixture);
1756
1767
  resolveDeps(Array.from(fixture.deps, (n) => n === fixture.name ? fixture.parent : registrations.get(n)).filter((n) => !!n), registrations, depSet, pendingFixtures);
1757
1768
  pendingFixtures.push(fixture);
@@ -2822,9 +2833,10 @@ function createSuite() {
2822
2833
  const fnFirst = typeof optionsOrFn === "function";
2823
2834
  cases.forEach((i, idx) => {
2824
2835
  const items = Array.isArray(i) ? i : [i];
2825
- if (fnFirst) if (arrayOnlyCases) suite(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
2826
- else suite(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
2827
- else if (arrayOnlyCases) suite(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
2836
+ if (fnFirst) {
2837
+ if (arrayOnlyCases) suite(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
2838
+ else suite(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
2839
+ } else if (arrayOnlyCases) suite(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
2828
2840
  else suite(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
2829
2841
  });
2830
2842
  context.setContext("each", void 0);
@@ -2865,9 +2877,10 @@ function createTaskCollector(fn) {
2865
2877
  const fnFirst = typeof optionsOrFn === "function";
2866
2878
  cases.forEach((i, idx) => {
2867
2879
  const items = Array.isArray(i) ? i : [i];
2868
- if (fnFirst) if (arrayOnlyCases) test(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
2869
- else test(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
2870
- else if (arrayOnlyCases) test(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
2880
+ if (fnFirst) {
2881
+ if (arrayOnlyCases) test(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
2882
+ else test(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
2883
+ } else if (arrayOnlyCases) test(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
2871
2884
  else test(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
2872
2885
  });
2873
2886
  context.setContext("each", void 0);
@@ -3004,7 +3017,7 @@ function formatTitle(template, items, idx) {
3004
3017
  const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
3005
3018
  const value = isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement;
3006
3019
  // print string without quotes
3007
- if (typeof value === "string") return truncateString(value, inspectOptions.truncate);
3020
+ if (typeof value === "string") return inspectOptions.truncate ? truncateString(value, inspectOptions.truncate) : value;
3008
3021
  return inspect(value, inspectOptions);
3009
3022
  });
3010
3023
  }
@@ -3110,12 +3123,14 @@ function encodeUint8Array(bytes) {
3110
3123
  let base64 = "";
3111
3124
  const len = bytes.byteLength;
3112
3125
  for (let i = 0; i < len; i += 3) if (len === i + 1) {
3126
+ // last 1 byte
3113
3127
  const a = (bytes[i] & 252) >> 2;
3114
3128
  const b = (bytes[i] & 3) << 4;
3115
3129
  base64 += table[a];
3116
3130
  base64 += table[b];
3117
3131
  base64 += "==";
3118
3132
  } else if (len === i + 2) {
3133
+ // last 2 bytes
3119
3134
  const a = (bytes[i] & 252) >> 2;
3120
3135
  const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
3121
3136
  const c = (bytes[i + 1] & 15) << 2;
@@ -3251,7 +3266,7 @@ async function runWithSuite(suite, fn) {
3251
3266
  function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
3252
3267
  if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) return fn;
3253
3268
  // this function name is used to filter error in test/e2e/test/fails.test.ts
3254
- return (function runWithTimeout(...args) {
3269
+ return function runWithTimeout(...args) {
3255
3270
  const runner = getRunner();
3256
3271
  const previousDeadline = runner._deadline;
3257
3272
  return new Promise((resolve_, reject_) => {
@@ -3307,10 +3322,10 @@ catch (error) {
3307
3322
  reject(error);
3308
3323
  }
3309
3324
  });
3310
- });
3325
+ };
3311
3326
  }
3312
3327
  function withCancel(fn, signal) {
3313
- return (function runWithCancel(...args) {
3328
+ return function runWithCancel(...args) {
3314
3329
  return new Promise((resolve, reject) => {
3315
3330
  const onAbort = () => reject(signal.reason);
3316
3331
  signal.addEventListener("abort", onAbort, { once: true });
@@ -3333,7 +3348,7 @@ function withCancel(fn, signal) {
3333
3348
  reject(error);
3334
3349
  }
3335
3350
  });
3336
- });
3351
+ };
3337
3352
  }
3338
3353
  const abortControllers = /* @__PURE__ */ new WeakMap();
3339
3354
  function abortIfTimeout([context], error) {
@@ -3853,9 +3868,13 @@ async function runTest(test, runner) {
3853
3868
  const suite = test.suite || test.file;
3854
3869
  const $ = runner.trace;
3855
3870
  const repeats = test.repeats ?? 0;
3871
+ let hasFailedRepeat = false;
3856
3872
  for (let repeatCount = 0; repeatCount <= repeats; repeatCount++) {
3873
+ // Force widening to TaskState because TypeScript cannot track mutations made by hooks and the test.
3874
+ test.result.state = "run";
3857
3875
  const retry = getRetryCount(test.retry);
3858
3876
  for (let retryCount = 0; retryCount <= retry; retryCount++) {
3877
+ const attemptErrorsStart = test.result.errors?.length ?? 0;
3859
3878
  let beforeEachCleanups = [];
3860
3879
  // fixtureCheckpoint is passed by callAroundEachHooks - it represents the count
3861
3880
  // of fixture cleanup functions AFTER all aroundEach fixtures have been resolved
@@ -3929,6 +3948,19 @@ async function runTest(test, runner) {
3929
3948
  cleanupRunningTest();
3930
3949
  return;
3931
3950
  }
3951
+ // if test is marked to be failed, flip the result unless `TestSyntaxError` is present
3952
+ if (test.fails) {
3953
+ if (test.result.state === "pass") {
3954
+ const error = processError(/* @__PURE__ */ new Error("Expect test to fail"));
3955
+ test.result.state = "fail";
3956
+ test.result.errors ??= [];
3957
+ test.result.errors.push(error);
3958
+ } else if (!test.result.errors?.slice(attemptErrorsStart).some((e) => e.__vitest_test_syntax_error__)) {
3959
+ test.result.state = "pass";
3960
+ test.result.errors?.splice(attemptErrorsStart);
3961
+ if (!test.result.errors?.length) test.result.errors = void 0;
3962
+ }
3963
+ }
3932
3964
  if (test.result.state === "pass") break;
3933
3965
  if (retryCount < retry) {
3934
3966
  if (!passesRetryCondition(test, test.result.errors)) break;
@@ -3940,18 +3972,9 @@ async function runTest(test, runner) {
3940
3972
  // update retry info
3941
3973
  updateTask("test-retried", test, runner);
3942
3974
  }
3975
+ if (test.result.state === "fail") hasFailedRepeat = true;
3943
3976
  }
3944
- // if test is marked to be failed, flip the result unless `TestSyntaxError` is present
3945
- if (test.fails) {
3946
- if (test.result.state === "pass") {
3947
- const error = processError(/* @__PURE__ */ new Error("Expect test to fail"));
3948
- test.result.state = "fail";
3949
- test.result.errors = [error];
3950
- } else if (!test.result.errors?.some((e) => e.__vitest_test_syntax_error__)) {
3951
- test.result.state = "pass";
3952
- test.result.errors = void 0;
3953
- }
3954
- }
3977
+ if (hasFailedRepeat) test.result.state = "fail";
3955
3978
  cleanupRunningTest();
3956
3979
  setCurrentTest(void 0);
3957
3980
  test.result.duration = now() - start;
@@ -4074,14 +4097,16 @@ async function runSuite(suite, runner) {
4074
4097
  if (!suiteRan) markTasksAsSkipped(suite, runner);
4075
4098
  failTask(suite.result, e, runner.config._diffOptions);
4076
4099
  }
4077
- if (suite.mode === "run" || suite.mode === "queued") if (!runner.config.passWithNoTests && !suite.containsTest) {
4078
- suite.result.state = "fail";
4079
- if (!suite.result.errors?.length) {
4080
- const error = processError(/* @__PURE__ */ new Error(`No test found in suite ${suite.name}`));
4081
- suite.result.errors = [error];
4082
- }
4083
- } else if (hasFailed(suite)) suite.result.state = "fail";
4084
- else suite.result.state = "pass";
4100
+ if (suite.mode === "run" || suite.mode === "queued") {
4101
+ if (!runner.config.passWithNoTests && !suite.containsTest) {
4102
+ suite.result.state = "fail";
4103
+ if (!suite.result.errors?.length) {
4104
+ const error = processError(/* @__PURE__ */ new Error(`No test found in suite ${suite.name}`));
4105
+ suite.result.errors = [error];
4106
+ }
4107
+ } else if (hasFailed(suite)) suite.result.state = "fail";
4108
+ else suite.result.state = "pass";
4109
+ }
4085
4110
  suite.result.duration = now() - start;
4086
4111
  await runner.onAfterRunSuite?.(suite);
4087
4112
  updateTask("suite-finished", suite, runner);
@@ -4173,4 +4198,4 @@ async function publicCollect(specs, runner) {
4173
4198
  return files;
4174
4199
  }
4175
4200
 
4176
- export { limitConcurrency as A, shuffle as B, createTagsFilter as C, TestSyntaxError as T, processError as a, printDiffOrStringify as b, createTaskCollector as c, diff as d, getCurrentSuite as e, createChainable as f, getCurrentTest as g, getHooks as h, getFn as i, afterAll as j, afterEach as k, aroundAll as l, matchesTags as m, aroundEach as n, beforeAll as o, publicCollect as p, beforeEach as q, describe as r, startTests as s, it as t, onTestFailed as u, onTestFinished as v, recordArtifact as w, suite as x, test as y, validateTags as z };
4201
+ export { createTagsFilter as A, validateTags as B, shuffle as C, TestSyntaxError as T, processError as a, printDiffOrStringify as b, createTaskCollector as c, diff as d, getCurrentSuite as e, createChainable as f, getCurrentTest as g, getHooks as h, getFn as i, afterAll as j, afterEach as k, aroundAll as l, matchesTags as m, aroundEach as n, beforeAll as o, publicCollect as p, beforeEach as q, describe as r, startTests as s, it as t, onTestFailed as u, onTestFinished as v, recordArtifact as w, suite as x, test as y, limitConcurrency as z };
@@ -1,5 +1,5 @@
1
- import { s as setSafeTimers } from './source-map.BH0bbrs9.js';
2
- import { a as addSerializer } from './plugins.Cigb0uSy.js';
1
+ import { s as setSafeTimers } from './source-map.DdKI5IHB.js';
2
+ import { a as addSerializer } from './plugins.DPQHVT0p.js';
3
3
 
4
4
  let globalSetup = false;
5
5
  async function setupCommonEnv(config) {
@@ -7,7 +7,7 @@ async function setupCommonEnv(config) {
7
7
  if (globalSetup) return;
8
8
  globalSetup = true;
9
9
  setSafeTimers();
10
- if (config.globals) (await import('./globals.Brdv9iOs.js')).registerApiGlobally();
10
+ if (config.globals) (await import('./globals.CTWMSIPL.js')).registerApiGlobally();
11
11
  }
12
12
  function setupDefines(config) {
13
13
  for (const key in config.defines) globalThis[key] = config.defines[key];
@@ -1,9 +1,5 @@
1
- import { m as isPrimitive, o as notNullish, r as resolve$1 } from './pathe.M-eThtNZ.DwEga6ro.js';
2
-
3
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
4
- function getDefaultExportFromCjs(x) {
5
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
6
- }
1
+ import { g as getDefaultExportFromCjs } from './index.D0heQG4v.js';
2
+ import { m as isPrimitive, o as notNullish, r as resolve$1 } from './pathe.M-eThtNZ.Ba-7h1rE.js';
7
3
 
8
4
  var build = {};
9
5
 
@@ -851,7 +847,7 @@ function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
851
847
  if (typeof val.toJSON === "function") return serializeValue(val.toJSON(), seen);
852
848
  if (seen.has(val)) return seen.get(val);
853
849
  if (Array.isArray(val)) {
854
- // eslint-disable-next-line unicorn/no-new-array -- we need to keep sparse arrays ([1,,3])
850
+ // oxlint-disable-next-line unicorn/no-new-array -- we need to keep sparse arrays ([1,,3])
855
851
  const clone = new Array(val.length);
856
852
  seen.set(val, clone);
857
853
  val.forEach((e, i) => {
@@ -1595,7 +1591,7 @@ function extractLocation(urlLike) {
1595
1591
  const urlObj = new URL(url);
1596
1592
  urlObj.searchParams.delete("import");
1597
1593
  urlObj.searchParams.delete("browserv");
1598
- url = urlObj.pathname + urlObj.hash + urlObj.search;
1594
+ url = tryDecode(urlObj.pathname, decodeURI) + urlObj.hash + urlObj.search;
1599
1595
  }
1600
1596
  if (url.startsWith("/@fs/")) {
1601
1597
  const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
@@ -1608,6 +1604,13 @@ function extractLocation(urlLike) {
1608
1604
  parts[3] || void 0
1609
1605
  ];
1610
1606
  }
1607
+ function tryDecode(value, decode) {
1608
+ try {
1609
+ return decode(value);
1610
+ } catch {
1611
+ return value;
1612
+ }
1613
+ }
1611
1614
  function parseSingleFFOrSafariStack(raw) {
1612
1615
  let line = raw.trim();
1613
1616
  if (SAFARI_NATIVE_CODE_REGEXP.test(line)) return null;
@@ -1667,7 +1670,9 @@ function parseSingleV8Stack(raw) {
1667
1670
  let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
1668
1671
  if (!file || !lineNumber || !columnNumber) return null;
1669
1672
  if (method.startsWith("async ")) method = method.slice(6);
1670
- if (file.startsWith("file://")) file = file.slice(7);
1673
+ if (file.startsWith("file://"))
1674
+ // pathToFileURL also encodes "#" and "?", which decodeURI keeps
1675
+ file = tryDecode(file.slice(7), decodeURIComponent);
1671
1676
  // normalize Windows path (\ -> /)
1672
1677
  file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve$1(file);
1673
1678
  if (method) method = method.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
@@ -1774,4 +1779,4 @@ function getOriginalPosition(map, needle) {
1774
1779
  return result;
1775
1780
  }
1776
1781
 
1777
- export { DecodedMap as D, TraceMap as T, getSafeTimers as a, serializeValue as b, createStackString as c, diffSequences as d, getDefaultExportFromCjs as e, parseErrorStacktrace as f, getOriginalPosition as g, commonjsGlobal as h, parseSingleStack as i, delay as j, generatedPositionFor as k, eachMapping as l, stackIgnorePatterns as m, originalPositionFor as o, parseStacktrace as p, setSafeTimers as s };
1782
+ export { DecodedMap as D, TraceMap as T, getSafeTimers as a, serializeValue as b, createStackString as c, diffSequences as d, parseErrorStacktrace as e, parseSingleStack as f, getOriginalPosition as g, delay as h, generatedPositionFor as i, eachMapping as j, stackIgnorePatterns as k, originalPositionFor as o, parseStacktrace as p, setSafeTimers as s };
@@ -1,4 +1,4 @@
1
- import { T as TestError, P as ParsedStack } from './config.d.CU_b-wJj.js';
1
+ import { T as TestError, P as ParsedStack } from './config.d.QBNYCgFU.js';
2
2
 
3
3
  interface RuntimeCoverageModuleLoader {
4
4
  import: (id: string) => Promise<{