@shware/security 2.2.1 → 2.2.2

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.
@@ -108,11 +108,11 @@ var require_dist = __commonJS({
108
108
  // src/session/__tests__/redis.test.ts
109
109
  var import_ioredis = __toESM(require("ioredis"), 1);
110
110
 
111
- // ../../node_modules/.pnpm/vitest@4.0.18_@opentelemetry+api@1.9.0_@types+node@25.3.0_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
112
- var import_vi_2VT5v0um = require("./chunks/vi.2VT5v0um.js.cjs");
113
- var import_benchmark_B3N2zMcH = require("./chunks/benchmark.B3N2zMcH.js.cjs");
111
+ // ../../node_modules/.pnpm/vitest@4.1.0_@opentelemetry+api@1.9.0_@types+node@25.3.0_vite@7.3.1_@types+node@25.3.0__1256cd9683254972294f67b42fe9fd18/node_modules/vitest/dist/index.js
112
+ var import_test_CTcmp4Su = require("./chunks/test.CTcmp4Su.js.cjs");
113
+ var import_benchmark_D0SlKNbZ = require("./chunks/benchmark.D0SlKNbZ.js.cjs");
114
114
  var import_evaluatedModules_Dg1zASAC = require("./chunks/evaluatedModules.Dg1zASAC.js.cjs");
115
- var import_index_Z5E_ObnR = require("./chunks/index.Z5E_ObnR.js.cjs");
115
+ var import_index_DlDSLQD3 = require("./chunks/index.DlDSLQD3.js.cjs");
116
116
  var import_expect_type = __toESM(require_dist(), 1);
117
117
 
118
118
  // ../../node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.js
@@ -165,20 +165,20 @@ function g(e2) {
165
165
  g.open = "";
166
166
  g.close = "";
167
167
  function h() {
168
- let e2 = typeof process != "undefined" ? process : void 0, n2 = (e2 == null ? void 0 : e2.env) || {}, a3 = n2.FORCE_TTY !== "false", i3 = (e2 == null ? void 0 : e2.argv) || [];
169
- return !("NO_COLOR" in n2 || i3.includes("--no-color")) && ("FORCE_COLOR" in n2 || i3.includes("--color") || (e2 == null ? void 0 : e2.platform) === "win32" || a3 && n2.TERM !== "dumb" || "CI" in n2) || typeof window != "undefined" && !!window.chrome;
168
+ let e2 = typeof process != "undefined" ? process : void 0, n2 = (e2 == null ? void 0 : e2.env) || {}, a4 = n2.FORCE_TTY !== "false", i3 = (e2 == null ? void 0 : e2.argv) || [];
169
+ return !("NO_COLOR" in n2 || i3.includes("--no-color")) && ("FORCE_COLOR" in n2 || i3.includes("--color") || (e2 == null ? void 0 : e2.platform) === "win32" || a4 && n2.TERM !== "dumb" || "CI" in n2) || typeof window != "undefined" && !!window.chrome;
170
170
  }
171
171
  function f() {
172
- let e2 = h(), n2 = (r2, t2, u, o2) => {
172
+ let e2 = h(), n2 = (r2, t2, u2, o2) => {
173
173
  let l2 = "", s3 = 0;
174
174
  do
175
- l2 += r2.substring(s3, o2) + u, s3 = o2 + t2.length, o2 = r2.indexOf(t2, s3);
175
+ l2 += r2.substring(s3, o2) + u2, s3 = o2 + t2.length, o2 = r2.indexOf(t2, s3);
176
176
  while (~o2);
177
177
  return l2 + r2.substring(s3);
178
- }, a3 = (r2, t2, u = r2) => {
178
+ }, a4 = (r2, t2, u2 = r2) => {
179
179
  let o2 = (l2) => {
180
180
  let s3 = String(l2), b4 = s3.indexOf(t2, r2.length);
181
- return ~b4 ? r2 + n2(s3, t2, u, b4) + t2 : r2 + s3 + t2;
181
+ return ~b4 ? r2 + n2(s3, t2, u2, b4) + t2 : r2 + s3 + t2;
182
182
  };
183
183
  return o2.open = r2, o2.close = t2, o2;
184
184
  }, i3 = {
@@ -186,7 +186,7 @@ function f() {
186
186
  }, c3 = (r2) => `\x1B[${r2}m`;
187
187
  for (let r2 in d) {
188
188
  let t2 = d[r2];
189
- i3[r2] = e2 ? a3(
189
+ i3[r2] = e2 ? a4(
190
190
  c3(t2[0]),
191
191
  c3(t2[1]),
192
192
  t2[2]
@@ -196,13 +196,13 @@ function f() {
196
196
  }
197
197
  var C = f();
198
198
 
199
- // ../../node_modules/.pnpm/@vitest+pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.js
199
+ // ../../node_modules/.pnpm/@vitest+pretty-format@4.1.0/node_modules/@vitest/pretty-format/dist/index.js
200
200
  function _mergeNamespaces(n2, m2) {
201
201
  m2.forEach(function(e2) {
202
202
  e2 && typeof e2 !== "string" && !Array.isArray(e2) && Object.keys(e2).forEach(function(k2) {
203
203
  if (k2 !== "default" && !(k2 in n2)) {
204
- var d4 = Object.getOwnPropertyDescriptor(e2, k2);
205
- Object.defineProperty(n2, k2, d4.get ? d4 : {
204
+ var d3 = Object.getOwnPropertyDescriptor(e2, k2);
205
+ Object.defineProperty(n2, k2, d3.get ? d3 : {
206
206
  enumerable: true,
207
207
  get: function() {
208
208
  return e2[k2];
@@ -455,7 +455,20 @@ function nodeIsComment(node) {
455
455
  function nodeIsFragment(node) {
456
456
  return node.nodeType === FRAGMENT_NODE;
457
457
  }
458
- var serialize$3 = (node, config, indentation, depth, refs, printer2) => {
458
+ function filterChildren(children, filterNode) {
459
+ let filtered = children.filter((node) => {
460
+ if (node.nodeType === TEXT_NODE) {
461
+ const text = node.data || "";
462
+ return text.trim().length > 0;
463
+ }
464
+ return true;
465
+ });
466
+ if (filterNode) {
467
+ filtered = filtered.filter(filterNode);
468
+ }
469
+ return filtered;
470
+ }
471
+ function serializeDOM(node, config, indentation, depth, refs, printer2, filterNode) {
459
472
  if (nodeIsText(node)) {
460
473
  return printText(node.data, config);
461
474
  }
@@ -466,11 +479,22 @@ var serialize$3 = (node, config, indentation, depth, refs, printer2) => {
466
479
  if (++depth > config.maxDepth) {
467
480
  return printElementAsLeaf(type, config);
468
481
  }
482
+ const children = Array.prototype.slice.call(node.childNodes || node.children);
483
+ const shadowChildren = nodeIsFragment(node) || !node.shadowRoot ? [] : Array.prototype.slice.call(node.shadowRoot.children);
484
+ const resolvedChildren = filterNode ? filterChildren(children, filterNode) : children;
485
+ const resolvedShadowChildren = filterNode ? filterChildren(shadowChildren, filterNode) : shadowChildren;
469
486
  return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
470
487
  props[attribute.name] = attribute.value;
471
488
  return props;
472
- }, {}), config, indentation + config.indent, depth, refs, printer2), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer2)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer2), config, indentation);
473
- };
489
+ }, {}), config, indentation + config.indent, depth, refs, printer2), (resolvedShadowChildren.length > 0 ? printShadowRoot(resolvedShadowChildren, config, indentation + config.indent, depth, refs, printer2) : "") + printChildren(resolvedChildren, config, indentation + config.indent, depth, refs, printer2), config, indentation);
490
+ }
491
+ var serialize$3 = (node, config, indentation, depth, refs, printer2) => serializeDOM(node, config, indentation, depth, refs, printer2);
492
+ function createDOMElementFilter(filterNode) {
493
+ return {
494
+ test: test$3,
495
+ serialize: (node, config, indentation, depth, refs, printer2) => serializeDOM(node, config, indentation, depth, refs, printer2, filterNode)
496
+ };
497
+ }
474
498
  var plugin$3 = {
475
499
  serialize: serialize$3,
476
500
  test: test$3
@@ -663,29 +687,29 @@ var hasRequiredReactIs_production_min;
663
687
  function requireReactIs_production_min() {
664
688
  if (hasRequiredReactIs_production_min) return reactIs_production_min;
665
689
  hasRequiredReactIs_production_min = 1;
666
- var b4 = /* @__PURE__ */ Symbol.for("react.element"), c3 = /* @__PURE__ */ Symbol.for("react.portal"), d4 = /* @__PURE__ */ Symbol.for("react.fragment"), e2 = /* @__PURE__ */ Symbol.for("react.strict_mode"), f3 = /* @__PURE__ */ Symbol.for("react.profiler"), g4 = /* @__PURE__ */ Symbol.for("react.provider"), h3 = /* @__PURE__ */ Symbol.for("react.context"), k2 = /* @__PURE__ */ Symbol.for("react.server_context"), l2 = /* @__PURE__ */ Symbol.for("react.forward_ref"), m2 = /* @__PURE__ */ Symbol.for("react.suspense"), n2 = /* @__PURE__ */ Symbol.for("react.suspense_list"), p2 = /* @__PURE__ */ Symbol.for("react.memo"), q2 = /* @__PURE__ */ Symbol.for("react.lazy"), t2 = /* @__PURE__ */ Symbol.for("react.offscreen"), u;
667
- u = /* @__PURE__ */ Symbol.for("react.module.reference");
668
- function v2(a3) {
669
- if ("object" === typeof a3 && null !== a3) {
670
- var r2 = a3.$$typeof;
690
+ var b4 = /* @__PURE__ */ Symbol.for("react.element"), c3 = /* @__PURE__ */ Symbol.for("react.portal"), d3 = /* @__PURE__ */ Symbol.for("react.fragment"), e2 = /* @__PURE__ */ Symbol.for("react.strict_mode"), f3 = /* @__PURE__ */ Symbol.for("react.profiler"), g4 = /* @__PURE__ */ Symbol.for("react.provider"), h3 = /* @__PURE__ */ Symbol.for("react.context"), k2 = /* @__PURE__ */ Symbol.for("react.server_context"), l2 = /* @__PURE__ */ Symbol.for("react.forward_ref"), m2 = /* @__PURE__ */ Symbol.for("react.suspense"), n2 = /* @__PURE__ */ Symbol.for("react.suspense_list"), p2 = /* @__PURE__ */ Symbol.for("react.memo"), q2 = /* @__PURE__ */ Symbol.for("react.lazy"), t2 = /* @__PURE__ */ Symbol.for("react.offscreen"), u2;
691
+ u2 = /* @__PURE__ */ Symbol.for("react.module.reference");
692
+ function v3(a4) {
693
+ if ("object" === typeof a4 && null !== a4) {
694
+ var r2 = a4.$$typeof;
671
695
  switch (r2) {
672
696
  case b4:
673
- switch (a3 = a3.type, a3) {
674
- case d4:
697
+ switch (a4 = a4.type, a4) {
698
+ case d3:
675
699
  case f3:
676
700
  case e2:
677
701
  case m2:
678
702
  case n2:
679
- return a3;
703
+ return a4;
680
704
  default:
681
- switch (a3 = a3 && a3.$$typeof, a3) {
705
+ switch (a4 = a4 && a4.$$typeof, a4) {
682
706
  case k2:
683
707
  case h3:
684
708
  case l2:
685
709
  case q2:
686
710
  case p2:
687
711
  case g4:
688
- return a3;
712
+ return a4;
689
713
  default:
690
714
  return r2;
691
715
  }
@@ -699,7 +723,7 @@ function requireReactIs_production_min() {
699
723
  reactIs_production_min.ContextProvider = g4;
700
724
  reactIs_production_min.Element = b4;
701
725
  reactIs_production_min.ForwardRef = l2;
702
- reactIs_production_min.Fragment = d4;
726
+ reactIs_production_min.Fragment = d3;
703
727
  reactIs_production_min.Lazy = q2;
704
728
  reactIs_production_min.Memo = p2;
705
729
  reactIs_production_min.Portal = c3;
@@ -713,46 +737,46 @@ function requireReactIs_production_min() {
713
737
  reactIs_production_min.isConcurrentMode = function() {
714
738
  return false;
715
739
  };
716
- reactIs_production_min.isContextConsumer = function(a3) {
717
- return v2(a3) === h3;
740
+ reactIs_production_min.isContextConsumer = function(a4) {
741
+ return v3(a4) === h3;
718
742
  };
719
- reactIs_production_min.isContextProvider = function(a3) {
720
- return v2(a3) === g4;
743
+ reactIs_production_min.isContextProvider = function(a4) {
744
+ return v3(a4) === g4;
721
745
  };
722
- reactIs_production_min.isElement = function(a3) {
723
- return "object" === typeof a3 && null !== a3 && a3.$$typeof === b4;
746
+ reactIs_production_min.isElement = function(a4) {
747
+ return "object" === typeof a4 && null !== a4 && a4.$$typeof === b4;
724
748
  };
725
- reactIs_production_min.isForwardRef = function(a3) {
726
- return v2(a3) === l2;
749
+ reactIs_production_min.isForwardRef = function(a4) {
750
+ return v3(a4) === l2;
727
751
  };
728
- reactIs_production_min.isFragment = function(a3) {
729
- return v2(a3) === d4;
752
+ reactIs_production_min.isFragment = function(a4) {
753
+ return v3(a4) === d3;
730
754
  };
731
- reactIs_production_min.isLazy = function(a3) {
732
- return v2(a3) === q2;
755
+ reactIs_production_min.isLazy = function(a4) {
756
+ return v3(a4) === q2;
733
757
  };
734
- reactIs_production_min.isMemo = function(a3) {
735
- return v2(a3) === p2;
758
+ reactIs_production_min.isMemo = function(a4) {
759
+ return v3(a4) === p2;
736
760
  };
737
- reactIs_production_min.isPortal = function(a3) {
738
- return v2(a3) === c3;
761
+ reactIs_production_min.isPortal = function(a4) {
762
+ return v3(a4) === c3;
739
763
  };
740
- reactIs_production_min.isProfiler = function(a3) {
741
- return v2(a3) === f3;
764
+ reactIs_production_min.isProfiler = function(a4) {
765
+ return v3(a4) === f3;
742
766
  };
743
- reactIs_production_min.isStrictMode = function(a3) {
744
- return v2(a3) === e2;
767
+ reactIs_production_min.isStrictMode = function(a4) {
768
+ return v3(a4) === e2;
745
769
  };
746
- reactIs_production_min.isSuspense = function(a3) {
747
- return v2(a3) === m2;
770
+ reactIs_production_min.isSuspense = function(a4) {
771
+ return v3(a4) === m2;
748
772
  };
749
- reactIs_production_min.isSuspenseList = function(a3) {
750
- return v2(a3) === n2;
773
+ reactIs_production_min.isSuspenseList = function(a4) {
774
+ return v3(a4) === n2;
751
775
  };
752
- reactIs_production_min.isValidElementType = function(a3) {
753
- return "string" === typeof a3 || "function" === typeof a3 || a3 === d4 || a3 === f3 || a3 === e2 || a3 === m2 || a3 === n2 || a3 === t2 || "object" === typeof a3 && null !== a3 && (a3.$$typeof === q2 || a3.$$typeof === p2 || a3.$$typeof === g4 || a3.$$typeof === h3 || a3.$$typeof === l2 || a3.$$typeof === u || void 0 !== a3.getModuleId) ? true : false;
776
+ reactIs_production_min.isValidElementType = function(a4) {
777
+ return "string" === typeof a4 || "function" === typeof a4 || a4 === d3 || a4 === f3 || a4 === e2 || a4 === m2 || a4 === n2 || a4 === t2 || "object" === typeof a4 && null !== a4 && (a4.$$typeof === q2 || a4.$$typeof === p2 || a4.$$typeof === g4 || a4.$$typeof === h3 || a4.$$typeof === l2 || a4.$$typeof === u2 || void 0 !== a4.getModuleId) ? true : false;
754
778
  };
755
- reactIs_production_min.typeOf = v2;
779
+ reactIs_production_min.typeOf = v3;
756
780
  return reactIs_production_min;
757
781
  }
758
782
  var hasRequiredReactIs;
@@ -787,7 +811,7 @@ var reactIsMethods = [
787
811
  "isSuspenseList",
788
812
  "isValidElementType"
789
813
  ];
790
- var ReactIs = Object.fromEntries(reactIsMethods.map((m2) => [m2, (v2) => ReactIs18[m2](v2) || ReactIs19[m2](v2)]));
814
+ var ReactIs = Object.fromEntries(reactIsMethods.map((m2) => [m2, (v3) => ReactIs18[m2](v3) || ReactIs19[m2](v3)]));
791
815
  function getChildren(arg, children = []) {
792
816
  if (Array.isArray(arg)) {
793
817
  for (const item of arg) {
@@ -1156,7 +1180,7 @@ var plugins = {
1156
1180
  Error: ErrorPlugin
1157
1181
  };
1158
1182
 
1159
- // ../../node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/helpers.js
1183
+ // ../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/helpers.js
1160
1184
  var import_constants = require("./constants.js.cjs");
1161
1185
  function assertTypes(value, name, types) {
1162
1186
  const receivedType = typeof value;
@@ -1165,6 +1189,31 @@ function assertTypes(value, name, types) {
1165
1189
  throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
1166
1190
  }
1167
1191
  }
1192
+ function filterOutComments(s3) {
1193
+ const result = [];
1194
+ let commentState = "none";
1195
+ for (let i3 = 0; i3 < s3.length; ++i3) {
1196
+ if (commentState === "singleline") {
1197
+ if (s3[i3] === "\n") {
1198
+ commentState = "none";
1199
+ }
1200
+ } else if (commentState === "multiline") {
1201
+ if (s3[i3 - 1] === "*" && s3[i3] === "/") {
1202
+ commentState = "none";
1203
+ }
1204
+ } else if (commentState === "none") {
1205
+ if (s3[i3] === "/" && s3[i3 + 1] === "/") {
1206
+ commentState = "singleline";
1207
+ } else if (s3[i3] === "/" && s3[i3 + 1] === "*") {
1208
+ commentState = "multiline";
1209
+ i3 += 2;
1210
+ } else {
1211
+ result.push(s3[i3]);
1212
+ }
1213
+ }
1214
+ }
1215
+ return result.join("");
1216
+ }
1168
1217
  function toArray(array) {
1169
1218
  if (array === null || array === void 0) {
1170
1219
  array = [];
@@ -1209,8 +1258,25 @@ function isNegativeNaN(val) {
1209
1258
  const isNegative = u32[1] >>> 31 === 1;
1210
1259
  return isNegative;
1211
1260
  }
1261
+ function ordinal(i3) {
1262
+ const j2 = i3 % 10;
1263
+ const k2 = i3 % 100;
1264
+ if (j2 === 1 && k2 !== 11) {
1265
+ return `${i3}st`;
1266
+ }
1267
+ if (j2 === 2 && k2 !== 12) {
1268
+ return `${i3}nd`;
1269
+ }
1270
+ if (j2 === 3 && k2 !== 13) {
1271
+ return `${i3}rd`;
1272
+ }
1273
+ return `${i3}th`;
1274
+ }
1275
+ function unique(array) {
1276
+ return Array.from(new Set(array));
1277
+ }
1212
1278
 
1213
- // ../../node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/timers.js
1279
+ // ../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/timers.js
1214
1280
  var SAFE_TIMERS_SYMBOL = /* @__PURE__ */ Symbol("vitest:SAFE_TIMERS");
1215
1281
  function getSafeTimers() {
1216
1282
  const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
@@ -1227,7 +1293,7 @@ function getSafeTimers() {
1227
1293
  };
1228
1294
  }
1229
1295
 
1230
- // ../../node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/display.js
1296
+ // ../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/display.js
1231
1297
  var ansiColors = {
1232
1298
  bold: ["1", "22"],
1233
1299
  dim: ["2", "22"],
@@ -1754,14 +1820,23 @@ var PLUGINS = [
1754
1820
  Immutable,
1755
1821
  AsymmetricMatcher
1756
1822
  ];
1757
- function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
1823
+ function stringify(object, maxDepth = 10, { maxLength, filterNode, ...options } = {}) {
1758
1824
  const MAX_LENGTH = maxLength ?? 1e4;
1759
1825
  let result;
1826
+ const filterFn = typeof filterNode === "string" ? createNodeFilterFromSelector(filterNode) : filterNode;
1827
+ const plugins2 = filterFn ? [
1828
+ ReactTestComponent,
1829
+ ReactElement,
1830
+ createDOMElementFilter(filterFn),
1831
+ DOMCollection,
1832
+ Immutable,
1833
+ AsymmetricMatcher
1834
+ ] : PLUGINS;
1760
1835
  try {
1761
1836
  result = format(object, {
1762
1837
  maxDepth,
1763
1838
  escapeString: false,
1764
- plugins: PLUGINS,
1839
+ plugins: plugins2,
1765
1840
  ...options
1766
1841
  });
1767
1842
  } catch {
@@ -1769,15 +1844,33 @@ function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
1769
1844
  callToJSON: false,
1770
1845
  maxDepth,
1771
1846
  escapeString: false,
1772
- plugins: PLUGINS,
1847
+ plugins: plugins2,
1773
1848
  ...options
1774
1849
  });
1775
1850
  }
1776
1851
  return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
1777
1852
  maxLength,
1853
+ filterNode,
1778
1854
  ...options
1779
1855
  }) : result;
1780
1856
  }
1857
+ function createNodeFilterFromSelector(selector) {
1858
+ const ELEMENT_NODE2 = 1;
1859
+ const COMMENT_NODE2 = 8;
1860
+ return (node) => {
1861
+ if (node.nodeType === COMMENT_NODE2) {
1862
+ return false;
1863
+ }
1864
+ if (node.nodeType === ELEMENT_NODE2 && node.matches) {
1865
+ try {
1866
+ return !node.matches(selector);
1867
+ } catch {
1868
+ return true;
1869
+ }
1870
+ }
1871
+ return true;
1872
+ };
1873
+ }
1781
1874
  var formatRegExp = /%[sdjifoOc%]/g;
1782
1875
  function baseFormat(args, options = {}) {
1783
1876
  const formatArg = (item, inspecOptions) => {
@@ -1834,6 +1927,9 @@ function baseFormat(args, options = {}) {
1834
1927
  if (typeof value === "bigint") {
1835
1928
  return `${value.toString()}n`;
1836
1929
  }
1930
+ if (typeof value === "symbol") {
1931
+ return "NaN";
1932
+ }
1837
1933
  return Number(value).toString();
1838
1934
  }
1839
1935
  case "%i": {
@@ -1872,7 +1968,7 @@ function baseFormat(args, options = {}) {
1872
1968
  });
1873
1969
  for (let x = args[i3]; i3 < len; x = args[++i3]) {
1874
1970
  if (x === null || typeof x !== "object") {
1875
- str += ` ${x}`;
1971
+ str += ` ${typeof x === "symbol" ? x.toString() : x}`;
1876
1972
  } else {
1877
1973
  str += ` ${formatArg(x)}`;
1878
1974
  }
@@ -1911,7 +2007,7 @@ function objDisplay(obj, options = {}) {
1911
2007
  return str;
1912
2008
  }
1913
2009
 
1914
- // ../../node_modules/.pnpm/@vitest+runner@4.0.18/node_modules/@vitest/runner/dist/index.js
2010
+ // ../../node_modules/.pnpm/@vitest+runner@4.1.0/node_modules/@vitest/runner/dist/index.js
1915
2011
  var import_chunk_tasks = require("./chunk-tasks.js.cjs");
1916
2012
  var PendingError = class extends Error {
1917
2013
  code = "VITEST_PENDING";
@@ -1923,6 +2019,15 @@ var PendingError = class extends Error {
1923
2019
  this.taskId = task.id;
1924
2020
  }
1925
2021
  };
2022
+ var FixtureDependencyError = class extends Error {
2023
+ name = "FixtureDependencyError";
2024
+ };
2025
+ var FixtureAccessError = class extends Error {
2026
+ name = "FixtureAccessError";
2027
+ };
2028
+ var FixtureParseError = class extends Error {
2029
+ name = "FixtureParseError";
2030
+ };
1926
2031
  var fnMap = /* @__PURE__ */ new WeakMap();
1927
2032
  var testFixtureMap = /* @__PURE__ */ new WeakMap();
1928
2033
  var hooksMap = /* @__PURE__ */ new WeakMap();
@@ -1932,7 +2037,7 @@ function setFn(key, fn) {
1932
2037
  function setTestFixture(key, fixture) {
1933
2038
  testFixtureMap.set(key, fixture);
1934
2039
  }
1935
- function getTestFixture(key) {
2040
+ function getTestFixtures(key) {
1936
2041
  return testFixtureMap.get(key);
1937
2042
  }
1938
2043
  function setHooks(key, hooks) {
@@ -1941,165 +2046,290 @@ function setHooks(key, hooks) {
1941
2046
  function getHooks(key) {
1942
2047
  return hooksMap.get(key);
1943
2048
  }
1944
- function mergeScopedFixtures(testFixtures, scopedFixtures) {
1945
- const scopedFixturesMap = scopedFixtures.reduce((map, fixture) => {
1946
- map[fixture.prop] = fixture;
1947
- return map;
1948
- }, {});
1949
- const newFixtures = {};
1950
- testFixtures.forEach((fixture) => {
1951
- const useFixture = scopedFixturesMap[fixture.prop] || { ...fixture };
1952
- newFixtures[useFixture.prop] = useFixture;
1953
- });
1954
- for (const fixtureKep in newFixtures) {
1955
- var _fixture$deps;
1956
- const fixture = newFixtures[fixtureKep];
1957
- fixture.deps = (_fixture$deps = fixture.deps) === null || _fixture$deps === void 0 ? void 0 : _fixture$deps.map((dep) => newFixtures[dep.prop]);
1958
- }
1959
- return Object.values(newFixtures);
1960
- }
1961
- function mergeContextFixtures(fixtures, context, runner2) {
1962
- const fixtureOptionKeys = [
2049
+ var TestFixtures = class _TestFixtures {
2050
+ _suiteContexts;
2051
+ _overrides = /* @__PURE__ */ new WeakMap();
2052
+ _registrations;
2053
+ static _definitions = [];
2054
+ static _builtinFixtures = [
2055
+ "task",
2056
+ "signal",
2057
+ "onTestFailed",
2058
+ "onTestFinished",
2059
+ "skip",
2060
+ "annotate"
2061
+ ];
2062
+ static _fixtureOptionKeys = [
1963
2063
  "auto",
1964
2064
  "injected",
1965
2065
  "scope"
1966
2066
  ];
1967
- const fixtureArray = Object.entries(fixtures).map(([prop, value]) => {
1968
- const fixtureItem = { value };
1969
- if (Array.isArray(value) && value.length >= 2 && isObject(value[1]) && Object.keys(value[1]).some((key) => fixtureOptionKeys.includes(key))) {
1970
- var _runner$injectValue;
1971
- Object.assign(fixtureItem, value[1]);
1972
- const userValue = value[0];
1973
- fixtureItem.value = fixtureItem.injected ? ((_runner$injectValue = runner2.injectValue) === null || _runner$injectValue === void 0 ? void 0 : _runner$injectValue.call(runner2, prop)) ?? userValue : userValue;
1974
- }
1975
- fixtureItem.scope = fixtureItem.scope || "test";
1976
- if (fixtureItem.scope === "worker" && !runner2.getWorkerContext) {
1977
- fixtureItem.scope = "file";
1978
- }
1979
- fixtureItem.prop = prop;
1980
- fixtureItem.isFn = typeof fixtureItem.value === "function";
1981
- return fixtureItem;
1982
- });
1983
- if (Array.isArray(context.fixtures)) {
1984
- context.fixtures = context.fixtures.concat(fixtureArray);
1985
- } else {
1986
- context.fixtures = fixtureArray;
2067
+ static _fixtureScopes = [
2068
+ "test",
2069
+ "file",
2070
+ "worker"
2071
+ ];
2072
+ static _workerContextSuite = { type: "worker" };
2073
+ static clearDefinitions() {
2074
+ _TestFixtures._definitions.length = 0;
2075
+ }
2076
+ static getWorkerContexts() {
2077
+ return _TestFixtures._definitions.map((f3) => f3.getWorkerContext());
2078
+ }
2079
+ static getFileContexts(file) {
2080
+ return _TestFixtures._definitions.map((f3) => f3.getFileContext(file));
2081
+ }
2082
+ constructor(registrations) {
2083
+ this._registrations = registrations ?? /* @__PURE__ */ new Map();
2084
+ this._suiteContexts = /* @__PURE__ */ new WeakMap();
2085
+ _TestFixtures._definitions.push(this);
2086
+ }
2087
+ extend(runner2, userFixtures) {
2088
+ const { suite: suite2 } = getCurrentSuite();
2089
+ const isTopLevel = !suite2 || suite2.file === suite2;
2090
+ const registrations = this.parseUserFixtures(runner2, userFixtures, isTopLevel);
2091
+ return new _TestFixtures(registrations);
2092
+ }
2093
+ get(suite2) {
2094
+ let currentSuite = suite2;
2095
+ while (currentSuite) {
2096
+ const overrides = this._overrides.get(currentSuite);
2097
+ if (overrides) {
2098
+ return overrides;
2099
+ }
2100
+ if (currentSuite === currentSuite.file) {
2101
+ break;
2102
+ }
2103
+ currentSuite = currentSuite.suite || currentSuite.file;
2104
+ }
2105
+ return this._registrations;
2106
+ }
2107
+ override(runner2, userFixtures) {
2108
+ const { suite: currentSuite, file } = getCurrentSuite();
2109
+ const suite2 = currentSuite || file;
2110
+ const isTopLevel = !currentSuite || currentSuite.file === currentSuite;
2111
+ const suiteRegistrations = new Map(this.get(suite2));
2112
+ const registrations = this.parseUserFixtures(runner2, userFixtures, isTopLevel, suiteRegistrations);
2113
+ if (isTopLevel) {
2114
+ this._registrations = registrations;
2115
+ } else {
2116
+ this._overrides.set(suite2, registrations);
2117
+ }
2118
+ }
2119
+ getFileContext(file) {
2120
+ if (!this._suiteContexts.has(file)) {
2121
+ this._suiteContexts.set(file, /* @__PURE__ */ Object.create(null));
2122
+ }
2123
+ return this._suiteContexts.get(file);
2124
+ }
2125
+ getWorkerContext() {
2126
+ if (!this._suiteContexts.has(_TestFixtures._workerContextSuite)) {
2127
+ this._suiteContexts.set(_TestFixtures._workerContextSuite, /* @__PURE__ */ Object.create(null));
2128
+ }
2129
+ return this._suiteContexts.get(_TestFixtures._workerContextSuite);
1987
2130
  }
1988
- fixtureArray.forEach((fixture) => {
1989
- if (fixture.isFn) {
1990
- const usedProps = getUsedProps(fixture.value);
1991
- if (usedProps.length) {
1992
- fixture.deps = context.fixtures.filter(({ prop }) => prop !== fixture.prop && usedProps.includes(prop));
2131
+ parseUserFixtures(runner2, userFixtures, supportNonTest, registrations = new Map(this._registrations)) {
2132
+ const errors = [];
2133
+ Object.entries(userFixtures).forEach(([name, fn]) => {
2134
+ let options;
2135
+ let value;
2136
+ let _options;
2137
+ if (Array.isArray(fn) && fn.length >= 2 && isObject(fn[1]) && Object.keys(fn[1]).some((key) => _TestFixtures._fixtureOptionKeys.includes(key))) {
2138
+ _options = fn[1];
2139
+ options = {
2140
+ auto: _options.auto ?? false,
2141
+ scope: _options.scope ?? "test",
2142
+ injected: _options.injected ?? false
2143
+ };
2144
+ value = options.injected ? runner2.injectValue?.(name) ?? fn[0] : fn[0];
2145
+ } else {
2146
+ value = fn;
1993
2147
  }
1994
- if (fixture.scope !== "test") {
1995
- var _fixture$deps2;
1996
- (_fixture$deps2 = fixture.deps) === null || _fixture$deps2 === void 0 ? void 0 : _fixture$deps2.forEach((dep) => {
1997
- if (!dep.isFn) {
1998
- return;
1999
- }
2000
- if (fixture.scope === "worker" && dep.scope === "worker") {
2001
- return;
2002
- }
2003
- if (fixture.scope === "file" && dep.scope !== "test") {
2004
- return;
2005
- }
2006
- throw new SyntaxError(`cannot use the ${dep.scope} fixture "${dep.prop}" inside the ${fixture.scope} fixture "${fixture.prop}"`);
2007
- });
2148
+ const parent = registrations.get(name);
2149
+ if (parent && options) {
2150
+ if (parent.scope !== options.scope) {
2151
+ errors.push(new FixtureDependencyError(`The "${name}" fixture was already registered with a "${options.scope}" scope.`));
2152
+ }
2153
+ if (parent.auto !== options.auto) {
2154
+ errors.push(new FixtureDependencyError(`The "${name}" fixture was already registered as { auto: ${options.auto} }.`));
2155
+ }
2156
+ } else if (parent) {
2157
+ options = {
2158
+ auto: parent.auto,
2159
+ scope: parent.scope,
2160
+ injected: parent.injected
2161
+ };
2162
+ } else if (!options) {
2163
+ options = {
2164
+ auto: false,
2165
+ injected: false,
2166
+ scope: "test"
2167
+ };
2168
+ }
2169
+ if (options.scope && !_TestFixtures._fixtureScopes.includes(options.scope)) {
2170
+ errors.push(new FixtureDependencyError(`The "${name}" fixture has unknown scope "${options.scope}".`));
2171
+ }
2172
+ if (!supportNonTest && options.scope !== "test") {
2173
+ errors.push(new FixtureDependencyError(`The "${name}" fixture cannot be defined with a ${options.scope} scope${!_options?.scope && parent?.scope ? " (inherited from the base fixture)" : ""} inside the describe block. Define it at the top level of the file instead.`));
2174
+ }
2175
+ const deps = isFixtureFunction(value) ? getUsedProps(value) : /* @__PURE__ */ new Set();
2176
+ const item = {
2177
+ name,
2178
+ value,
2179
+ auto: options.auto ?? false,
2180
+ injected: options.injected ?? false,
2181
+ scope: options.scope ?? "test",
2182
+ deps,
2183
+ parent
2184
+ };
2185
+ registrations.set(name, item);
2186
+ if (item.scope === "worker" && (runner2.pool === "vmThreads" || runner2.pool === "vmForks")) {
2187
+ item.scope = "file";
2188
+ }
2189
+ });
2190
+ for (const fixture of registrations.values()) {
2191
+ for (const depName of fixture.deps) {
2192
+ if (_TestFixtures._builtinFixtures.includes(depName)) {
2193
+ continue;
2194
+ }
2195
+ const dep = registrations.get(depName);
2196
+ if (!dep) {
2197
+ errors.push(new FixtureDependencyError(`The "${fixture.name}" fixture depends on unknown fixture "${depName}".`));
2198
+ continue;
2199
+ }
2200
+ if (depName === fixture.name && !fixture.parent) {
2201
+ errors.push(new FixtureDependencyError(`The "${fixture.name}" fixture depends on itself, but does not have a base implementation.`));
2202
+ continue;
2203
+ }
2204
+ if (_TestFixtures._fixtureScopes.indexOf(fixture.scope) > _TestFixtures._fixtureScopes.indexOf(dep.scope)) {
2205
+ errors.push(new FixtureDependencyError(`The ${fixture.scope} "${fixture.name}" fixture cannot depend on a ${dep.scope} fixture "${dep.name}".`));
2206
+ continue;
2207
+ }
2008
2208
  }
2009
2209
  }
2010
- });
2011
- return context;
2012
- }
2013
- var fixtureValueMaps = /* @__PURE__ */ new Map();
2014
- var cleanupFnArrayMap = /* @__PURE__ */ new Map();
2015
- function withFixtures(runner2, fn, testContext) {
2016
- return (hookContext) => {
2017
- const context = hookContext || testContext;
2210
+ if (errors.length === 1) {
2211
+ throw errors[0];
2212
+ } else if (errors.length > 1) {
2213
+ throw new AggregateError(errors, "Cannot resolve user fixtures. See errors for more information.");
2214
+ }
2215
+ return registrations;
2216
+ }
2217
+ };
2218
+ var cleanupFnArrayMap = /* @__PURE__ */ new WeakMap();
2219
+ var contextHasFixturesCache = /* @__PURE__ */ new WeakMap();
2220
+ function withFixtures(fn, options) {
2221
+ const collector = getCurrentSuite();
2222
+ const suite2 = options?.suite || collector.suite || collector.file;
2223
+ return async (hookContext) => {
2224
+ const context = hookContext || options?.context;
2018
2225
  if (!context) {
2226
+ if (options?.suiteHook) {
2227
+ validateSuiteHook(fn, options.suiteHook, options.stackTraceError);
2228
+ }
2019
2229
  return fn({});
2020
2230
  }
2021
- const fixtures = getTestFixture(context);
2022
- if (!(fixtures === null || fixtures === void 0 ? void 0 : fixtures.length)) {
2231
+ const fixtures = options?.fixtures || getTestFixtures(context);
2232
+ if (!fixtures) {
2023
2233
  return fn(context);
2024
2234
  }
2025
- const usedProps = getUsedProps(fn);
2026
- const hasAutoFixture = fixtures.some(({ auto }) => auto);
2027
- if (!usedProps.length && !hasAutoFixture) {
2235
+ const registrations = fixtures.get(suite2);
2236
+ if (!registrations.size) {
2028
2237
  return fn(context);
2029
2238
  }
2030
- if (!fixtureValueMaps.get(context)) {
2031
- fixtureValueMaps.set(context, /* @__PURE__ */ new Map());
2239
+ const usedFixtures = [];
2240
+ const usedProps = getUsedProps(fn);
2241
+ for (const fixture of registrations.values()) {
2242
+ if (fixture.auto || usedProps.has(fixture.name)) {
2243
+ usedFixtures.push(fixture);
2244
+ }
2245
+ }
2246
+ if (!usedFixtures.length) {
2247
+ return fn(context);
2032
2248
  }
2033
- const fixtureValueMap = fixtureValueMaps.get(context);
2034
2249
  if (!cleanupFnArrayMap.has(context)) {
2035
2250
  cleanupFnArrayMap.set(context, []);
2036
2251
  }
2037
2252
  const cleanupFnArray = cleanupFnArrayMap.get(context);
2038
- const usedFixtures = fixtures.filter(({ prop, auto }) => auto || usedProps.includes(prop));
2039
- const pendingFixtures = resolveDeps(usedFixtures);
2253
+ const pendingFixtures = resolveDeps(usedFixtures, registrations);
2040
2254
  if (!pendingFixtures.length) {
2041
2255
  return fn(context);
2042
2256
  }
2043
- async function resolveFixtures() {
2044
- for (const fixture of pendingFixtures) {
2045
- if (fixtureValueMap.has(fixture)) {
2046
- continue;
2257
+ if (options?.suiteHook) {
2258
+ const testScopedFixtures = pendingFixtures.filter((f3) => f3.scope === "test");
2259
+ if (testScopedFixtures.length > 0) {
2260
+ const fixtureNames = testScopedFixtures.map((f3) => `"${f3.name}"`).join(", ");
2261
+ const alternativeHook = {
2262
+ aroundAll: "aroundEach",
2263
+ beforeAll: "beforeEach",
2264
+ afterAll: "afterEach"
2265
+ };
2266
+ const error = new FixtureDependencyError(`Test-scoped fixtures cannot be used inside ${options.suiteHook} hook. The following fixtures are test-scoped: ${fixtureNames}. Use { scope: 'file' } or { scope: 'worker' } fixtures instead, or move the logic to ${alternativeHook[options.suiteHook]} hook.`);
2267
+ if (options.stackTraceError?.stack) {
2268
+ error.stack = error.message + options.stackTraceError.stack.replace(options.stackTraceError.message, "");
2047
2269
  }
2048
- const resolvedValue = await resolveFixtureValue(runner2, fixture, context, cleanupFnArray);
2049
- context[fixture.prop] = resolvedValue;
2050
- fixtureValueMap.set(fixture, resolvedValue);
2051
- if (fixture.scope === "test") {
2052
- cleanupFnArray.unshift(() => {
2053
- fixtureValueMap.delete(fixture);
2054
- });
2270
+ throw error;
2271
+ }
2272
+ }
2273
+ if (!contextHasFixturesCache.has(context)) {
2274
+ contextHasFixturesCache.set(context, /* @__PURE__ */ new WeakSet());
2275
+ }
2276
+ const cachedFixtures = contextHasFixturesCache.get(context);
2277
+ for (const fixture of pendingFixtures) {
2278
+ if (fixture.scope === "test") {
2279
+ if (cachedFixtures.has(fixture)) {
2280
+ continue;
2055
2281
  }
2282
+ cachedFixtures.add(fixture);
2283
+ const resolvedValue = await resolveTestFixtureValue(fixture, context, cleanupFnArray);
2284
+ context[fixture.name] = resolvedValue;
2285
+ cleanupFnArray.push(() => {
2286
+ cachedFixtures.delete(fixture);
2287
+ });
2288
+ } else {
2289
+ const resolvedValue = await resolveScopeFixtureValue(fixtures, suite2, fixture);
2290
+ context[fixture.name] = resolvedValue;
2056
2291
  }
2057
2292
  }
2058
- return resolveFixtures().then(() => fn(context));
2293
+ return fn(context);
2059
2294
  };
2060
2295
  }
2061
- var globalFixturePromise = /* @__PURE__ */ new WeakMap();
2062
- function resolveFixtureValue(runner2, fixture, context, cleanupFnArray) {
2063
- var _runner$getWorkerCont;
2064
- const fileContext = getFileContext(context.task.file);
2065
- const workerContext = (_runner$getWorkerCont = runner2.getWorkerContext) === null || _runner$getWorkerCont === void 0 ? void 0 : _runner$getWorkerCont.call(runner2);
2066
- if (!fixture.isFn) {
2067
- var _fixture$prop;
2068
- fileContext[_fixture$prop = fixture.prop] ?? (fileContext[_fixture$prop] = fixture.value);
2069
- if (workerContext) {
2070
- var _fixture$prop2;
2071
- workerContext[_fixture$prop2 = fixture.prop] ?? (workerContext[_fixture$prop2] = fixture.value);
2072
- }
2296
+ function isFixtureFunction(value) {
2297
+ return typeof value === "function";
2298
+ }
2299
+ function resolveTestFixtureValue(fixture, context, cleanupFnArray) {
2300
+ if (!isFixtureFunction(fixture.value)) {
2073
2301
  return fixture.value;
2074
2302
  }
2075
- if (fixture.scope === "test") {
2076
- return resolveFixtureFunction(fixture.value, context, cleanupFnArray);
2303
+ return resolveFixtureFunction(fixture.value, context, cleanupFnArray);
2304
+ }
2305
+ var scopedFixturePromiseCache = /* @__PURE__ */ new WeakMap();
2306
+ async function resolveScopeFixtureValue(fixtures, suite2, fixture) {
2307
+ const workerContext = fixtures.getWorkerContext();
2308
+ const fileContext = fixtures.getFileContext(suite2.file);
2309
+ const fixtureContext = fixture.scope === "worker" ? workerContext : fileContext;
2310
+ if (!isFixtureFunction(fixture.value)) {
2311
+ fixtureContext[fixture.name] = fixture.value;
2312
+ return fixture.value;
2077
2313
  }
2078
- if (globalFixturePromise.has(fixture)) {
2079
- return globalFixturePromise.get(fixture);
2314
+ if (fixture.name in fixtureContext) {
2315
+ return fixtureContext[fixture.name];
2080
2316
  }
2081
- let fixtureContext;
2082
- if (fixture.scope === "worker") {
2083
- if (!workerContext) {
2084
- throw new TypeError("[@vitest/runner] The worker context is not available in the current test runner. Please, provide the `getWorkerContext` method when initiating the runner.");
2085
- }
2086
- fixtureContext = workerContext;
2087
- } else {
2088
- fixtureContext = fileContext;
2089
- }
2090
- if (fixture.prop in fixtureContext) {
2091
- return fixtureContext[fixture.prop];
2317
+ if (scopedFixturePromiseCache.has(fixture)) {
2318
+ return scopedFixturePromiseCache.get(fixture);
2092
2319
  }
2093
2320
  if (!cleanupFnArrayMap.has(fixtureContext)) {
2094
2321
  cleanupFnArrayMap.set(fixtureContext, []);
2095
2322
  }
2096
2323
  const cleanupFnFileArray = cleanupFnArrayMap.get(fixtureContext);
2097
- const promise = resolveFixtureFunction(fixture.value, fixtureContext, cleanupFnFileArray).then((value) => {
2098
- fixtureContext[fixture.prop] = value;
2099
- globalFixturePromise.delete(fixture);
2324
+ const promise = resolveFixtureFunction(fixture.value, fixture.scope === "file" ? {
2325
+ ...workerContext,
2326
+ ...fileContext
2327
+ } : fixtureContext, cleanupFnFileArray).then((value) => {
2328
+ fixtureContext[fixture.name] = value;
2329
+ scopedFixturePromiseCache.delete(fixture);
2100
2330
  return value;
2101
2331
  });
2102
- globalFixturePromise.set(fixture, promise);
2332
+ scopedFixturePromiseCache.set(fixture, promise);
2103
2333
  return promise;
2104
2334
  }
2105
2335
  async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray) {
@@ -2123,82 +2353,97 @@ async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray) {
2123
2353
  });
2124
2354
  return useFnArgPromise;
2125
2355
  }
2126
- function resolveDeps(fixtures, depSet = /* @__PURE__ */ new Set(), pendingFixtures = []) {
2127
- fixtures.forEach((fixture) => {
2356
+ function resolveDeps(usedFixtures, registrations, depSet = /* @__PURE__ */ new Set(), pendingFixtures = []) {
2357
+ usedFixtures.forEach((fixture) => {
2128
2358
  if (pendingFixtures.includes(fixture)) {
2129
2359
  return;
2130
2360
  }
2131
- if (!fixture.isFn || !fixture.deps) {
2361
+ if (!isFixtureFunction(fixture.value) || !fixture.deps) {
2132
2362
  pendingFixtures.push(fixture);
2133
2363
  return;
2134
2364
  }
2135
2365
  if (depSet.has(fixture)) {
2136
- throw new Error(`Circular fixture dependency detected: ${fixture.prop} <- ${[...depSet].reverse().map((d4) => d4.prop).join(" <- ")}`);
2366
+ if (fixture.parent) {
2367
+ fixture = fixture.parent;
2368
+ } else {
2369
+ throw new Error(`Circular fixture dependency detected: ${fixture.name} <- ${[...depSet].reverse().map((d3) => d3.name).join(" <- ")}`);
2370
+ }
2137
2371
  }
2138
2372
  depSet.add(fixture);
2139
- resolveDeps(fixture.deps, depSet, pendingFixtures);
2373
+ resolveDeps([...fixture.deps].map((n2) => n2 === fixture.name ? fixture.parent : registrations.get(n2)).filter((n2) => !!n2), registrations, depSet, pendingFixtures);
2140
2374
  pendingFixtures.push(fixture);
2141
2375
  depSet.clear();
2142
2376
  });
2143
2377
  return pendingFixtures;
2144
2378
  }
2145
- function getUsedProps(fn) {
2146
- let fnString = filterOutComments(fn.toString());
2379
+ function validateSuiteHook(fn, hook, suiteError) {
2380
+ const usedProps = getUsedProps(fn, {
2381
+ sourceError: suiteError,
2382
+ suiteHook: hook
2383
+ });
2384
+ if (usedProps.size) {
2385
+ const error = new FixtureAccessError(`The ${hook} hook uses fixtures "${[...usedProps].join('", "')}", but has no access to context. Did you forget to call it as "test.${hook}()" instead of "${hook}()"?
2386
+ If you used internal "suite" task as the first argument previously, access it in the second argument instead. See https://vitest.dev/guide/test-context#suite-level-hooks`);
2387
+ if (suiteError) {
2388
+ error.stack = suiteError.stack?.replace(suiteError.message, error.message);
2389
+ }
2390
+ throw error;
2391
+ }
2392
+ }
2393
+ var kPropsSymbol = /* @__PURE__ */ Symbol("$vitest:fixture-props");
2394
+ var kPropNamesSymbol = /* @__PURE__ */ Symbol("$vitest:fixture-prop-names");
2395
+ function configureProps(fn, options) {
2396
+ Object.defineProperty(fn, kPropsSymbol, {
2397
+ value: options,
2398
+ enumerable: false
2399
+ });
2400
+ }
2401
+ function memoProps(fn, props) {
2402
+ fn[kPropNamesSymbol] = props;
2403
+ return props;
2404
+ }
2405
+ function getUsedProps(fn, { sourceError, suiteHook } = {}) {
2406
+ if (kPropNamesSymbol in fn) {
2407
+ return fn[kPropNamesSymbol];
2408
+ }
2409
+ const { index: fixturesIndex = 0, original: implementation = fn } = kPropsSymbol in fn ? fn[kPropsSymbol] : {};
2410
+ let fnString = filterOutComments(implementation.toString());
2147
2411
  if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) {
2148
2412
  fnString = fnString.split(/__async\((?:this|null),/)[1];
2149
2413
  }
2150
2414
  const match = fnString.match(/[^(]*\(([^)]*)/);
2151
2415
  if (!match) {
2152
- return [];
2416
+ return memoProps(fn, /* @__PURE__ */ new Set());
2153
2417
  }
2154
2418
  const args = splitByComma(match[1]);
2155
2419
  if (!args.length) {
2156
- return [];
2420
+ return memoProps(fn, /* @__PURE__ */ new Set());
2157
2421
  }
2158
- let first = args[0];
2159
- if ("__VITEST_FIXTURE_INDEX__" in fn) {
2160
- first = args[fn.__VITEST_FIXTURE_INDEX__];
2161
- if (!first) {
2162
- return [];
2163
- }
2422
+ const fixturesArgument = args[fixturesIndex];
2423
+ if (!fixturesArgument) {
2424
+ return memoProps(fn, /* @__PURE__ */ new Set());
2164
2425
  }
2165
- if (!(first[0] === "{" && first.endsWith("}"))) {
2166
- throw new Error(`The first argument inside a fixture must use object destructuring pattern, e.g. ({ test } => {}). Instead, received "${first}".`);
2426
+ if (!(fixturesArgument[0] === "{" && fixturesArgument.endsWith("}"))) {
2427
+ const ordinalArgument = ordinal(fixturesIndex + 1);
2428
+ const error = new FixtureParseError(`The ${ordinalArgument} argument inside a fixture must use object destructuring pattern, e.g. ({ task } => {}). Instead, received "${fixturesArgument}".${suiteHook ? ` If you used internal "suite" task as the ${ordinalArgument} argument previously, access it in the ${ordinal(fixturesIndex + 2)} argument instead.` : ""}`);
2429
+ if (sourceError) {
2430
+ error.stack = sourceError.stack?.replace(sourceError.message, error.message);
2431
+ }
2432
+ throw error;
2167
2433
  }
2168
- const _first = first.slice(1, -1).replace(/\s/g, "");
2434
+ const _first = fixturesArgument.slice(1, -1).replace(/\s/g, "");
2169
2435
  const props = splitByComma(_first).map((prop) => {
2170
2436
  return prop.replace(/:.*|=.*/g, "");
2171
2437
  });
2172
2438
  const last = props.at(-1);
2173
2439
  if (last && last.startsWith("...")) {
2174
- throw new Error(`Rest parameters are not supported in fixtures, received "${last}".`);
2175
- }
2176
- return props;
2177
- }
2178
- function filterOutComments(s3) {
2179
- const result = [];
2180
- let commentState = "none";
2181
- for (let i3 = 0; i3 < s3.length; ++i3) {
2182
- if (commentState === "singleline") {
2183
- if (s3[i3] === "\n") {
2184
- commentState = "none";
2185
- }
2186
- } else if (commentState === "multiline") {
2187
- if (s3[i3 - 1] === "*" && s3[i3] === "/") {
2188
- commentState = "none";
2189
- }
2190
- } else if (commentState === "none") {
2191
- if (s3[i3] === "/" && s3[i3 + 1] === "/") {
2192
- commentState = "singleline";
2193
- } else if (s3[i3] === "/" && s3[i3 + 1] === "*") {
2194
- commentState = "multiline";
2195
- i3 += 2;
2196
- } else {
2197
- result.push(s3[i3]);
2198
- }
2440
+ const error = new FixtureParseError(`Rest parameters are not supported in fixtures, received "${last}".`);
2441
+ if (sourceError) {
2442
+ error.stack = sourceError.stack?.replace(sourceError.message, error.message);
2199
2443
  }
2444
+ throw error;
2200
2445
  }
2201
- return result.join("");
2446
+ return memoProps(fn, new Set(props));
2202
2447
  }
2203
2448
  function splitByComma(s3) {
2204
2449
  const result = [];
@@ -2232,40 +2477,99 @@ function getDefaultHookTimeout() {
2232
2477
  }
2233
2478
  var CLEANUP_TIMEOUT_KEY = /* @__PURE__ */ Symbol.for("VITEST_CLEANUP_TIMEOUT");
2234
2479
  var CLEANUP_STACK_TRACE_KEY = /* @__PURE__ */ Symbol.for("VITEST_CLEANUP_STACK_TRACE");
2480
+ var AROUND_TIMEOUT_KEY = /* @__PURE__ */ Symbol.for("VITEST_AROUND_TIMEOUT");
2481
+ var AROUND_STACK_TRACE_KEY = /* @__PURE__ */ Symbol.for("VITEST_AROUND_STACK_TRACE");
2235
2482
  function beforeAll(fn, timeout = getDefaultHookTimeout()) {
2236
2483
  assertTypes(fn, '"beforeAll" callback', ["function"]);
2237
2484
  const stackTraceError = new Error("STACK_TRACE_ERROR");
2238
- return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(fn, timeout, true, stackTraceError), {
2485
+ const context = (0, import_chunk_tasks.w)(this);
2486
+ return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(withSuiteFixtures("beforeAll", fn, context, stackTraceError), timeout, true, stackTraceError), {
2239
2487
  [CLEANUP_TIMEOUT_KEY]: timeout,
2240
2488
  [CLEANUP_STACK_TRACE_KEY]: stackTraceError
2241
2489
  }));
2242
2490
  }
2243
2491
  function afterAll(fn, timeout) {
2244
2492
  assertTypes(fn, '"afterAll" callback', ["function"]);
2245
- return getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR")));
2493
+ const context = (0, import_chunk_tasks.w)(this);
2494
+ const stackTraceError = new Error("STACK_TRACE_ERROR");
2495
+ return getCurrentSuite().on("afterAll", withTimeout(withSuiteFixtures("afterAll", fn, context, stackTraceError), timeout ?? getDefaultHookTimeout(), true, stackTraceError));
2246
2496
  }
2247
2497
  function beforeEach(fn, timeout = getDefaultHookTimeout()) {
2248
2498
  assertTypes(fn, '"beforeEach" callback', ["function"]);
2249
2499
  const stackTraceError = new Error("STACK_TRACE_ERROR");
2250
- const runner2 = getRunner();
2251
- return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(withFixtures(runner2, fn), timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
2500
+ const wrapper = (context, suite2) => {
2501
+ const fixtureResolver = withFixtures(fn, { suite: suite2 });
2502
+ return fixtureResolver(context);
2503
+ };
2504
+ return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
2252
2505
  [CLEANUP_TIMEOUT_KEY]: timeout,
2253
2506
  [CLEANUP_STACK_TRACE_KEY]: stackTraceError
2254
2507
  }));
2255
2508
  }
2256
2509
  function afterEach(fn, timeout) {
2257
2510
  assertTypes(fn, '"afterEach" callback', ["function"]);
2258
- const runner2 = getRunner();
2259
- return getCurrentSuite().on("afterEach", withTimeout(withFixtures(runner2, fn), timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2511
+ const wrapper = (context, suite2) => {
2512
+ const fixtureResolver = withFixtures(fn, { suite: suite2 });
2513
+ return fixtureResolver(context);
2514
+ };
2515
+ return getCurrentSuite().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2260
2516
  }
2261
2517
  var onTestFailed = createTestHook("onTestFailed", (test3, handler, timeout) => {
2262
- test3.onFailed || (test3.onFailed = []);
2518
+ test3.onFailed ||= [];
2263
2519
  test3.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2264
2520
  });
2265
2521
  var onTestFinished = createTestHook("onTestFinished", (test3, handler, timeout) => {
2266
- test3.onFinished || (test3.onFinished = []);
2522
+ test3.onFinished ||= [];
2267
2523
  test3.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2268
2524
  });
2525
+ function aroundAll(fn, timeout) {
2526
+ assertTypes(fn, '"aroundAll" callback', ["function"]);
2527
+ const stackTraceError = new Error("STACK_TRACE_ERROR");
2528
+ const resolvedTimeout = timeout ?? getDefaultHookTimeout();
2529
+ const context = (0, import_chunk_tasks.w)(this);
2530
+ return getCurrentSuite().on("aroundAll", Object.assign(withSuiteFixtures("aroundAll", fn, context, stackTraceError, 1), {
2531
+ [AROUND_TIMEOUT_KEY]: resolvedTimeout,
2532
+ [AROUND_STACK_TRACE_KEY]: stackTraceError
2533
+ }));
2534
+ }
2535
+ function aroundEach(fn, timeout) {
2536
+ assertTypes(fn, '"aroundEach" callback', ["function"]);
2537
+ const stackTraceError = new Error("STACK_TRACE_ERROR");
2538
+ const resolvedTimeout = timeout ?? getDefaultHookTimeout();
2539
+ const wrapper = (runTest, context, suite2) => {
2540
+ const innerFn = (ctx) => fn(runTest, ctx, suite2);
2541
+ configureProps(innerFn, {
2542
+ index: 1,
2543
+ original: fn
2544
+ });
2545
+ const fixtureResolver = withFixtures(innerFn, { suite: suite2 });
2546
+ return fixtureResolver(context);
2547
+ };
2548
+ return getCurrentSuite().on("aroundEach", Object.assign(wrapper, {
2549
+ [AROUND_TIMEOUT_KEY]: resolvedTimeout,
2550
+ [AROUND_STACK_TRACE_KEY]: stackTraceError
2551
+ }));
2552
+ }
2553
+ function withSuiteFixtures(suiteHook, fn, context, stackTraceError, contextIndex = 0) {
2554
+ return (...args) => {
2555
+ const suite2 = args.at(-1);
2556
+ const prefix = args.slice(0, -1);
2557
+ const wrapper = (ctx) => fn(...prefix, ctx, suite2);
2558
+ configureProps(wrapper, {
2559
+ index: contextIndex,
2560
+ original: fn
2561
+ });
2562
+ const fixtures = context?.getFixtures();
2563
+ const fileContext = fixtures?.getFileContext(suite2.file);
2564
+ const fixtured = withFixtures(wrapper, {
2565
+ suiteHook,
2566
+ fixtures,
2567
+ context: fileContext,
2568
+ stackTraceError
2569
+ });
2570
+ return fixtured();
2571
+ };
2572
+ }
2269
2573
  function createTestHook(name, handler) {
2270
2574
  return (fn, timeout) => {
2271
2575
  assertTypes(fn, `"${name}" callback`, ["function"]);
@@ -2311,9 +2615,12 @@ function createSuiteHooks() {
2311
2615
  beforeAll: [],
2312
2616
  afterAll: [],
2313
2617
  beforeEach: [],
2314
- afterEach: []
2618
+ afterEach: [],
2619
+ aroundEach: [],
2620
+ aroundAll: []
2315
2621
  };
2316
2622
  }
2623
+ var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
2317
2624
  function parseArguments(optionsOrFn, timeoutOrTest) {
2318
2625
  if (timeoutOrTest != null && typeof timeoutOrTest === "object") {
2319
2626
  throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
@@ -2339,32 +2646,66 @@ function parseArguments(optionsOrFn, timeoutOrTest) {
2339
2646
  };
2340
2647
  }
2341
2648
  function createSuiteCollector(name, factory = () => {
2342
- }, mode, each, suiteOptions, parentCollectorFixtures) {
2649
+ }, mode, each, suiteOptions) {
2343
2650
  const tasks = [];
2344
2651
  let suite2;
2345
2652
  initSuite(true);
2346
2653
  const task = function(name2 = "", options = {}) {
2347
- var _collectorContext$cur, _collectorContext$cur2, _collectorContext$cur3;
2348
- const timeout = (options === null || options === void 0 ? void 0 : options.timeout) ?? runner.config.testTimeout;
2349
- const currentSuite = (_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 ? void 0 : _collectorContext$cur.suite;
2654
+ const currentSuite = collectorContext.currentSuite?.suite;
2655
+ const parentTask = currentSuite ?? collectorContext.currentSuite?.file;
2656
+ const parentTags = parentTask?.tags || [];
2657
+ const testTags = unique([...parentTags, ...toArray(options.tags)]);
2658
+ const tagsOptions = testTags.map((tag) => {
2659
+ const tagDefinition = runner.config.tags?.find((t2) => t2.name === tag);
2660
+ if (!tagDefinition && runner.config.strictTags) {
2661
+ throw (0, import_chunk_tasks.x)(runner.config.tags, tag);
2662
+ }
2663
+ return tagDefinition;
2664
+ }).filter((r2) => r2 != null).sort((tag1, tag2) => (tag2.priority ?? POSITIVE_INFINITY) - (tag1.priority ?? POSITIVE_INFINITY)).reduce((acc, tag) => {
2665
+ const { name: name3, description, priority, meta, ...options2 } = tag;
2666
+ Object.assign(acc, options2);
2667
+ if (meta) {
2668
+ acc.meta = Object.assign(acc.meta ?? /* @__PURE__ */ Object.create(null), meta);
2669
+ }
2670
+ return acc;
2671
+ }, {});
2672
+ const testOwnMeta = options.meta;
2673
+ options = {
2674
+ ...tagsOptions,
2675
+ ...options
2676
+ };
2677
+ const timeout = options.timeout ?? runner.config.testTimeout;
2678
+ const parentMeta = currentSuite?.meta;
2679
+ const tagMeta = tagsOptions.meta;
2680
+ const testMeta = /* @__PURE__ */ Object.create(null);
2681
+ if (tagMeta) {
2682
+ Object.assign(testMeta, tagMeta);
2683
+ }
2684
+ if (parentMeta) {
2685
+ Object.assign(testMeta, parentMeta);
2686
+ }
2687
+ if (testOwnMeta) {
2688
+ Object.assign(testMeta, testOwnMeta);
2689
+ }
2350
2690
  const task2 = {
2351
2691
  id: "",
2352
2692
  name: name2,
2353
- fullName: (0, import_chunk_tasks.e)([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur2 = collectorContext.currentSuite) === null || _collectorContext$cur2 === void 0 || (_collectorContext$cur2 = _collectorContext$cur2.file) === null || _collectorContext$cur2 === void 0 ? void 0 : _collectorContext$cur2.fullName), name2]),
2354
- fullTestName: (0, import_chunk_tasks.e)([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name2]),
2693
+ fullName: (0, import_chunk_tasks.e)([currentSuite?.fullName ?? collectorContext.currentSuite?.file?.fullName, name2]),
2694
+ fullTestName: (0, import_chunk_tasks.e)([currentSuite?.fullTestName, name2]),
2355
2695
  suite: currentSuite,
2356
2696
  each: options.each,
2357
2697
  fails: options.fails,
2358
2698
  context: void 0,
2359
2699
  type: "test",
2360
- file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur3 = collectorContext.currentSuite) === null || _collectorContext$cur3 === void 0 ? void 0 : _collectorContext$cur3.file),
2700
+ file: currentSuite?.file ?? collectorContext.currentSuite?.file,
2361
2701
  timeout,
2362
2702
  retry: options.retry ?? runner.config.retry,
2363
2703
  repeats: options.repeats,
2364
2704
  mode: options.only ? "only" : options.skip ? "skip" : options.todo ? "todo" : "run",
2365
- meta: options.meta ?? /* @__PURE__ */ Object.create(null),
2705
+ meta: testMeta,
2366
2706
  annotations: [],
2367
- artifacts: []
2707
+ artifacts: [],
2708
+ tags: testTags
2368
2709
  };
2369
2710
  const handler = options.handler;
2370
2711
  if (task2.mode === "run" && !handler) {
@@ -2373,19 +2714,19 @@ function createSuiteCollector(name, factory = () => {
2373
2714
  if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) {
2374
2715
  task2.concurrent = true;
2375
2716
  }
2376
- task2.shuffle = suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle;
2717
+ task2.shuffle = suiteOptions?.shuffle;
2377
2718
  const context = createTestContext(task2, runner);
2378
2719
  Object.defineProperty(task2, "context", {
2379
2720
  value: context,
2380
2721
  enumerable: false
2381
2722
  });
2382
- setTestFixture(context, options.fixtures);
2723
+ setTestFixture(context, options.fixtures ?? new TestFixtures());
2383
2724
  const limit = Error.stackTraceLimit;
2384
- Error.stackTraceLimit = 15;
2725
+ Error.stackTraceLimit = 10;
2385
2726
  const stackTraceError = new Error("STACK_TRACE_ERROR");
2386
2727
  Error.stackTraceLimit = limit;
2387
2728
  if (handler) {
2388
- setFn(task2, withTimeout(withAwaitAsyncAssertions(withFixtures(runner, handler, context), task2), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
2729
+ setFn(task2, withTimeout(withCancel(withAwaitAsyncAssertions(withFixtures(handler, { context }), task2), task2.context.signal), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
2389
2730
  }
2390
2731
  if (runner.config.includeTaskLocation) {
2391
2732
  const error = stackTraceError.stack;
@@ -2405,8 +2746,14 @@ function createSuiteCollector(name, factory = () => {
2405
2746
  if (typeof suiteOptions === "object") {
2406
2747
  options = Object.assign({}, suiteOptions, options);
2407
2748
  }
2408
- options.concurrent = this.concurrent || !this.sequential && (options === null || options === void 0 ? void 0 : options.concurrent);
2409
- options.sequential = this.sequential || !this.concurrent && (options === null || options === void 0 ? void 0 : options.sequential);
2749
+ const concurrent = this.concurrent ?? (!this.sequential && options?.concurrent);
2750
+ if (options.concurrent != null && concurrent != null) {
2751
+ options.concurrent = concurrent;
2752
+ }
2753
+ const sequential = this.sequential ?? (!this.concurrent && options?.sequential);
2754
+ if (options.sequential != null && sequential != null) {
2755
+ options.sequential = sequential;
2756
+ }
2410
2757
  const test4 = task(formatName(name2), {
2411
2758
  ...this,
2412
2759
  ...options,
@@ -2414,7 +2761,6 @@ function createSuiteCollector(name, factory = () => {
2414
2761
  });
2415
2762
  test4.type = "test";
2416
2763
  });
2417
- let collectorFixtures = parentCollectorFixtures;
2418
2764
  const collector = {
2419
2765
  type: "collector",
2420
2766
  name,
@@ -2422,44 +2768,39 @@ function createSuiteCollector(name, factory = () => {
2422
2768
  suite: suite2,
2423
2769
  options: suiteOptions,
2424
2770
  test: test3,
2771
+ file: suite2.file,
2425
2772
  tasks,
2426
2773
  collect,
2427
2774
  task,
2428
2775
  clear,
2429
- on: addHook,
2430
- fixtures() {
2431
- return collectorFixtures;
2432
- },
2433
- scoped(fixtures) {
2434
- const parsed = mergeContextFixtures(fixtures, { fixtures: collectorFixtures }, runner);
2435
- if (parsed.fixtures) {
2436
- collectorFixtures = parsed.fixtures;
2437
- }
2438
- }
2776
+ on: addHook
2439
2777
  };
2440
2778
  function addHook(name2, ...fn) {
2441
2779
  getHooks(suite2)[name2].push(...fn);
2442
2780
  }
2443
2781
  function initSuite(includeLocation) {
2444
- var _collectorContext$cur4, _collectorContext$cur5, _collectorContext$cur6;
2445
2782
  if (typeof suiteOptions === "number") {
2446
2783
  suiteOptions = { timeout: suiteOptions };
2447
2784
  }
2448
- const currentSuite = (_collectorContext$cur4 = collectorContext.currentSuite) === null || _collectorContext$cur4 === void 0 ? void 0 : _collectorContext$cur4.suite;
2785
+ const currentSuite = collectorContext.currentSuite?.suite;
2786
+ const parentTask = currentSuite ?? collectorContext.currentSuite?.file;
2787
+ const suiteTags = toArray(suiteOptions?.tags);
2788
+ (0, import_chunk_tasks.v)(runner.config, suiteTags);
2449
2789
  suite2 = {
2450
2790
  id: "",
2451
2791
  type: "suite",
2452
2792
  name,
2453
- fullName: (0, import_chunk_tasks.e)([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur5 = collectorContext.currentSuite) === null || _collectorContext$cur5 === void 0 || (_collectorContext$cur5 = _collectorContext$cur5.file) === null || _collectorContext$cur5 === void 0 ? void 0 : _collectorContext$cur5.fullName), name]),
2454
- fullTestName: (0, import_chunk_tasks.e)([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name]),
2793
+ fullName: (0, import_chunk_tasks.e)([currentSuite?.fullName ?? collectorContext.currentSuite?.file?.fullName, name]),
2794
+ fullTestName: (0, import_chunk_tasks.e)([currentSuite?.fullTestName, name]),
2455
2795
  suite: currentSuite,
2456
2796
  mode,
2457
2797
  each,
2458
- file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur6 = collectorContext.currentSuite) === null || _collectorContext$cur6 === void 0 ? void 0 : _collectorContext$cur6.file),
2459
- shuffle: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle,
2798
+ file: currentSuite?.file ?? collectorContext.currentSuite?.file,
2799
+ shuffle: suiteOptions?.shuffle,
2460
2800
  tasks: [],
2461
- meta: /* @__PURE__ */ Object.create(null),
2462
- concurrent: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.concurrent
2801
+ meta: suiteOptions?.meta ?? /* @__PURE__ */ Object.create(null),
2802
+ concurrent: suiteOptions?.concurrent,
2803
+ tags: unique([...parentTask?.tags || [], ...suiteTags])
2463
2804
  };
2464
2805
  if (runner && includeLocation && runner.config.includeTaskLocation) {
2465
2806
  const limit = Error.stackTraceLimit;
@@ -2512,32 +2853,43 @@ function withAwaitAsyncAssertions(fn, task) {
2512
2853
  }
2513
2854
  function createSuite() {
2514
2855
  function suiteFn(name, factoryOrOptions, optionsOrFactory) {
2515
- var _currentSuite$options;
2516
2856
  if (getCurrentTest()) {
2517
2857
  throw new Error("Calling the suite function inside test function is not allowed. It can be only called at the top level or inside another suite function.");
2518
2858
  }
2519
- let mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
2520
2859
  const currentSuite = collectorContext.currentSuite || defaultSuite;
2521
2860
  let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
2522
- if (mode === "run" && !factory) {
2523
- mode = "todo";
2524
- }
2525
2861
  const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false;
2526
2862
  const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false;
2863
+ const { meta: parentMeta, ...parentOptions } = currentSuite?.options || {};
2527
2864
  options = {
2528
- ...currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.options,
2529
- ...options,
2530
- shuffle: this.shuffle ?? options.shuffle ?? (currentSuite === null || currentSuite === void 0 || (_currentSuite$options = currentSuite.options) === null || _currentSuite$options === void 0 ? void 0 : _currentSuite$options.shuffle) ?? (runner === null || runner === void 0 ? void 0 : runner.config.sequence.shuffle)
2865
+ ...parentOptions,
2866
+ ...options
2531
2867
  };
2868
+ const shuffle2 = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ?? runner?.config.sequence.shuffle;
2869
+ if (shuffle2 != null) {
2870
+ options.shuffle = shuffle2;
2871
+ }
2872
+ let mode = this.only ?? options.only ? "only" : this.skip ?? options.skip ? "skip" : this.todo ?? options.todo ? "todo" : "run";
2873
+ if (mode === "run" && !factory) {
2874
+ mode = "todo";
2875
+ }
2532
2876
  const isConcurrent = isConcurrentSpecified || options.concurrent && !isSequentialSpecified;
2533
2877
  const isSequential = isSequentialSpecified || options.sequential && !isConcurrentSpecified;
2534
- options.concurrent = isConcurrent && !isSequential;
2535
- options.sequential = isSequential && !isConcurrent;
2536
- return createSuiteCollector(formatName(name), factory, mode, this.each, options, currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fixtures());
2878
+ if (isConcurrent != null) {
2879
+ options.concurrent = isConcurrent && !isSequential;
2880
+ }
2881
+ if (isSequential != null) {
2882
+ options.sequential = isSequential && !isConcurrent;
2883
+ }
2884
+ if (parentMeta) {
2885
+ options.meta = Object.assign(/* @__PURE__ */ Object.create(null), parentMeta, options.meta);
2886
+ }
2887
+ return createSuiteCollector(formatName(name), factory, mode, this.each, options);
2537
2888
  }
2538
2889
  suiteFn.each = function(cases, ...args) {
2539
- const suite2 = this.withContext();
2540
- this.setContext("each", true);
2890
+ const context = (0, import_chunk_tasks.w)(this);
2891
+ const suite2 = context.withContext();
2892
+ context.setContext("each", true);
2541
2893
  if (Array.isArray(cases) && args.length) {
2542
2894
  cases = formatTemplateString(cases, args);
2543
2895
  }
@@ -2562,7 +2914,7 @@ function createSuite() {
2562
2914
  }
2563
2915
  }
2564
2916
  });
2565
- this.setContext("each", void 0);
2917
+ context.setContext("each", void 0);
2566
2918
  };
2567
2919
  };
2568
2920
  suiteFn.for = function(cases, ...args) {
@@ -2579,7 +2931,7 @@ function createSuite() {
2579
2931
  };
2580
2932
  suiteFn.skipIf = (condition) => condition ? suite.skip : suite;
2581
2933
  suiteFn.runIf = (condition) => condition ? suite : suite.skip;
2582
- return (0, import_chunk_tasks.c)([
2934
+ return (0, import_chunk_tasks.a)([
2583
2935
  "concurrent",
2584
2936
  "sequential",
2585
2937
  "shuffle",
@@ -2588,11 +2940,12 @@ function createSuite() {
2588
2940
  "todo"
2589
2941
  ], suiteFn);
2590
2942
  }
2591
- function createTaskCollector(fn, context) {
2943
+ function createTaskCollector(fn) {
2592
2944
  const taskFn = fn;
2593
2945
  taskFn.each = function(cases, ...args) {
2594
- const test3 = this.withContext();
2595
- this.setContext("each", true);
2946
+ const context = (0, import_chunk_tasks.w)(this);
2947
+ const test3 = context.withContext();
2948
+ context.setContext("each", true);
2596
2949
  if (Array.isArray(cases) && args.length) {
2597
2950
  cases = formatTemplateString(cases, args);
2598
2951
  }
@@ -2617,11 +2970,12 @@ function createTaskCollector(fn, context) {
2617
2970
  }
2618
2971
  }
2619
2972
  });
2620
- this.setContext("each", void 0);
2973
+ context.setContext("each", void 0);
2621
2974
  };
2622
2975
  };
2623
2976
  taskFn.for = function(cases, ...args) {
2624
- const test3 = this.withContext();
2977
+ const context = (0, import_chunk_tasks.w)(this);
2978
+ const test3 = context.withContext();
2625
2979
  if (Array.isArray(cases) && args.length) {
2626
2980
  cases = formatTemplateString(cases, args);
2627
2981
  }
@@ -2631,8 +2985,10 @@ function createTaskCollector(fn, context) {
2631
2985
  cases.forEach((item, idx) => {
2632
2986
  const handlerWrapper = handler ? (ctx) => handler(item, ctx) : void 0;
2633
2987
  if (handlerWrapper) {
2634
- handlerWrapper.__VITEST_FIXTURE_INDEX__ = 1;
2635
- handlerWrapper.toString = () => handler.toString();
2988
+ configureProps(handlerWrapper, {
2989
+ index: 1,
2990
+ original: handler
2991
+ });
2636
2992
  }
2637
2993
  test3(formatTitle(_name, toArray(item), idx), options, handlerWrapper);
2638
2994
  });
@@ -2644,42 +3000,90 @@ function createTaskCollector(fn, context) {
2644
3000
  taskFn.runIf = function(condition) {
2645
3001
  return condition ? this : this.skip;
2646
3002
  };
3003
+ function parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn) {
3004
+ if (typeof fixturesOrName !== "string") {
3005
+ return fixturesOrName;
3006
+ }
3007
+ const fixtureName = fixturesOrName;
3008
+ let fixtureOptions;
3009
+ let fixtureValue;
3010
+ if (maybeFn !== void 0) {
3011
+ fixtureOptions = optionsOrFn;
3012
+ fixtureValue = maybeFn;
3013
+ } else {
3014
+ if (optionsOrFn !== null && typeof optionsOrFn === "object" && !Array.isArray(optionsOrFn) && ("scope" in optionsOrFn || "auto" in optionsOrFn)) {
3015
+ fixtureOptions = optionsOrFn;
3016
+ fixtureValue = {};
3017
+ } else {
3018
+ fixtureOptions = void 0;
3019
+ fixtureValue = optionsOrFn;
3020
+ }
3021
+ }
3022
+ if (typeof fixtureValue === "function") {
3023
+ const builderFn = fixtureValue;
3024
+ const fixture = async (ctx, use) => {
3025
+ let cleanup;
3026
+ const onCleanup = (fn2) => {
3027
+ if (cleanup !== void 0) {
3028
+ throw new Error(`onCleanup can only be called once per fixture. Define separate fixtures if you need multiple cleanup functions.`);
3029
+ }
3030
+ cleanup = fn2;
3031
+ };
3032
+ const value = await builderFn(ctx, { onCleanup });
3033
+ await use(value);
3034
+ if (cleanup) {
3035
+ await cleanup();
3036
+ }
3037
+ };
3038
+ configureProps(fixture, { original: builderFn });
3039
+ if (fixtureOptions) {
3040
+ return { [fixtureName]: [fixture, fixtureOptions] };
3041
+ }
3042
+ return { [fixtureName]: fixture };
3043
+ }
3044
+ if (fixtureOptions) {
3045
+ return { [fixtureName]: [fixtureValue, fixtureOptions] };
3046
+ }
3047
+ return { [fixtureName]: fixtureValue };
3048
+ }
3049
+ taskFn.override = function(fixturesOrName, optionsOrFn, maybeFn) {
3050
+ const userFixtures = parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn);
3051
+ (0, import_chunk_tasks.w)(this).getFixtures().override(runner, userFixtures);
3052
+ return this;
3053
+ };
2647
3054
  taskFn.scoped = function(fixtures) {
2648
- const collector = getCurrentSuite();
2649
- collector.scoped(fixtures);
3055
+ console.warn(`test.scoped() is deprecated and will be removed in future versions. Please use test.override() instead.`);
3056
+ return this.override(fixtures);
2650
3057
  };
2651
- taskFn.extend = function(fixtures) {
2652
- const _context = mergeContextFixtures(fixtures, context || {}, runner);
2653
- const originalWrapper = fn;
2654
- return createTest(function(name, optionsOrFn, optionsOrTest) {
2655
- const collector = getCurrentSuite();
2656
- const scopedFixtures = collector.fixtures();
2657
- const context2 = { ...this };
2658
- if (scopedFixtures) {
2659
- context2.fixtures = mergeScopedFixtures(context2.fixtures || [], scopedFixtures);
2660
- }
2661
- originalWrapper.call(context2, formatName(name), optionsOrFn, optionsOrTest);
2662
- }, _context);
3058
+ taskFn.extend = function(fixturesOrName, optionsOrFn, maybeFn) {
3059
+ const userFixtures = parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn);
3060
+ const fixtures = (0, import_chunk_tasks.w)(this).getFixtures().extend(runner, userFixtures);
3061
+ const _test3 = createTest(function(name, optionsOrFn2, optionsOrTest) {
3062
+ fn.call(this, formatName(name), optionsOrFn2, optionsOrTest);
3063
+ });
3064
+ (0, import_chunk_tasks.w)(_test3).mergeContext({ fixtures });
3065
+ return _test3;
2663
3066
  };
3067
+ taskFn.describe = suite;
3068
+ taskFn.suite = suite;
2664
3069
  taskFn.beforeEach = beforeEach;
2665
3070
  taskFn.afterEach = afterEach;
2666
3071
  taskFn.beforeAll = beforeAll;
2667
3072
  taskFn.afterAll = afterAll;
2668
- const _test2 = (0, import_chunk_tasks.c)([
3073
+ taskFn.aroundEach = aroundEach;
3074
+ taskFn.aroundAll = aroundAll;
3075
+ const _test2 = (0, import_chunk_tasks.a)([
2669
3076
  "concurrent",
2670
3077
  "sequential",
2671
3078
  "skip",
2672
3079
  "only",
2673
3080
  "todo",
2674
3081
  "fails"
2675
- ], taskFn);
2676
- if (context) {
2677
- _test2.mergeContext(context);
2678
- }
3082
+ ], taskFn, { fixtures: new TestFixtures() });
2679
3083
  return _test2;
2680
3084
  }
2681
- function createTest(fn, context) {
2682
- return createTaskCollector(fn, context);
3085
+ function createTest(fn) {
3086
+ return createTaskCollector(fn);
2683
3087
  }
2684
3088
  function formatName(name) {
2685
3089
  return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
@@ -2704,14 +3108,13 @@ function formatTitle(template, items, idx) {
2704
3108
  const isObjectItem = isObject(items[0]);
2705
3109
  function formatAttribute(s3) {
2706
3110
  return s3.replace(/\$([$\w.]+)/g, (_, key) => {
2707
- var _runner$config;
2708
3111
  const isArrayKey = /^\d+$/.test(key);
2709
3112
  if (!isObjectItem && !isArrayKey) {
2710
3113
  return `$${key}`;
2711
3114
  }
2712
3115
  const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
2713
3116
  const value = isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement;
2714
- return objDisplay(value, { truncate: runner === null || runner === void 0 || (_runner$config = runner.config) === null || _runner$config === void 0 || (_runner$config = _runner$config.chaiConfig) === null || _runner$config === void 0 ? void 0 : _runner$config.truncateThreshold });
3117
+ return objDisplay(value, { truncate: runner?.config?.chaiConfig?.truncateThreshold });
2715
3118
  });
2716
3119
  }
2717
3120
  let output = "";
@@ -2759,14 +3162,13 @@ function formatTemplateString(cases, args) {
2759
3162
  }
2760
3163
  return res;
2761
3164
  }
2762
- var now$2 = Date.now;
3165
+ var now$2 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
2763
3166
  var collectorContext = {
2764
3167
  tasks: [],
2765
3168
  currentSuite: null
2766
3169
  };
2767
3170
  function collectTask(task) {
2768
- var _collectorContext$cur;
2769
- (_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 ? void 0 : _collectorContext$cur.tasks.push(task);
3171
+ collectorContext.currentSuite?.tasks.push(task);
2770
3172
  }
2771
3173
  async function runWithSuite(suite2, fn) {
2772
3174
  const prev = collectorContext.currentSuite;
@@ -2785,15 +3187,14 @@ function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
2785
3187
  runner2._currentTaskStartTime = startTime;
2786
3188
  runner2._currentTaskTimeout = timeout;
2787
3189
  return new Promise((resolve_, reject_) => {
2788
- var _timer$unref;
2789
3190
  const timer = setTimeout3(() => {
2790
3191
  clearTimeout3(timer);
2791
3192
  rejectTimeoutError();
2792
3193
  }, timeout);
2793
- (_timer$unref = timer.unref) === null || _timer$unref === void 0 ? void 0 : _timer$unref.call(timer);
3194
+ timer.unref?.();
2794
3195
  function rejectTimeoutError() {
2795
3196
  const error = makeTimeoutError(isHook, timeout, stackTraceError);
2796
- onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(args, error);
3197
+ onTimeout?.(args, error);
2797
3198
  reject_(error);
2798
3199
  }
2799
3200
  function resolve(result) {
@@ -2825,6 +3226,23 @@ function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
2825
3226
  });
2826
3227
  });
2827
3228
  }
3229
+ function withCancel(fn, signal) {
3230
+ return (function runWithCancel(...args) {
3231
+ return new Promise((resolve, reject) => {
3232
+ signal.addEventListener("abort", () => reject(signal.reason));
3233
+ try {
3234
+ const result = fn(...args);
3235
+ if (typeof result === "object" && result != null && typeof result.then === "function") {
3236
+ result.then(resolve, reject);
3237
+ } else {
3238
+ resolve(result);
3239
+ }
3240
+ } catch (error) {
3241
+ reject(error);
3242
+ }
3243
+ });
3244
+ });
3245
+ }
2828
3246
  var abortControllers = /* @__PURE__ */ new WeakMap();
2829
3247
  function abortIfTimeout([context], error) {
2830
3248
  if (context) {
@@ -2833,10 +3251,9 @@ function abortIfTimeout([context], error) {
2833
3251
  }
2834
3252
  function abortContextSignal(context, error) {
2835
3253
  const abortController = abortControllers.get(context);
2836
- abortController === null || abortController === void 0 ? void 0 : abortController.abort(error);
3254
+ abortController?.abort(error);
2837
3255
  }
2838
3256
  function createTestContext(test3, runner2) {
2839
- var _runner$extendTaskCon;
2840
3257
  const context = function() {
2841
3258
  throw new Error("done() callback is deprecated, use promise instead");
2842
3259
  };
@@ -2851,7 +3268,7 @@ function createTestContext(test3, runner2) {
2851
3268
  if (condition === false) {
2852
3269
  return void 0;
2853
3270
  }
2854
- test3.result ?? (test3.result = { state: "skip" });
3271
+ test3.result ??= { state: "skip" };
2855
3272
  test3.result.pending = true;
2856
3273
  throw new PendingError("test is skipped; abort execution", test3, typeof condition === "string" ? condition : note);
2857
3274
  };
@@ -2882,32 +3299,24 @@ function createTestContext(test3, runner2) {
2882
3299
  }));
2883
3300
  });
2884
3301
  context.onTestFailed = (handler, timeout) => {
2885
- test3.onFailed || (test3.onFailed = []);
3302
+ test3.onFailed ||= [];
2886
3303
  test3.onFailed.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
2887
3304
  };
2888
3305
  context.onTestFinished = (handler, timeout) => {
2889
- test3.onFinished || (test3.onFinished = []);
3306
+ test3.onFinished ||= [];
2890
3307
  test3.onFinished.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
2891
3308
  };
2892
- return ((_runner$extendTaskCon = runner2.extendTaskContext) === null || _runner$extendTaskCon === void 0 ? void 0 : _runner$extendTaskCon.call(runner2, context)) || context;
3309
+ return runner2.extendTaskContext?.(context) || context;
2893
3310
  }
2894
3311
  function makeTimeoutError(isHook, timeout, stackTraceError) {
2895
3312
  const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
2896
3313
  If this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
2897
3314
  const error = new Error(message);
2898
- if (stackTraceError === null || stackTraceError === void 0 ? void 0 : stackTraceError.stack) {
3315
+ if (stackTraceError?.stack) {
2899
3316
  error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message);
2900
3317
  }
2901
3318
  return error;
2902
3319
  }
2903
- var fileContexts = /* @__PURE__ */ new WeakMap();
2904
- function getFileContext(file) {
2905
- const context = fileContexts.get(file);
2906
- if (!context) {
2907
- throw new Error(`Cannot find file context for ${file.name}`);
2908
- }
2909
- return context;
2910
- }
2911
3320
  var now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
2912
3321
  var now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
2913
3322
  var unixNow = Date.now;
@@ -2917,7 +3326,6 @@ var eventsPacks = [];
2917
3326
  var pendingTasksUpdates = [];
2918
3327
  function sendTasksUpdate(runner2) {
2919
3328
  if (packs.size) {
2920
- var _runner$onTaskUpdate;
2921
3329
  const taskPacks = Array.from(packs).map(([id, task]) => {
2922
3330
  return [
2923
3331
  id,
@@ -2925,7 +3333,7 @@ function sendTasksUpdate(runner2) {
2925
3333
  task[1]
2926
3334
  ];
2927
3335
  });
2928
- const p2 = (_runner$onTaskUpdate = runner2.onTaskUpdate) === null || _runner$onTaskUpdate === void 0 ? void 0 : _runner$onTaskUpdate.call(runner2, taskPacks, eventsPacks);
3336
+ const p2 = runner2.onTaskUpdate?.(taskPacks, eventsPacks);
2929
3337
  if (p2) {
2930
3338
  pendingTasksUpdates.push(p2);
2931
3339
  p2.then(() => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p2), 1), () => {
@@ -2950,15 +3358,12 @@ function throttle(fn, ms) {
2950
3358
  pendingCall = void 0;
2951
3359
  return fn.apply(this, args);
2952
3360
  }
2953
- pendingCall ?? (pendingCall = setTimeout2(() => call.bind(this)(...args), ms));
3361
+ pendingCall ??= setTimeout2(() => call.bind(this)(...args), ms);
2954
3362
  };
2955
3363
  }
2956
3364
  var sendTasksUpdateThrottled = throttle(sendTasksUpdate, 100);
2957
3365
  async function recordArtifact(task, artifact) {
2958
3366
  const runner2 = getRunner();
2959
- if (task.result && task.result.state !== "run") {
2960
- throw new Error(`Cannot record a test artifact outside of the test run. The test "${task.name}" finished running with the "${task.result.state}" state already.`);
2961
- }
2962
3367
  const stack = (0, import_chunk_tasks.f)(task.file.filepath, new Error("STACK_TRACE").stack);
2963
3368
  if (stack) {
2964
3369
  artifact.location = {
@@ -3002,28 +3407,28 @@ function encodeUint8Array(bytes) {
3002
3407
  const len = bytes.byteLength;
3003
3408
  for (let i3 = 0; i3 < len; i3 += 3) {
3004
3409
  if (len === i3 + 1) {
3005
- const a3 = (bytes[i3] & 252) >> 2;
3410
+ const a4 = (bytes[i3] & 252) >> 2;
3006
3411
  const b4 = (bytes[i3] & 3) << 4;
3007
- base64 += table[a3];
3412
+ base64 += table[a4];
3008
3413
  base64 += table[b4];
3009
3414
  base64 += "==";
3010
3415
  } else if (len === i3 + 2) {
3011
- const a3 = (bytes[i3] & 252) >> 2;
3416
+ const a4 = (bytes[i3] & 252) >> 2;
3012
3417
  const b4 = (bytes[i3] & 3) << 4 | (bytes[i3 + 1] & 240) >> 4;
3013
3418
  const c3 = (bytes[i3 + 1] & 15) << 2;
3014
- base64 += table[a3];
3419
+ base64 += table[a4];
3015
3420
  base64 += table[b4];
3016
3421
  base64 += table[c3];
3017
3422
  base64 += "=";
3018
3423
  } else {
3019
- const a3 = (bytes[i3] & 252) >> 2;
3424
+ const a4 = (bytes[i3] & 252) >> 2;
3020
3425
  const b4 = (bytes[i3] & 3) << 4 | (bytes[i3 + 1] & 240) >> 4;
3021
3426
  const c3 = (bytes[i3 + 1] & 15) << 2 | (bytes[i3 + 2] & 192) >> 6;
3022
- const d4 = bytes[i3 + 2] & 63;
3023
- base64 += table[a3];
3427
+ const d3 = bytes[i3 + 2] & 63;
3428
+ base64 += table[a4];
3024
3429
  base64 += table[b4];
3025
3430
  base64 += table[c3];
3026
- base64 += table[d4];
3431
+ base64 += table[d3];
3027
3432
  }
3028
3433
  }
3029
3434
  return base64;
@@ -3056,15 +3461,16 @@ function manageArtifactAttachment(attachment) {
3056
3461
  }
3057
3462
  }
3058
3463
 
3059
- // ../../node_modules/.pnpm/vitest@4.0.18_@opentelemetry+api@1.9.0_@types+node@25.3.0_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
3060
- var import_utils_DvEY5TfP = require("./chunks/utils.DvEY5TfP.js.cjs");
3464
+ // ../../node_modules/.pnpm/vitest@4.1.0_@opentelemetry+api@1.9.0_@types+node@25.3.0_vite@7.3.1_@types+node@25.3.0__1256cd9683254972294f67b42fe9fd18/node_modules/vitest/dist/index.js
3465
+ var import_utils_BX5Fg8C4 = require("./chunks/utils.BX5Fg8C4.js.cjs");
3061
3466
 
3062
- // ../../node_modules/.pnpm/@vitest+runner@4.0.18/node_modules/@vitest/runner/dist/utils.js
3467
+ // ../../node_modules/.pnpm/@vitest+runner@4.1.0/node_modules/@vitest/runner/dist/utils.js
3063
3468
  var import_chunk_tasks2 = require("./chunk-tasks.js.cjs");
3064
3469
 
3065
- // ../../node_modules/.pnpm/vitest@4.0.18_@opentelemetry+api@1.9.0_@types+node@25.3.0_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
3470
+ // ../../node_modules/.pnpm/vitest@4.1.0_@opentelemetry+api@1.9.0_@types+node@25.3.0_vite@7.3.1_@types+node@25.3.0__1256cd9683254972294f67b42fe9fd18/node_modules/vitest/dist/index.js
3066
3471
  var import_commonjsHelpers_D26ty3Ew = require("./chunks/_commonjsHelpers.D26ty3Ew.js.cjs");
3067
- var import_date_Bq6ZW5rf = require("./chunks/date.Bq6ZW5rf.js.cjs");
3472
+ var import_rpc_MzXet3jl = require("./chunks/rpc.MzXet3jl.js.cjs");
3473
+ var import_index_Chj8NDwU = require("./chunks/index.Chj8NDwU.js.cjs");
3068
3474
 
3069
3475
  // ../../node_modules/.pnpm/vite@7.3.1_@types+node@25.3.0_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vite/dist/node/module-runner.js
3070
3476
  var SOURCEMAPPING_URL = "sourceMa";
@@ -3124,11 +3530,11 @@ describe("redis session crud", () => {
3124
3530
  session.setAttribute(import_common.PRINCIPAL_NAME_INDEX_NAME, principalName);
3125
3531
  await repository.save(session);
3126
3532
  const foundSession = await repository.findById(sessionId);
3127
- (0, import_vi_2VT5v0um.g)(foundSession?.getAttribute(import_common.PRINCIPAL_NAME_INDEX_NAME)).toBe(principalName);
3533
+ (0, import_test_CTcmp4Su.g)(foundSession?.getAttribute(import_common.PRINCIPAL_NAME_INDEX_NAME)).toBe(principalName);
3128
3534
  });
3129
3535
  test2("should find a session by principal name", async () => {
3130
3536
  const sessions = await repository.findByPrincipalName(principalName);
3131
- (0, import_vi_2VT5v0um.g)(sessions.size).toBeGreaterThan(0);
3537
+ (0, import_test_CTcmp4Su.g)(sessions.size).toBeGreaterThan(0);
3132
3538
  });
3133
3539
  test2("should delete a session by id", async () => {
3134
3540
  const sessions = await repository.findByPrincipalName(principalName);
@@ -3136,7 +3542,7 @@ describe("redis session crud", () => {
3136
3542
  const sessionId = session.getId();
3137
3543
  await repository.deleteById(sessionId);
3138
3544
  const foundSession = await repository.findById(sessionId);
3139
- (0, import_vi_2VT5v0um.g)(foundSession).toBeNull();
3545
+ (0, import_test_CTcmp4Su.g)(foundSession).toBeNull();
3140
3546
  }
3141
3547
  });
3142
3548
  });
@@ -3147,12 +3553,12 @@ describe("redis session attributes", () => {
3147
3553
  const sessionId = session.getId();
3148
3554
  await repository.save(session);
3149
3555
  const foundSession = await repository.findById(sessionId);
3150
- (0, import_vi_2VT5v0um.g)(foundSession).not.toBeNull();
3151
- (0, import_vi_2VT5v0um.g)(foundSession?.getAttribute("test_key")).toBe("test_value");
3556
+ (0, import_test_CTcmp4Su.g)(foundSession).not.toBeNull();
3557
+ (0, import_test_CTcmp4Su.g)(foundSession?.getAttribute("test_key")).toBe("test_value");
3152
3558
  foundSession?.removeAttribute("test_key");
3153
3559
  if (foundSession) await repository.save(foundSession);
3154
3560
  const foundSession2 = await repository.findById(sessionId);
3155
- (0, import_vi_2VT5v0um.g)(foundSession2?.getAttribute("test_key")).toBeNull();
3561
+ (0, import_test_CTcmp4Su.g)(foundSession2?.getAttribute("test_key")).toBeNull();
3156
3562
  });
3157
3563
  test2("should change session id", async () => {
3158
3564
  const session = repository.createSession();
@@ -3161,14 +3567,14 @@ describe("redis session attributes", () => {
3161
3567
  const oldSessionId = session.getId();
3162
3568
  await repository.save(session);
3163
3569
  const oldSession = await repository.findById(oldSessionId);
3164
- (0, import_vi_2VT5v0um.g)(oldSession).not.toBeNull();
3570
+ (0, import_test_CTcmp4Su.g)(oldSession).not.toBeNull();
3165
3571
  if (!oldSession) throw new Error("Not found session id");
3166
3572
  const newSessionId = oldSession.changeSessionId();
3167
3573
  await repository.save(oldSession);
3168
3574
  const foundSession1 = await repository.findById(oldSessionId);
3169
- (0, import_vi_2VT5v0um.g)(foundSession1).toBeNull();
3575
+ (0, import_test_CTcmp4Su.g)(foundSession1).toBeNull();
3170
3576
  const foundSession2 = await repository.findById(newSessionId);
3171
- (0, import_vi_2VT5v0um.g)(foundSession2).not.toBeNull();
3577
+ (0, import_test_CTcmp4Su.g)(foundSession2).not.toBeNull();
3172
3578
  });
3173
3579
  });
3174
3580
  describe("redis session config", () => {
@@ -3176,8 +3582,8 @@ describe("redis session config", () => {
3176
3582
  repository.setDefaultMaxInactiveInterval(maxInactiveInterval);
3177
3583
  test2("should set default max inactive interval", () => {
3178
3584
  const session = repository.createSession();
3179
- (0, import_vi_2VT5v0um.g)(session.isExpired()).toBe(false);
3180
- (0, import_vi_2VT5v0um.g)(session.getMaxInactiveInterval()).toBe(maxInactiveInterval);
3585
+ (0, import_test_CTcmp4Su.g)(session.isExpired()).toBe(false);
3586
+ (0, import_test_CTcmp4Su.g)(session.getMaxInactiveInterval()).toBe(maxInactiveInterval);
3181
3587
  });
3182
3588
  });
3183
3589
  /*! Bundled license information: