vitest 0.14.2 → 0.15.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.
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-utils.b9738a10.mjs';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.1bbdb2c1.mjs';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,11 +9,11 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import url from 'url';
12
- import { A as API_PATH } from './chunk-constants.da1921b9.mjs';
13
- import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.790e5c11.mjs';
12
+ import { A as API_PATH } from './chunk-constants.7b9cfc82.mjs';
13
+ import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.2556cba8.mjs';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-utils-global.2684ee9f.mjs';
16
+ import './chunk-utils-global.79a8b1cc.mjs';
17
17
  import 'tty';
18
18
  import 'local-pkg';
19
19
  import 'path';
@@ -126,6 +126,9 @@ var constants = {
126
126
  NOOP: () => {}
127
127
  };
128
128
 
129
+ var unmask$1;
130
+ var mask;
131
+
129
132
  const { EMPTY_BUFFER: EMPTY_BUFFER$3 } = constants;
130
133
 
131
134
  /**
@@ -225,30 +228,31 @@ function toBuffer$2(data) {
225
228
  return buf;
226
229
  }
227
230
 
228
- try {
229
- const bufferUtil = require('bufferutil');
231
+ bufferUtil$1.exports = {
232
+ concat: concat$1,
233
+ mask: _mask,
234
+ toArrayBuffer: toArrayBuffer$1,
235
+ toBuffer: toBuffer$2,
236
+ unmask: _unmask
237
+ };
238
+
239
+ /* istanbul ignore else */
240
+ if (!process.env.WS_NO_BUFFER_UTIL) {
241
+ try {
242
+ const bufferUtil = require('bufferutil');
230
243
 
231
- bufferUtil$1.exports = {
232
- concat: concat$1,
233
- mask(source, mask, output, offset, length) {
244
+ mask = bufferUtil$1.exports.mask = function (source, mask, output, offset, length) {
234
245
  if (length < 48) _mask(source, mask, output, offset, length);
235
246
  else bufferUtil.mask(source, mask, output, offset, length);
236
- },
237
- toArrayBuffer: toArrayBuffer$1,
238
- toBuffer: toBuffer$2,
239
- unmask(buffer, mask) {
247
+ };
248
+
249
+ unmask$1 = bufferUtil$1.exports.unmask = function (buffer, mask) {
240
250
  if (buffer.length < 32) _unmask(buffer, mask);
241
251
  else bufferUtil.unmask(buffer, mask);
242
- }
243
- };
244
- } catch (e) /* istanbul ignore next */ {
245
- bufferUtil$1.exports = {
246
- concat: concat$1,
247
- mask: _mask,
248
- toArrayBuffer: toArrayBuffer$1,
249
- toBuffer: toBuffer$2,
250
- unmask: _unmask
251
- };
252
+ };
253
+ } catch (e) {
254
+ // Continue regardless of the error.
255
+ }
252
256
  }
253
257
 
254
258
  const kDone = Symbol('kDone');
@@ -817,6 +821,8 @@ function inflateOnError(err) {
817
821
 
818
822
  var validation = {exports: {}};
819
823
 
824
+ var isValidUTF8_1;
825
+
820
826
  //
821
827
  // Allowed token characters:
822
828
  //
@@ -922,22 +928,23 @@ function _isValidUTF8(buf) {
922
928
  return true;
923
929
  }
924
930
 
925
- try {
926
- const isValidUTF8 = require('utf-8-validate');
931
+ validation.exports = {
932
+ isValidStatusCode: isValidStatusCode$2,
933
+ isValidUTF8: _isValidUTF8,
934
+ tokenChars: tokenChars$2
935
+ };
927
936
 
928
- validation.exports = {
929
- isValidStatusCode: isValidStatusCode$2,
930
- isValidUTF8(buf) {
937
+ /* istanbul ignore else */
938
+ if (!process.env.WS_NO_UTF_8_VALIDATE) {
939
+ try {
940
+ const isValidUTF8 = require('utf-8-validate');
941
+
942
+ isValidUTF8_1 = validation.exports.isValidUTF8 = function (buf) {
931
943
  return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf);
932
- },
933
- tokenChars: tokenChars$2
934
- };
935
- } catch (e) /* istanbul ignore next */ {
936
- validation.exports = {
937
- isValidStatusCode: isValidStatusCode$2,
938
- isValidUTF8: _isValidUTF8,
939
- tokenChars: tokenChars$2
940
- };
944
+ };
945
+ } catch (e) {
946
+ // Continue regardless of the error.
947
+ }
941
948
  }
942
949
 
943
950
  const { Writable } = require$$0$1;
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { l as resolve } from './chunk-utils-global.2684ee9f.mjs';
2
+ import { m as resolve } from './chunk-utils-global.79a8b1cc.mjs';
3
3
 
4
4
  const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
5
5
  const defaultPort = 51204;
@@ -1,7 +1,142 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import { pathToFileURL } from 'url';
4
- import { t as toArray, l as resolve } from './chunk-utils-global.2684ee9f.mjs';
4
+ import { C as toArray, m as resolve } from './chunk-utils-global.79a8b1cc.mjs';
5
+
6
+ /*
7
+ How it works:
8
+ `this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
9
+ */
10
+
11
+ class Node {
12
+ value;
13
+ next;
14
+
15
+ constructor(value) {
16
+ this.value = value;
17
+ }
18
+ }
19
+
20
+ class Queue {
21
+ #head;
22
+ #tail;
23
+ #size;
24
+
25
+ constructor() {
26
+ this.clear();
27
+ }
28
+
29
+ enqueue(value) {
30
+ const node = new Node(value);
31
+
32
+ if (this.#head) {
33
+ this.#tail.next = node;
34
+ this.#tail = node;
35
+ } else {
36
+ this.#head = node;
37
+ this.#tail = node;
38
+ }
39
+
40
+ this.#size++;
41
+ }
42
+
43
+ dequeue() {
44
+ const current = this.#head;
45
+ if (!current) {
46
+ return;
47
+ }
48
+
49
+ this.#head = this.#head.next;
50
+ this.#size--;
51
+ return current.value;
52
+ }
53
+
54
+ clear() {
55
+ this.#head = undefined;
56
+ this.#tail = undefined;
57
+ this.#size = 0;
58
+ }
59
+
60
+ get size() {
61
+ return this.#size;
62
+ }
63
+
64
+ * [Symbol.iterator]() {
65
+ let current = this.#head;
66
+
67
+ while (current) {
68
+ yield current.value;
69
+ current = current.next;
70
+ }
71
+ }
72
+ }
73
+
74
+ function pLimit(concurrency) {
75
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
76
+ throw new TypeError('Expected `concurrency` to be a number from 1 and up');
77
+ }
78
+
79
+ const queue = new Queue();
80
+ let activeCount = 0;
81
+
82
+ const next = () => {
83
+ activeCount--;
84
+
85
+ if (queue.size > 0) {
86
+ queue.dequeue()();
87
+ }
88
+ };
89
+
90
+ const run = async (fn, resolve, args) => {
91
+ activeCount++;
92
+
93
+ const result = (async () => fn(...args))();
94
+
95
+ resolve(result);
96
+
97
+ try {
98
+ await result;
99
+ } catch {}
100
+
101
+ next();
102
+ };
103
+
104
+ const enqueue = (fn, resolve, args) => {
105
+ queue.enqueue(run.bind(undefined, fn, resolve, args));
106
+
107
+ (async () => {
108
+ // This function needs to wait until the next microtask before comparing
109
+ // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
110
+ // when the run function is dequeued and called. The comparison in the if-statement
111
+ // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
112
+ await Promise.resolve();
113
+
114
+ if (activeCount < concurrency && queue.size > 0) {
115
+ queue.dequeue()();
116
+ }
117
+ })();
118
+ };
119
+
120
+ const generator = (fn, ...args) => new Promise(resolve => {
121
+ enqueue(fn, resolve, args);
122
+ });
123
+
124
+ Object.defineProperties(generator, {
125
+ activeCount: {
126
+ get: () => activeCount,
127
+ },
128
+ pendingCount: {
129
+ get: () => queue.size,
130
+ },
131
+ clearQueue: {
132
+ value: () => {
133
+ queue.clear();
134
+ },
135
+ },
136
+ });
137
+
138
+ return generator;
139
+ }
5
140
 
6
141
  const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
7
142
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
@@ -64,8 +199,12 @@ const config = {
64
199
  ui: false,
65
200
  uiBase: "/__vitest__/",
66
201
  open: true,
202
+ css: {
203
+ include: [/\.module\./]
204
+ },
67
205
  coverage: coverageConfigDefaults,
68
- fakeTimers: fakeTimersDefaults
206
+ fakeTimers: fakeTimersDefaults,
207
+ maxConcurrency: 5
69
208
  };
70
209
  const configDefaults = Object.freeze(config);
71
210
 
@@ -160,4 +299,4 @@ async function reportCoverage(ctx) {
160
299
  }
161
300
  }
162
301
 
163
- export { cleanCoverage as a, reportCoverage as b, configDefaults as c, resolveC8Options as r, takeCoverage as t };
302
+ export { cleanCoverage as a, reportCoverage as b, configDefaults as c, pLimit as p, resolveC8Options as r, takeCoverage as t };
@@ -1,20 +1,20 @@
1
- import { g as globalApis } from './chunk-constants.da1921b9.mjs';
2
- import { i as index } from './vendor-entry.ba490394.mjs';
1
+ import { g as globalApis } from './chunk-constants.7b9cfc82.mjs';
2
+ import { i as index } from './vendor-entry.efeeaa5c.mjs';
3
3
  import 'url';
4
- import './chunk-utils-global.2684ee9f.mjs';
4
+ import './chunk-utils-global.79a8b1cc.mjs';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
8
  import 'fs';
9
- import './chunk-runtime-chain.52571387.mjs';
9
+ import './chunk-runtime-chain.7103058b.mjs';
10
10
  import 'chai';
11
11
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
12
- import './chunk-runtime-rpc.bcd3613c.mjs';
13
- import './chunk-utils-source-map.790e5c11.mjs';
12
+ import './chunk-runtime-rpc.5e78af38.mjs';
13
+ import './chunk-utils-source-map.2556cba8.mjs';
14
14
  import './chunk-integrations-spy.674b628e.mjs';
15
15
  import 'tinyspy';
16
16
  import 'util';
17
- import './chunk-defaults.45dc5e3d.mjs';
17
+ import './chunk-defaults.dc6dc23d.mjs';
18
18
  import 'module';
19
19
 
20
20
  function registerApiGlobally() {
@@ -1,9 +1,9 @@
1
- import chai$1, { expect as expect$1, AssertionError, util } from 'chai';
1
+ import chai$1, { expect, AssertionError, util } from 'chai';
2
2
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
3
- import { r as rpc } from './chunk-runtime-rpc.bcd3613c.mjs';
4
- import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, e as safeSetTimeout, f as safeClearTimeout, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.2684ee9f.mjs';
3
+ import { r as rpc } from './chunk-runtime-rpc.5e78af38.mjs';
4
+ import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, e as getFullName, f as safeSetTimeout, h as safeClearTimeout, n as noop, r as resetModules } from './chunk-utils-global.79a8b1cc.mjs';
5
5
  import fs, { promises } from 'fs';
6
- import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.790e5c11.mjs';
6
+ import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.2556cba8.mjs';
7
7
  import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.674b628e.mjs';
8
8
  import require$$0, { format } from 'util';
9
9
 
@@ -737,7 +737,7 @@ class SnapshotState {
737
737
  this._uncheckedKeys.delete(uncheckedKey);
738
738
  });
739
739
  }
740
- _getInlineSnapshotStack(stacks) {
740
+ _inferInlineSnapshotStack(stacks) {
741
741
  const promiseIndex = stacks.findIndex((i) => i.method.match(/__VITEST_(RESOLVES|REJECTS)__/));
742
742
  if (promiseIndex !== -1)
743
743
  return stacks[promiseIndex + 3];
@@ -750,11 +750,12 @@ class SnapshotState {
750
750
  const error = options.error || new Error("Unknown error");
751
751
  const stacks = parseStacktrace(error, true);
752
752
  stacks.forEach((i) => i.file = slash(i.file));
753
- const stack = this._getInlineSnapshotStack(stacks);
753
+ const stack = this._inferInlineSnapshotStack(stacks);
754
754
  if (!stack) {
755
755
  throw new Error(`Vitest: Couldn't infer stack frame for inline snapshot.
756
756
  ${JSON.stringify(stacks)}`);
757
757
  }
758
+ stack.column--;
758
759
  this._inlineSnapshots.push(__spreadValues$3({
759
760
  snapshot: receivedSerialized
760
761
  }, stack));
@@ -921,6 +922,10 @@ class SnapshotClient {
921
922
  clearTest() {
922
923
  this.test = void 0;
923
924
  }
925
+ skipTestSnapshots(test) {
926
+ var _a;
927
+ (_a = this.snapshotState) == null ? void 0 : _a.markSnapshotsAsCheckedForTest(test.name);
928
+ }
924
929
  assert(options) {
925
930
  const {
926
931
  test = this.test,
@@ -940,7 +945,7 @@ class SnapshotClient {
940
945
  try {
941
946
  const pass2 = equals(received, properties, [iterableEquality, subsetEquality]);
942
947
  if (!pass2)
943
- expect$1(received).equals(properties);
948
+ expect(received).equals(properties);
944
949
  else
945
950
  received = deepMergeSnapshot(received, properties);
946
951
  } catch (err) {
@@ -962,7 +967,7 @@ class SnapshotClient {
962
967
  });
963
968
  if (!pass) {
964
969
  try {
965
- expect$1(actual.trim()).equals(expected ? expected.trim() : "");
970
+ expect(actual.trim()).equals(expected ? expected.trim() : "");
966
971
  } catch (error2) {
967
972
  error2.message = errorMessage || `Snapshot \`${key || "unknown"}\` mismatched`;
968
973
  throw error2;
@@ -1068,24 +1073,20 @@ const SnapshotPlugin = (chai, utils) => {
1068
1073
  });
1069
1074
  };
1070
1075
 
1076
+ const GLOBAL_EXPECT = Symbol.for("expect-global");
1071
1077
  const MATCHERS_OBJECT = Symbol.for("matchers-object");
1072
- if (!Object.prototype.hasOwnProperty.call(global, MATCHERS_OBJECT)) {
1073
- const defaultState = {
1074
- assertionCalls: 0,
1075
- isExpectingAssertions: false,
1076
- isExpectingAssertionsError: null,
1077
- expectedAssertionsNumber: null,
1078
- expectedAssertionsNumberErrorGen: null
1079
- };
1078
+
1079
+ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
1080
1080
  Object.defineProperty(globalThis, MATCHERS_OBJECT, {
1081
- value: {
1082
- state: defaultState
1083
- }
1081
+ value: /* @__PURE__ */ new WeakMap()
1084
1082
  });
1085
1083
  }
1086
- const getState = () => globalThis[MATCHERS_OBJECT].state;
1087
- const setState = (state) => {
1088
- Object.assign(globalThis[MATCHERS_OBJECT].state, state);
1084
+ const getState = (expect) => globalThis[MATCHERS_OBJECT].get(expect);
1085
+ const setState = (state, expect) => {
1086
+ const map = globalThis[MATCHERS_OBJECT];
1087
+ const current = map.get(expect) || {};
1088
+ Object.assign(current, state);
1089
+ map.set(expect, current);
1089
1090
  };
1090
1091
  const JestChaiExpect = (chai, utils) => {
1091
1092
  function def(name, fn) {
@@ -1489,24 +1490,6 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1489
1490
  });
1490
1491
  return proxy;
1491
1492
  });
1492
- utils.addMethod(chai.expect, "assertions", function assertions(expected) {
1493
- const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${getState().assertionCalls}`);
1494
- if (Error.captureStackTrace)
1495
- Error.captureStackTrace(errorGen(), assertions);
1496
- setState({
1497
- expectedAssertionsNumber: expected,
1498
- expectedAssertionsNumberErrorGen: errorGen
1499
- });
1500
- });
1501
- utils.addMethod(chai.expect, "hasAssertions", function hasAssertions() {
1502
- const error = new Error("expected any number of assertion, but got none");
1503
- if (Error.captureStackTrace)
1504
- Error.captureStackTrace(error, hasAssertions);
1505
- setState({
1506
- isExpectingAssertions: true,
1507
- isExpectingAssertionsError: error
1508
- });
1509
- });
1510
1493
  utils.addMethod(chai.expect, "addSnapshotSerializer", addSerializer);
1511
1494
  };
1512
1495
  function toString(value) {
@@ -1542,8 +1525,8 @@ class AsymmetricMatcher {
1542
1525
  this.inverse = inverse;
1543
1526
  this.$$typeof = Symbol.for("jest.asymmetricMatcher");
1544
1527
  }
1545
- getMatcherContext() {
1546
- return __spreadProps$1(__spreadValues$2({}, getState()), {
1528
+ getMatcherContext(expect) {
1529
+ return __spreadProps$1(__spreadValues$2({}, getState(expect || globalThis[GLOBAL_EXPECT])), {
1547
1530
  equals,
1548
1531
  isNot: this.inverse,
1549
1532
  utils: matcherUtils
@@ -1737,7 +1720,7 @@ var __spreadValues$1 = (a, b) => {
1737
1720
  };
1738
1721
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1739
1722
  const isAsyncFunction = (fn) => typeof fn === "function" && fn[Symbol.toStringTag] === "AsyncFunction";
1740
- const getMatcherState = (assertion) => {
1723
+ const getMatcherState = (assertion, expect) => {
1741
1724
  const obj = assertion._obj;
1742
1725
  const isNot = util.flag(assertion, "negate");
1743
1726
  const promise = util.flag(assertion, "promise") || "";
@@ -1745,7 +1728,7 @@ const getMatcherState = (assertion) => {
1745
1728
  iterableEquality,
1746
1729
  subsetEquality
1747
1730
  });
1748
- const matcherState = __spreadProps(__spreadValues$1({}, getState()), {
1731
+ const matcherState = __spreadProps(__spreadValues$1({}, getState(expect)), {
1749
1732
  isNot,
1750
1733
  utils: jestUtils,
1751
1734
  promise,
@@ -1770,13 +1753,13 @@ function JestExtendPlugin(expect, matchers) {
1770
1753
  return (c, utils) => {
1771
1754
  Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
1772
1755
  function expectSyncWrapper(...args) {
1773
- const { state, isNot, obj } = getMatcherState(this);
1756
+ const { state, isNot, obj } = getMatcherState(this, expect);
1774
1757
  const { pass, message, actual, expected } = expectAssertion.call(state, obj, ...args);
1775
1758
  if (pass && isNot || !pass && !isNot)
1776
1759
  throw new JestExtendError(message(), actual, expected);
1777
1760
  }
1778
1761
  async function expectAsyncWrapper(...args) {
1779
- const { state, isNot, obj } = getMatcherState(this);
1762
+ const { state, isNot, obj } = getMatcherState(this, expect);
1780
1763
  const { pass, message, actual, expected } = await expectAssertion.call(state, obj, ...args);
1781
1764
  if (pass && isNot || !pass && !isNot)
1782
1765
  throw new JestExtendError(message(), actual, expected);
@@ -1788,7 +1771,7 @@ function JestExtendPlugin(expect, matchers) {
1788
1771
  super(sample, inverse);
1789
1772
  }
1790
1773
  asymmetricMatch(other) {
1791
- const { pass } = expectAssertion.call(this.getMatcherContext(), other, ...this.sample);
1774
+ const { pass } = expectAssertion.call(this.getMatcherContext(expect), other, ...this.sample);
1792
1775
  return this.inverse ? !pass : pass;
1793
1776
  }
1794
1777
  toString() {
@@ -1829,22 +1812,57 @@ chai$1.use(SnapshotPlugin);
1829
1812
  chai$1.use(JestAsymmetricMatchers);
1830
1813
 
1831
1814
  function createExpect(test) {
1832
- const expect2 = (value, message) => {
1833
- const { assertionCalls } = getState();
1834
- setState({ assertionCalls: assertionCalls + 1 });
1815
+ var _a;
1816
+ const expect = (value, message) => {
1817
+ const { assertionCalls } = getState(expect);
1818
+ setState({ assertionCalls: assertionCalls + 1 }, expect);
1835
1819
  const assert2 = chai$1.expect(value, message);
1836
1820
  if (test)
1837
1821
  return assert2.withTest(test);
1838
1822
  else
1839
1823
  return assert2;
1840
1824
  };
1841
- Object.assign(expect2, chai$1.expect);
1842
- expect2.getState = getState;
1843
- expect2.setState = setState;
1844
- expect2.extend = (matchers) => chai$1.expect.extend(expect2, matchers);
1845
- return expect2;
1825
+ Object.assign(expect, chai$1.expect);
1826
+ expect.getState = () => getState(expect);
1827
+ expect.setState = (state) => setState(state, expect);
1828
+ setState({
1829
+ assertionCalls: 0,
1830
+ isExpectingAssertions: false,
1831
+ isExpectingAssertionsError: null,
1832
+ expectedAssertionsNumber: null,
1833
+ expectedAssertionsNumberErrorGen: null,
1834
+ testPath: (_a = test == null ? void 0 : test.suite.file) == null ? void 0 : _a.filepath,
1835
+ currentTestName: test ? getFullName(test) : void 0
1836
+ }, expect);
1837
+ expect.extend = (matchers) => chai$1.expect.extend(expect, matchers);
1838
+ function assertions(expected) {
1839
+ const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
1840
+ if (Error.captureStackTrace)
1841
+ Error.captureStackTrace(errorGen(), assertions);
1842
+ expect.setState({
1843
+ expectedAssertionsNumber: expected,
1844
+ expectedAssertionsNumberErrorGen: errorGen
1845
+ });
1846
+ }
1847
+ function hasAssertions() {
1848
+ const error = new Error("expected any number of assertion, but got none");
1849
+ if (Error.captureStackTrace)
1850
+ Error.captureStackTrace(error, hasAssertions);
1851
+ expect.setState({
1852
+ isExpectingAssertions: true,
1853
+ isExpectingAssertionsError: error
1854
+ });
1855
+ }
1856
+ util.addMethod(expect, "assertions", assertions);
1857
+ util.addMethod(expect, "hasAssertions", hasAssertions);
1858
+ return expect;
1846
1859
  }
1847
- const expect = createExpect();
1860
+ const globalExpect = createExpect();
1861
+ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
1862
+ value: globalExpect,
1863
+ writable: true,
1864
+ configurable: true
1865
+ });
1848
1866
 
1849
1867
  const collectorContext = {
1850
1868
  tasks: [],
@@ -1893,6 +1911,11 @@ function createTestContext(test) {
1893
1911
  return _expect;
1894
1912
  }
1895
1913
  });
1914
+ Object.defineProperty(context, "_local", {
1915
+ get() {
1916
+ return _expect != null;
1917
+ }
1918
+ });
1896
1919
  return context;
1897
1920
  }
1898
1921
  function makeTimeoutMsg(isHook, timeout) {
@@ -2032,7 +2055,7 @@ function createSuite() {
2032
2055
  suite2.each = (cases) => {
2033
2056
  return (name, fn) => {
2034
2057
  cases.forEach((i, idx) => {
2035
- const items = toArray(i);
2058
+ const items = Array.isArray(i) ? i : [i];
2036
2059
  suite2(formatTitle(name, items, idx), () => fn(...items));
2037
2060
  });
2038
2061
  };
@@ -2046,7 +2069,7 @@ function createTest(fn) {
2046
2069
  test2.each = (cases) => {
2047
2070
  return (name, fn2) => {
2048
2071
  cases.forEach((i, idx) => {
2049
- const items = toArray(i);
2072
+ const items = Array.isArray(i) ? i : [i];
2050
2073
  test2(formatTitle(name, items, idx), () => fn2(...items));
2051
2074
  });
2052
2075
  };
@@ -2113,7 +2136,7 @@ if (typeof commonjsGlobal !== "undefined") {
2113
2136
  globalObject$1 = self;
2114
2137
  }
2115
2138
 
2116
- var global$1 = globalObject$1;
2139
+ var global = globalObject$1;
2117
2140
 
2118
2141
  var call = Function.call;
2119
2142
 
@@ -2821,7 +2844,7 @@ function valueToString(value) {
2821
2844
  var valueToString_1 = valueToString;
2822
2845
 
2823
2846
  var lib = {
2824
- global: global$1,
2847
+ global: global,
2825
2848
  calledInOrder: calledInOrder_1,
2826
2849
  className: className_1,
2827
2850
  deprecated: deprecated,
@@ -4591,7 +4614,11 @@ function withGlobal(_global) {
4591
4614
  /* eslint-enable complexity */
4592
4615
 
4593
4616
  /** @type {FakeTimers} */
4594
- withGlobal(globalObject);
4617
+ const defaultImplementation = withGlobal(globalObject);
4618
+
4619
+ defaultImplementation.timers;
4620
+ defaultImplementation.createClock;
4621
+ defaultImplementation.install;
4595
4622
  var withGlobal_1 = withGlobal;
4596
4623
 
4597
4624
  const RealDate = Date;
@@ -4905,4 +4932,4 @@ function isWatchMode() {
4905
4932
  return getRunningMode() === "watch";
4906
4933
  }
4907
4934
 
4908
- export { getState as A, RealDate as R, isFirstRun as a, beforeAll as b, afterAll as c, describe as d, beforeEach as e, afterEach as f, createExpect as g, expect as h, it as i, vi as j, getRunningMode as k, isWatchMode as l, resetRunOnceCounter as m, clearCollectorContext as n, defaultSuite as o, setHooks as p, getHooks as q, runOnce as r, suite as s, test as t, collectorContext as u, vitest as v, withCallback as w, getSnapshotClient as x, setState as y, getFn as z };
4935
+ export { getState as A, GLOBAL_EXPECT as G, RealDate as R, isFirstRun as a, beforeAll as b, afterAll as c, describe as d, beforeEach as e, afterEach as f, createExpect as g, globalExpect as h, it as i, vi as j, getRunningMode as k, isWatchMode as l, resetRunOnceCounter as m, clearCollectorContext as n, defaultSuite as o, setHooks as p, getHooks as q, runOnce as r, suite as s, test as t, collectorContext as u, vitest as v, withCallback as w, getSnapshotClient as x, setState as y, getFn as z };
@@ -1,8 +1,8 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.b9738a10.mjs';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.1bbdb2c1.mjs';
2
2
  import { normalizePath } from 'vite';
3
- import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, l as resolve, k as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.2684ee9f.mjs';
3
+ import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, m as resolve, l as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.79a8b1cc.mjs';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { d as distDir } from './chunk-constants.da1921b9.mjs';
5
+ import { d as distDir } from './chunk-constants.7b9cfc82.mjs';
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -1,4 +1,4 @@
1
- import { a as getWorkerState, w as withSafeTimers } from './chunk-utils-global.2684ee9f.mjs';
1
+ import { a as getWorkerState, w as withSafeTimers } from './chunk-utils-global.79a8b1cc.mjs';
2
2
 
3
3
  const rpc = () => {
4
4
  const { rpc: rpc2 } = getWorkerState();
@@ -510,4 +510,4 @@ class AggregateErrorPonyfill extends Error {
510
510
  }
511
511
  }
512
512
 
513
- export { AggregateErrorPonyfill as A, safeSetInterval as B, safeClearInterval as C, normalize as D, deepMerge as E, toNamespacedPath as F, ensurePackageInstalled as G, stdout as H, extname as I, isWindows as J, mergeSlashes as K, getType as L, getAllProperties as M, deepClone as N, partitionSuiteChildren as O, hasTests as P, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, safeSetTimeout as e, safeClearTimeout as f, getCallLastIndex as g, notNullish as h, isObject as i, join as j, basename as k, resolve as l, isAbsolute as m, noop as n, relative as o, picocolors as p, isNode as q, resetModules as r, slash as s, toArray as t, getTests as u, getFullName as v, withSafeTimers as w, hasFailed as x, hasFailedSnapshot as y, getSuites as z };
513
+ export { AggregateErrorPonyfill as A, safeClearInterval as B, toArray as C, normalize as D, deepMerge as E, toNamespacedPath as F, ensurePackageInstalled as G, stdout as H, extname as I, isWindows as J, mergeSlashes as K, getType as L, getAllProperties as M, deepClone as N, partitionSuiteChildren as O, hasTests as P, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, safeSetTimeout as f, getCallLastIndex as g, safeClearTimeout as h, isObject as i, join as j, notNullish as k, basename as l, resolve as m, noop as n, isAbsolute as o, picocolors as p, relative as q, resetModules as r, slash as s, isNode as t, getTests as u, hasFailed as v, withSafeTimers as w, hasFailedSnapshot as x, getSuites as y, safeSetInterval as z };
@@ -1,4 +1,4 @@
1
- import { s as slash, h as notNullish, p as picocolors } from './chunk-utils-global.2684ee9f.mjs';
1
+ import { s as slash, k as notNullish, p as picocolors } from './chunk-utils-global.79a8b1cc.mjs';
2
2
 
3
3
  var build = {};
4
4