@noma.to/qwik-testing-library 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/lib/lib/mock.qwik.cjs +3 -3
  2. package/lib/lib/mock.qwik.mjs +1 -1
  3. package/lib/lib/qwik-testing-library.qwik.cjs +2 -2
  4. package/lib/lib/qwik-testing-library.qwik.mjs +3 -3
  5. package/lib/lib/qwikloader.qwik.cjs +1 -1
  6. package/lib/lib/qwikloader.qwik.mjs +1 -1
  7. package/lib/node_modules/.pnpm/{@vitest_expect@2.1.8 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.cjs +175 -35
  8. package/lib/node_modules/.pnpm/{@vitest_expect@2.1.8 → @vitest_expect@3.0.5}/node_modules/@vitest/expect/dist/index.qwik.mjs +180 -40
  9. package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.8 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +301 -10
  10. package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.8 → @vitest_pretty-format@3.0.5}/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +306 -15
  11. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +1 -1
  12. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +1 -1
  13. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.cjs +130 -44
  14. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.8 → @vitest_runner@3.0.5}/node_modules/@vitest/runner/dist/index.qwik.mjs +130 -44
  15. package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.8 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.cjs +119 -84
  16. package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.8 → @vitest_snapshot@3.0.5}/node_modules/@vitest/snapshot/dist/index.qwik.mjs +119 -84
  17. package/lib/node_modules/.pnpm/{@vitest_spy@2.1.8 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.cjs +20 -3
  18. package/lib/node_modules/.pnpm/{@vitest_spy@2.1.8 → @vitest_spy@3.0.5}/node_modules/@vitest/spy/dist/index.qwik.mjs +20 -3
  19. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs +3 -3
  20. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs +3 -3
  21. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.cjs +37 -21
  22. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/diff.qwik.mjs +37 -21
  23. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.cjs +2 -2
  24. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/error.qwik.mjs +2 -2
  25. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.cjs +1 -1
  26. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/helpers.qwik.mjs +1 -1
  27. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/index.qwik.cjs +6 -4
  28. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/index.qwik.mjs +6 -4
  29. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.cjs +1 -1
  30. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.8 → @vitest_utils@3.0.5}/node_modules/@vitest/utils/dist/source-map.qwik.mjs +1 -1
  31. package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.mjs +6 -6
  32. package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.cjs +1 -3
  33. package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/map.qwik.mjs +1 -3
  34. package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.cjs} +2 -2
  35. package/lib/node_modules/.pnpm/{pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs → pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.mjs} +2 -2
  36. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +4 -0
  37. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +5 -0
  38. package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +1 -1
  39. package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +1 -1
  40. package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.cjs → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.cjs} +439 -211
  41. package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.mjs → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.CjhMlMwf.qwik.mjs} +415 -187
  42. package/package.json +8 -8
  43. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +0 -7
  44. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +0 -8
  45. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.cjs +0 -0
  46. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/arguments.qwik.mjs +0 -0
  47. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.cjs +0 -0
  48. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/array.qwik.mjs +0 -0
  49. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.cjs +0 -0
  50. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/bigint.qwik.mjs +0 -0
  51. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.cjs +0 -0
  52. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/class.qwik.mjs +0 -0
  53. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.cjs +0 -0
  54. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/date.qwik.mjs +0 -0
  55. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.cjs +0 -0
  56. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/error.qwik.mjs +0 -0
  57. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.cjs +0 -0
  58. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/function.qwik.mjs +0 -0
  59. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.cjs +0 -0
  60. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/helpers.qwik.mjs +0 -0
  61. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.cjs +0 -0
  62. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/html.qwik.mjs +0 -0
  63. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/index.qwik.cjs +0 -0
  64. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.cjs +0 -0
  65. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/number.qwik.mjs +0 -0
  66. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.cjs +0 -0
  67. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/object.qwik.mjs +0 -0
  68. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.cjs +0 -0
  69. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/promise.qwik.mjs +0 -0
  70. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.cjs +0 -0
  71. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/regexp.qwik.mjs +0 -0
  72. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.cjs +0 -0
  73. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/set.qwik.mjs +0 -0
  74. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.cjs +0 -0
  75. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/string.qwik.mjs +0 -0
  76. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.cjs +0 -0
  77. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/symbol.qwik.mjs +0 -0
  78. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.cjs +0 -0
  79. /package/lib/node_modules/.pnpm/{loupe@3.1.2 → loupe@3.1.3}/node_modules/loupe/lib/typedarray.qwik.mjs +0 -0
  80. /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +0 -0
  81. /package/lib/node_modules/.pnpm/{tinyrainbow@1.2.0 → tinyrainbow@2.0.0}/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +0 -0
  82. /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -0
  83. /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -0
  84. /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -0
  85. /package/lib/node_modules/.pnpm/{vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0 → vitest@3.0.5_@types_node@22.13.1_@vitest_ui@3.0.5_jiti@2.4.2_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -0
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { format, plugins } from "../../../../../@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
5
- import { r as resolve$2 } from "../../../../../pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs";
4
+ import { format, plugins } from "../../../../../@vitest_pretty-format@3.0.5/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
5
+ import { r as resolve$2 } from "../../../../../pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.qwik.mjs";
6
6
  const comma = ",".charCodeAt(0);
7
7
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
8
8
  const intToChar = new Uint8Array(64);
@@ -601,7 +601,7 @@ function parseSingleV8Stack(raw) {
601
601
  if (file.startsWith("file://")) {
602
602
  file = file.slice(7);
603
603
  }
604
- file = resolve$2(file);
604
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve$2(file);
605
605
  if (method) {
606
606
  method = method.replace(/__vite_ssr_import_\d+__\./g, "");
607
607
  }
@@ -1206,7 +1206,7 @@ function p(n = false) {
1206
1206
  ) : a;
1207
1207
  return u;
1208
1208
  }
1209
- p(false);
1209
+ p();
1210
1210
  const lineSplitRE = /\r?\n/;
1211
1211
  function positionToOffset(source, lineNumber, columnNumber) {
1212
1212
  const lines = source.split(lineSplitRE);
@@ -1611,43 +1611,66 @@ function deepMergeSnapshot(target, source) {
1611
1611
  }
1612
1612
  return target;
1613
1613
  }
1614
+ class DefaultMap extends Map {
1615
+ constructor(defaultFn, entries) {
1616
+ super(entries);
1617
+ this.defaultFn = defaultFn;
1618
+ }
1619
+ get(key) {
1620
+ if (!this.has(key)) {
1621
+ this.set(key, this.defaultFn(key));
1622
+ }
1623
+ return super.get(key);
1624
+ }
1625
+ }
1626
+ class CounterMap extends DefaultMap {
1627
+ constructor() {
1628
+ super(() => 0);
1629
+ }
1630
+ increment(key) {
1631
+ this.set(key, this.get(key) + 1);
1632
+ }
1633
+ total() {
1634
+ let total = 0;
1635
+ for (const x of this.values()) {
1636
+ total += x;
1637
+ }
1638
+ return total;
1639
+ }
1640
+ }
1614
1641
  class SnapshotState {
1615
1642
  constructor(testFilePath, snapshotPath, snapshotContent, options) {
1616
- __publicField(this, "_counters");
1643
+ __publicField(this, "_counters", new CounterMap());
1617
1644
  __publicField(this, "_dirty");
1618
1645
  __publicField(this, "_updateSnapshot");
1619
1646
  __publicField(this, "_snapshotData");
1620
1647
  __publicField(this, "_initialData");
1621
1648
  __publicField(this, "_inlineSnapshots");
1622
1649
  __publicField(this, "_inlineSnapshotStacks");
1650
+ __publicField(this, "_testIdToKeys", new DefaultMap(() => []));
1623
1651
  __publicField(this, "_rawSnapshots");
1624
1652
  __publicField(this, "_uncheckedKeys");
1625
1653
  __publicField(this, "_snapshotFormat");
1626
1654
  __publicField(this, "_environment");
1627
1655
  __publicField(this, "_fileExists");
1628
- __publicField(this, "added");
1656
+ __publicField(this, "added", new CounterMap());
1657
+ __publicField(this, "matched", new CounterMap());
1658
+ __publicField(this, "unmatched", new CounterMap());
1659
+ __publicField(this, "updated", new CounterMap());
1629
1660
  __publicField(this, "expand");
1630
- __publicField(this, "matched");
1631
- __publicField(this, "unmatched");
1632
- __publicField(this, "updated");
1633
1661
  this.testFilePath = testFilePath;
1634
1662
  this.snapshotPath = snapshotPath;
1635
1663
  const { data, dirty } = getSnapshotData(snapshotContent, options);
1636
1664
  this._fileExists = snapshotContent != null;
1637
- this._initialData = data;
1638
- this._snapshotData = data;
1665
+ this._initialData = { ...data };
1666
+ this._snapshotData = { ...data };
1639
1667
  this._dirty = dirty;
1640
1668
  this._inlineSnapshots = [];
1641
1669
  this._inlineSnapshotStacks = [];
1642
1670
  this._rawSnapshots = [];
1643
1671
  this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
1644
- this._counters = /* @__PURE__ */ new Map();
1645
1672
  this.expand = options.expand || false;
1646
- this.added = 0;
1647
- this.matched = 0;
1648
- this.unmatched = 0;
1649
1673
  this._updateSnapshot = options.updateSnapshot;
1650
- this.updated = 0;
1651
1674
  this._snapshotFormat = {
1652
1675
  printBasicPrototype: false,
1653
1676
  escapeString: false,
@@ -1669,11 +1692,30 @@ class SnapshotState {
1669
1692
  }
1670
1693
  markSnapshotsAsCheckedForTest(testName) {
1671
1694
  this._uncheckedKeys.forEach((uncheckedKey) => {
1672
- if (keyToTestName(uncheckedKey) === testName) {
1695
+ if (/ \d+$| > /.test(uncheckedKey.slice(testName.length))) {
1673
1696
  this._uncheckedKeys.delete(uncheckedKey);
1674
1697
  }
1675
1698
  });
1676
1699
  }
1700
+ clearTest(testId) {
1701
+ this._inlineSnapshots = this._inlineSnapshots.filter((s) => s.testId !== testId);
1702
+ this._inlineSnapshotStacks = this._inlineSnapshotStacks.filter((s) => s.testId !== testId);
1703
+ for (const key of this._testIdToKeys.get(testId)) {
1704
+ const name = keyToTestName(key);
1705
+ const count = this._counters.get(name);
1706
+ if (count > 0) {
1707
+ if (key in this._snapshotData || key in this._initialData) {
1708
+ this._snapshotData[key] = this._initialData[key];
1709
+ }
1710
+ this._counters.set(name, count - 1);
1711
+ }
1712
+ }
1713
+ this._testIdToKeys.delete(testId);
1714
+ this.added.delete(testId);
1715
+ this.updated.delete(testId);
1716
+ this.matched.delete(testId);
1717
+ this.unmatched.delete(testId);
1718
+ }
1677
1719
  _inferInlineSnapshotStack(stacks) {
1678
1720
  const promiseIndex = stacks.findIndex(
1679
1721
  (i) => i.method.match(/__VITEST_(RESOLVES|REJECTS)__/)
@@ -1691,6 +1733,7 @@ class SnapshotState {
1691
1733
  if (options.stack) {
1692
1734
  this._inlineSnapshots.push({
1693
1735
  snapshot: receivedSerialized,
1736
+ testId: options.testId,
1694
1737
  ...options.stack
1695
1738
  });
1696
1739
  } else if (options.rawSnapshot) {
@@ -1702,15 +1745,6 @@ class SnapshotState {
1702
1745
  this._snapshotData[key] = receivedSerialized;
1703
1746
  }
1704
1747
  }
1705
- clear() {
1706
- this._snapshotData = this._initialData;
1707
- this._counters = /* @__PURE__ */ new Map();
1708
- this.added = 0;
1709
- this.matched = 0;
1710
- this.unmatched = 0;
1711
- this.updated = 0;
1712
- this._dirty = false;
1713
- }
1714
1748
  async save() {
1715
1749
  const hasExternalSnapshots = Object.keys(this._snapshotData).length;
1716
1750
  const hasInlineSnapshots = this._inlineSnapshots.length;
@@ -1759,6 +1793,7 @@ class SnapshotState {
1759
1793
  }
1760
1794
  }
1761
1795
  match({
1796
+ testId,
1762
1797
  testName,
1763
1798
  received,
1764
1799
  key,
@@ -1768,11 +1803,12 @@ class SnapshotState {
1768
1803
  rawSnapshot
1769
1804
  }) {
1770
1805
  var _a, _b;
1771
- this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
1772
- const count = Number(this._counters.get(testName));
1806
+ this._counters.increment(testName);
1807
+ const count = this._counters.get(testName);
1773
1808
  if (!key) {
1774
1809
  key = testNameToKey(testName, count);
1775
1810
  }
1811
+ this._testIdToKeys.get(testId).push(key);
1776
1812
  if (!(isInline && this._snapshotData[key] !== void 0)) {
1777
1813
  this._uncheckedKeys.delete(key);
1778
1814
  }
@@ -1786,8 +1822,8 @@ class SnapshotState {
1786
1822
  }
1787
1823
  }
1788
1824
  const expected = isInline ? inlineSnapshot : rawSnapshot ? rawSnapshot.content : this._snapshotData[key];
1789
- const expectedTrimmed = prepareExpected(expected);
1790
- const pass = expectedTrimmed === prepareExpected(receivedSerialized);
1825
+ const expectedTrimmed = rawSnapshot ? expected : prepareExpected(expected);
1826
+ const pass = expectedTrimmed === (rawSnapshot ? receivedSerialized : prepareExpected(receivedSerialized));
1791
1827
  const hasSnapshot = expected !== void 0;
1792
1828
  const snapshotIsPersisted = isInline || this._fileExists || rawSnapshot && rawSnapshot.content != null;
1793
1829
  if (pass && !isInline && !rawSnapshot) {
@@ -1814,29 +1850,31 @@ ${JSON.stringify(
1814
1850
  this._inlineSnapshots = this._inlineSnapshots.filter((s) => !(s.file === stack.file && s.line === stack.line && s.column === stack.column));
1815
1851
  throw new Error("toMatchInlineSnapshot cannot be called multiple times at the same location.");
1816
1852
  }
1817
- this._inlineSnapshotStacks.push(stack);
1853
+ this._inlineSnapshotStacks.push({ ...stack, testId });
1818
1854
  }
1819
1855
  if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
1820
1856
  if (this._updateSnapshot === "all") {
1821
1857
  if (!pass) {
1822
1858
  if (hasSnapshot) {
1823
- this.updated++;
1859
+ this.updated.increment(testId);
1824
1860
  } else {
1825
- this.added++;
1861
+ this.added.increment(testId);
1826
1862
  }
1827
1863
  this._addSnapshot(key, receivedSerialized, {
1828
1864
  stack,
1865
+ testId,
1829
1866
  rawSnapshot
1830
1867
  });
1831
1868
  } else {
1832
- this.matched++;
1869
+ this.matched.increment(testId);
1833
1870
  }
1834
1871
  } else {
1835
1872
  this._addSnapshot(key, receivedSerialized, {
1836
1873
  stack,
1874
+ testId,
1837
1875
  rawSnapshot
1838
1876
  });
1839
- this.added++;
1877
+ this.added.increment(testId);
1840
1878
  }
1841
1879
  return {
1842
1880
  actual: "",
@@ -1847,16 +1885,16 @@ ${JSON.stringify(
1847
1885
  };
1848
1886
  } else {
1849
1887
  if (!pass) {
1850
- this.unmatched++;
1888
+ this.unmatched.increment(testId);
1851
1889
  return {
1852
- actual: removeExtraLineBreaks(receivedSerialized),
1890
+ actual: rawSnapshot ? receivedSerialized : removeExtraLineBreaks(receivedSerialized),
1853
1891
  count,
1854
- expected: expectedTrimmed !== void 0 ? removeExtraLineBreaks(expectedTrimmed) : void 0,
1892
+ expected: expectedTrimmed !== void 0 ? rawSnapshot ? expectedTrimmed : removeExtraLineBreaks(expectedTrimmed) : void 0,
1855
1893
  key,
1856
1894
  pass: false
1857
1895
  };
1858
1896
  } else {
1859
- this.matched++;
1897
+ this.matched.increment(testId);
1860
1898
  return {
1861
1899
  actual: "",
1862
1900
  count,
@@ -1885,10 +1923,10 @@ ${JSON.stringify(
1885
1923
  }
1886
1924
  const status = await this.save();
1887
1925
  snapshot.fileDeleted = status.deleted;
1888
- snapshot.added = this.added;
1889
- snapshot.matched = this.matched;
1890
- snapshot.unmatched = this.unmatched;
1891
- snapshot.updated = this.updated;
1926
+ snapshot.added = this.added.total();
1927
+ snapshot.matched = this.matched.total();
1928
+ snapshot.unmatched = this.unmatched.total();
1929
+ snapshot.updated = this.updated.total();
1892
1930
  snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
1893
1931
  snapshot.uncheckedKeys = Array.from(uncheckedKeys);
1894
1932
  return snapshot;
@@ -1913,43 +1951,47 @@ function createMismatchError(message, expand, actual, expected) {
1913
1951
  }
1914
1952
  class SnapshotClient {
1915
1953
  constructor(options = {}) {
1916
- __publicField(this, "filepath");
1917
- __publicField(this, "name");
1918
- __publicField(this, "snapshotState");
1919
1954
  __publicField(this, "snapshotStateMap", /* @__PURE__ */ new Map());
1920
1955
  this.options = options;
1921
1956
  }
1922
- async startCurrentRun(filepath, name, options) {
1923
- var _a;
1924
- this.filepath = filepath;
1925
- this.name = name;
1926
- if (((_a = this.snapshotState) == null ? void 0 : _a.testFilePath) !== filepath) {
1927
- await this.finishCurrentRun();
1928
- if (!this.getSnapshotState(filepath)) {
1929
- this.snapshotStateMap.set(
1930
- filepath,
1931
- await SnapshotState.create(filepath, options)
1932
- );
1933
- }
1934
- this.snapshotState = this.getSnapshotState(filepath);
1957
+ async setup(filepath, options) {
1958
+ if (this.snapshotStateMap.has(filepath)) {
1959
+ return;
1935
1960
  }
1961
+ this.snapshotStateMap.set(
1962
+ filepath,
1963
+ await SnapshotState.create(filepath, options)
1964
+ );
1936
1965
  }
1937
- getSnapshotState(filepath) {
1938
- return this.snapshotStateMap.get(filepath);
1966
+ async finish(filepath) {
1967
+ const state = this.getSnapshotState(filepath);
1968
+ const result = await state.pack();
1969
+ this.snapshotStateMap.delete(filepath);
1970
+ return result;
1939
1971
  }
1940
- clearTest() {
1941
- this.filepath = void 0;
1942
- this.name = void 0;
1972
+ skipTest(filepath, testName) {
1973
+ const state = this.getSnapshotState(filepath);
1974
+ state.markSnapshotsAsCheckedForTest(testName);
1943
1975
  }
1944
- skipTestSnapshots(name) {
1945
- var _a;
1946
- (_a = this.snapshotState) == null ? void 0 : _a.markSnapshotsAsCheckedForTest(name);
1976
+ clearTest(filepath, testId) {
1977
+ const state = this.getSnapshotState(filepath);
1978
+ state.clearTest(testId);
1979
+ }
1980
+ getSnapshotState(filepath) {
1981
+ const state = this.snapshotStateMap.get(filepath);
1982
+ if (!state) {
1983
+ throw new Error(
1984
+ `The snapshot state for '${filepath}' is not found. Did you call 'SnapshotClient.setup()'?`
1985
+ );
1986
+ }
1987
+ return state;
1947
1988
  }
1948
1989
  assert(options) {
1949
- var _a, _b, _c, _d;
1990
+ var _a, _b;
1950
1991
  const {
1951
- filepath = this.filepath,
1952
- name = this.name,
1992
+ filepath,
1993
+ name,
1994
+ testId = name,
1953
1995
  message,
1954
1996
  isInline = false,
1955
1997
  properties,
@@ -1962,6 +2004,7 @@ class SnapshotClient {
1962
2004
  if (!filepath) {
1963
2005
  throw new Error("Snapshot cannot be used outside of test");
1964
2006
  }
2007
+ const snapshotState = this.getSnapshotState(filepath);
1965
2008
  if (typeof properties === "object") {
1966
2009
  if (typeof received !== "object" || !received) {
1967
2010
  throw new Error(
@@ -1973,7 +2016,7 @@ class SnapshotClient {
1973
2016
  if (!pass2) {
1974
2017
  throw createMismatchError(
1975
2018
  "Snapshot properties mismatched",
1976
- (_c = this.snapshotState) == null ? void 0 : _c.expand,
2019
+ snapshotState.expand,
1977
2020
  received,
1978
2021
  properties
1979
2022
  );
@@ -1986,8 +2029,8 @@ class SnapshotClient {
1986
2029
  }
1987
2030
  }
1988
2031
  const testName = [name, ...message ? [message] : []].join(" > ");
1989
- const snapshotState = this.getSnapshotState(filepath);
1990
2032
  const { actual, expected, key, pass } = snapshotState.match({
2033
+ testId,
1991
2034
  testName,
1992
2035
  received,
1993
2036
  isInline,
@@ -1998,9 +2041,9 @@ class SnapshotClient {
1998
2041
  if (!pass) {
1999
2042
  throw createMismatchError(
2000
2043
  `Snapshot \`${key || "unknown"}\` mismatched`,
2001
- (_d = this.snapshotState) == null ? void 0 : _d.expand,
2002
- actual == null ? void 0 : actual.trim(),
2003
- expected == null ? void 0 : expected.trim()
2044
+ snapshotState.expand,
2045
+ rawSnapshot ? actual : actual == null ? void 0 : actual.trim(),
2046
+ rawSnapshot ? expected : expected == null ? void 0 : expected.trim()
2004
2047
  );
2005
2048
  }
2006
2049
  }
@@ -2008,7 +2051,7 @@ class SnapshotClient {
2008
2051
  if (!options.rawSnapshot) {
2009
2052
  throw new Error("Raw snapshot is required");
2010
2053
  }
2011
- const { filepath = this.filepath, rawSnapshot } = options;
2054
+ const { filepath, rawSnapshot } = options;
2012
2055
  if (rawSnapshot.content == null) {
2013
2056
  if (!filepath) {
2014
2057
  throw new Error("Snapshot cannot be used outside of test");
@@ -2023,14 +2066,6 @@ class SnapshotClient {
2023
2066
  }
2024
2067
  return this.assert(options);
2025
2068
  }
2026
- async finishCurrentRun() {
2027
- if (!this.snapshotState) {
2028
- return null;
2029
- }
2030
- const result = await this.snapshotState.pack();
2031
- this.snapshotState = void 0;
2032
- return result;
2033
- }
2034
2069
  clear() {
2035
2070
  this.snapshotStateMap.clear();
2036
2071
  }
@@ -1,16 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const index = require("../../../../../tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs");
4
+ const vitestSpy = Symbol.for("vitest.spy");
4
5
  const mocks = /* @__PURE__ */ new Set();
5
6
  function isMockFunction(fn2) {
6
7
  return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
7
8
  }
9
+ function getSpy(obj, method, accessType) {
10
+ const desc = Object.getOwnPropertyDescriptor(obj, method);
11
+ if (desc) {
12
+ const fn2 = desc[accessType ?? "value"];
13
+ if (typeof fn2 === "function" && vitestSpy in fn2) {
14
+ return fn2;
15
+ }
16
+ }
17
+ }
8
18
  function spyOn(obj, method, accessType) {
9
19
  const dictionary = {
10
20
  get: "getter",
11
21
  set: "setter"
12
22
  };
13
23
  const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
24
+ const currentStub = getSpy(obj, method, accessType);
25
+ if (currentStub) {
26
+ return currentStub;
27
+ }
14
28
  const stub = index.internalSpyOn(obj, objMethod);
15
29
  return enhanceSpy(stub);
16
30
  }
@@ -62,6 +76,10 @@ function enhanceSpy(spy) {
62
76
  return impl.apply(this, args);
63
77
  }
64
78
  let name = stub.name;
79
+ Object.defineProperty(stub, vitestSpy, {
80
+ value: true,
81
+ enumerable: false
82
+ });
65
83
  stub.getMockName = () => name || "vi.fn()";
66
84
  stub.mockName = (n) => {
67
85
  name = n;
@@ -76,17 +94,16 @@ function enhanceSpy(spy) {
76
94
  };
77
95
  stub.mockReset = () => {
78
96
  stub.mockClear();
79
- implementation = () => void 0;
97
+ implementation = void 0;
80
98
  onceImplementations = [];
81
99
  return stub;
82
100
  };
83
101
  stub.mockRestore = () => {
84
102
  stub.mockReset();
85
103
  state.restore();
86
- implementation = void 0;
87
104
  return stub;
88
105
  };
89
- stub.getMockImplementation = () => implementation;
106
+ stub.getMockImplementation = () => implementationChangedTemporarily ? implementation : onceImplementations.at(0) || implementation;
90
107
  stub.mockImplementation = (fn2) => {
91
108
  implementation = fn2;
92
109
  state.willCall(mockCall);
@@ -1,14 +1,28 @@
1
1
  import { internalSpyOn as C, getInternalState as T } from "../../../../../tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs";
2
+ const vitestSpy = Symbol.for("vitest.spy");
2
3
  const mocks = /* @__PURE__ */ new Set();
3
4
  function isMockFunction(fn2) {
4
5
  return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
5
6
  }
7
+ function getSpy(obj, method, accessType) {
8
+ const desc = Object.getOwnPropertyDescriptor(obj, method);
9
+ if (desc) {
10
+ const fn2 = desc[accessType ?? "value"];
11
+ if (typeof fn2 === "function" && vitestSpy in fn2) {
12
+ return fn2;
13
+ }
14
+ }
15
+ }
6
16
  function spyOn(obj, method, accessType) {
7
17
  const dictionary = {
8
18
  get: "getter",
9
19
  set: "setter"
10
20
  };
11
21
  const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
22
+ const currentStub = getSpy(obj, method, accessType);
23
+ if (currentStub) {
24
+ return currentStub;
25
+ }
12
26
  const stub = C(obj, objMethod);
13
27
  return enhanceSpy(stub);
14
28
  }
@@ -60,6 +74,10 @@ function enhanceSpy(spy) {
60
74
  return impl.apply(this, args);
61
75
  }
62
76
  let name = stub.name;
77
+ Object.defineProperty(stub, vitestSpy, {
78
+ value: true,
79
+ enumerable: false
80
+ });
63
81
  stub.getMockName = () => name || "vi.fn()";
64
82
  stub.mockName = (n) => {
65
83
  name = n;
@@ -74,17 +92,16 @@ function enhanceSpy(spy) {
74
92
  };
75
93
  stub.mockReset = () => {
76
94
  stub.mockClear();
77
- implementation = () => void 0;
95
+ implementation = void 0;
78
96
  onceImplementations = [];
79
97
  return stub;
80
98
  };
81
99
  stub.mockRestore = () => {
82
100
  stub.mockReset();
83
101
  state.restore();
84
- implementation = void 0;
85
102
  return stub;
86
103
  };
87
- stub.getMockImplementation = () => implementation;
104
+ stub.getMockImplementation = () => implementationChangedTemporarily ? implementation : onceImplementations.at(0) || implementation;
88
105
  stub.mockImplementation = (fn2) => {
89
106
  implementation = fn2;
90
107
  state.willCall(mockCall);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index$1 = require("../../../../../@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.cjs");
4
- const index = require("../../../../../loupe@3.1.2/node_modules/loupe/lib/index.qwik.cjs");
3
+ const index$1 = require("../../../../../@vitest_pretty-format@3.0.5/node_modules/@vitest/pretty-format/dist/index.qwik.cjs");
4
+ const index = require("../../../../../loupe@3.1.3/node_modules/loupe/lib/index.qwik.cjs");
5
5
  const {
6
6
  AsymmetricMatcher,
7
7
  DOMCollection,
@@ -39,7 +39,7 @@ function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
39
39
  ...options
40
40
  });
41
41
  }
42
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
42
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), { maxLength, ...options }) : result;
43
43
  }
44
44
  const formatRegExp = /%[sdjifoOc%]/g;
45
45
  function format(...args) {
@@ -1,5 +1,5 @@
1
- import { format as format$1, plugins } from "../../../../../@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
2
- import { inspect as inspect$1 } from "../../../../../loupe@3.1.2/node_modules/loupe/lib/index.qwik.mjs";
1
+ import { format as format$1, plugins } from "../../../../../@vitest_pretty-format@3.0.5/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
2
+ import { inspect as inspect$1 } from "../../../../../loupe@3.1.3/node_modules/loupe/lib/index.qwik.mjs";
3
3
  const {
4
4
  AsymmetricMatcher,
5
5
  DOMCollection,
@@ -37,7 +37,7 @@ function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
37
37
  ...options
38
38
  });
39
39
  }
40
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
40
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), { maxLength, ...options }) : result;
41
41
  }
42
42
  const formatRegExp = /%[sdjifoOc%]/g;
43
43
  function format(...args) {