vitest 0.9.4 → 0.10.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.
Files changed (31) hide show
  1. package/LICENSE.md +7 -0
  2. package/dist/{chunk-api-setup.49283db8.js → chunk-api-setup.b55307fb.js} +41 -18
  3. package/dist/{chunk-constants.c8f1d38c.js → chunk-constants.90075174.js} +1 -1
  4. package/dist/{chunk-defaults.43e746f3.js → chunk-defaults.fd5b939d.js} +1 -1
  5. package/dist/{chunk-install-pkg.cbf3a38b.js → chunk-install-pkg.73b84ae1.js} +113 -115
  6. package/dist/chunk-integrations-globals.16d9702f.js +29 -0
  7. package/dist/chunk-integrations-spy.f036df6f.js +102 -0
  8. package/dist/{chunk-runtime-chain.701cffd8.js → chunk-runtime-chain.6292a3de.js} +941 -901
  9. package/dist/{chunk-runtime-mocker.e802beae.js → chunk-runtime-mocker.ca5ecf98.js} +5 -21
  10. package/dist/{chunk-runtime-rpc.c47f2233.js → chunk-runtime-rpc.8e14ae4f.js} +1 -1
  11. package/dist/{chunk-utils-global.a3293dce.js → chunk-utils-global.9b434e81.js} +42 -10
  12. package/dist/{chunk-utils-timers.b26e7c5c.js → chunk-utils-timers.c50fec92.js} +1406 -1057
  13. package/dist/{chunk-vite-node-externalize.1c19fc5e.js → chunk-vite-node-externalize.4255f25f.js} +661 -548
  14. package/dist/{chunk-vite-node-utils.b4debb0b.js → chunk-vite-node-utils.c160b239.js} +73 -71
  15. package/dist/cli.js +12 -12
  16. package/dist/entry.js +15 -919
  17. package/dist/index.d.ts +112 -31
  18. package/dist/index.js +8 -8
  19. package/dist/node.d.ts +40 -12
  20. package/dist/node.js +11 -11
  21. package/dist/spy.js +2 -102
  22. package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
  23. package/dist/vendor-entry.17835032.js +991 -0
  24. package/dist/vendor-index.405e58ef.js +6291 -0
  25. package/dist/{vendor-index.bd255bc8.js → vendor-index.40be925a.js} +173 -158
  26. package/dist/worker.js +9 -6
  27. package/package.json +9 -10
  28. package/vitest.mjs +1 -1
  29. package/dist/chunk-integrations-globals.b4a20711.js +0 -23
  30. package/dist/vendor-_commonjsHelpers.34b404ce.js +0 -7
  31. package/dist/vendor-index.13468339.js +0 -5707
@@ -1,11 +1,11 @@
1
- import require$$0, { format } from 'util';
2
- import { g as getWorkerState, i as isObject, t as toArray, n as noop, a as index$1, b as getCallLastIndex, s as slash, c as getNames, d as assertTypes, e as c, r as resetModules } from './chunk-utils-global.a3293dce.js';
3
- import { s as setTimeout, c as clearTimeout, 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, d as stringify, m as matcherUtils } from './chunk-utils-timers.b26e7c5c.js';
4
- import chai$1, { expect as expect$1, util, assert, should } from 'chai';
5
- import { c as commonjsRequire, a as commonjsGlobal } from './vendor-_commonjsHelpers.34b404ce.js';
6
- import { r as rpc } from './chunk-runtime-rpc.c47f2233.js';
1
+ import chai$1, { expect as expect$1, util } from 'chai';
2
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
3
+ import { r as rpc } from './chunk-runtime-rpc.8e14ae4f.js';
4
+ import { i as isObject, a as index, g as getCallLastIndex, s as slash, b as getWorkerState, c as getNames, d as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.9b434e81.js';
7
5
  import fs, { promises } from 'fs';
8
- import { isMockFunction, spyOn, fn, spies } from './spy.js';
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, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.c50fec92.js';
7
+ import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.f036df6f.js';
8
+ import require$$0, { format } from 'util';
9
9
 
10
10
  var __defProp$4 = Object.defineProperty;
11
11
  var __defProps$2 = Object.defineProperties;
@@ -45,313 +45,92 @@ function createChainable(keys, fn) {
45
45
  return chain;
46
46
  }
47
47
 
48
- const context = {
49
- tasks: [],
50
- currentSuite: null
51
- };
52
- function collectTask(task) {
53
- var _a;
54
- (_a = context.currentSuite) == null ? void 0 : _a.tasks.push(task);
55
- }
56
- async function runWithSuite(suite, fn) {
57
- const prev = context.currentSuite;
58
- context.currentSuite = suite;
59
- await fn();
60
- context.currentSuite = prev;
61
- }
62
- function getDefaultTestTimeout() {
63
- return getWorkerState().config.testTimeout;
64
- }
65
- function getDefaultHookTimeout() {
66
- return getWorkerState().config.hookTimeout;
67
- }
68
- function withTimeout(fn, timeout = getDefaultTestTimeout(), isHook = false) {
69
- if (timeout <= 0 || timeout === Infinity)
70
- return fn;
71
- return (...args) => {
72
- return Promise.race([fn(...args), new Promise((resolve, reject) => {
73
- const timer = setTimeout(() => {
74
- clearTimeout(timer);
75
- reject(new Error(makeTimeoutMsg(isHook, timeout)));
76
- }, timeout);
77
- timer.unref();
78
- })]);
79
- };
80
- }
81
- function makeTimeoutMsg(isHook, timeout) {
82
- return `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
83
- If this is a long-running test, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
84
- }
85
- function ensureAsyncTest(fn) {
86
- if (!fn.length)
87
- return fn;
88
- return () => new Promise((resolve, reject) => {
89
- const done = (...args) => args[0] ? reject(args[0]) : resolve();
90
- fn(done);
91
- });
92
- }
93
- function normalizeTest(fn, timeout) {
94
- return withTimeout(ensureAsyncTest(fn), timeout);
95
- }
96
-
97
- const fnMap = /* @__PURE__ */ new WeakMap();
98
- const hooksMap = /* @__PURE__ */ new WeakMap();
99
- function setFn(key, fn) {
100
- fnMap.set(key, fn);
101
- }
102
- function getFn(key) {
103
- return fnMap.get(key);
104
- }
105
- function setHooks(key, hooks) {
106
- hooksMap.set(key, hooks);
107
- }
108
- function getHooks(key) {
109
- return hooksMap.get(key);
110
- }
111
-
112
- const suite = createSuite();
113
- const test = createTest(function(name, fn, timeout) {
114
- getCurrentSuite().test.fn.call(this, name, fn, timeout);
115
- });
116
- function formatTitle(template, items, idx) {
117
- if (template.includes("%#")) {
118
- template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/__vitest_escaped_%__/g, "%%");
119
- }
120
- const count = template.split("%").length - 1;
121
- let formatted = format(template, ...items.slice(0, count));
122
- if (isObject(items[0])) {
123
- formatted = formatted.replace(/\$([$\w_]+)/g, (_, key) => {
124
- return items[0][key];
125
- });
126
- }
127
- return formatted;
128
- }
129
- const describe = suite;
130
- const it = test;
131
- const defaultSuite = suite("");
132
- function clearContext() {
133
- context.tasks.length = 0;
134
- defaultSuite.clear();
135
- context.currentSuite = defaultSuite;
136
- }
137
- function getCurrentSuite() {
138
- return context.currentSuite || defaultSuite;
139
- }
140
- function createSuiteHooks() {
141
- return {
142
- beforeAll: [],
143
- afterAll: [],
144
- beforeEach: [],
145
- afterEach: []
146
- };
147
- }
148
- function createSuiteCollector(name, factory = () => {
149
- }, mode, concurrent) {
150
- const tasks = [];
151
- const factoryQueue = [];
152
- let suite2;
153
- initSuite();
154
- const test2 = createTest(function(name2, fn, timeout) {
155
- const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
156
- const test3 = {
157
- id: "",
158
- type: "test",
159
- name: name2,
160
- mode: mode2,
161
- suite: void 0,
162
- fails: this.fails
163
- };
164
- if (this.concurrent || concurrent)
165
- test3.concurrent = true;
166
- setFn(test3, normalizeTest(fn || noop, timeout));
167
- tasks.push(test3);
168
- });
169
- const collector = {
170
- type: "collector",
171
- name,
172
- mode,
173
- test: test2,
174
- tasks,
175
- collect,
176
- clear,
177
- on: addHook
178
- };
179
- function addHook(name2, ...fn) {
180
- getHooks(suite2)[name2].push(...fn);
181
- }
182
- function initSuite() {
183
- suite2 = {
184
- id: "",
185
- type: "suite",
186
- name,
187
- mode,
188
- tasks: []
189
- };
190
- setHooks(suite2, createSuiteHooks());
191
- }
192
- function clear() {
193
- tasks.length = 0;
194
- factoryQueue.length = 0;
195
- initSuite();
196
- }
197
- async function collect(file) {
198
- factoryQueue.length = 0;
199
- if (factory)
200
- await runWithSuite(collector, () => factory(test2));
201
- const allChildren = [];
202
- for (const i of [...factoryQueue, ...tasks])
203
- allChildren.push(i.type === "collector" ? await i.collect(file) : i);
204
- suite2.file = file;
205
- suite2.tasks = allChildren;
206
- allChildren.forEach((task) => {
207
- task.suite = suite2;
208
- if (file)
209
- task.file = file;
210
- });
211
- return suite2;
212
- }
213
- collectTask(collector);
214
- return collector;
215
- }
216
- function createSuite() {
217
- const suite2 = createChainable(["concurrent", "skip", "only", "todo"], function(name, factory) {
218
- const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
219
- return createSuiteCollector(name, factory, mode, this.concurrent);
220
- });
221
- suite2.each = (cases) => {
222
- return (name, fn) => {
223
- cases.forEach((i, idx) => {
224
- const items = toArray(i);
225
- suite2(formatTitle(name, items, idx), () => fn(...items));
226
- });
227
- };
228
- };
229
- return suite2;
230
- }
231
- function createTest(fn) {
232
- const test2 = createChainable(["concurrent", "skip", "only", "todo", "fails"], fn);
233
- test2.each = (cases) => {
234
- return (name, fn2) => {
235
- cases.forEach((i, idx) => {
236
- const items = toArray(i);
237
- test2(formatTitle(name, items, idx), () => fn2(...items));
238
- });
239
- };
240
- };
241
- return test2;
242
- }
243
-
244
- const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
245
- const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
246
- const beforeEach = (fn, timeout) => getCurrentSuite().on("beforeEach", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
247
- const afterEach = (fn, timeout) => getCurrentSuite().on("afterEach", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
248
-
249
- const filesCount = /* @__PURE__ */ new Map();
250
- const cache = /* @__PURE__ */ new Map();
251
- function runOnce(fn, key) {
252
- const filepath = getWorkerState().filepath || "__unknown_files__";
253
- if (!key) {
254
- filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
255
- key = String(filesCount.get(filepath));
256
- }
257
- const id = `${filepath}:${key}`;
258
- if (!cache.has(id))
259
- cache.set(id, fn());
260
- return cache.get(id);
261
- }
262
- function isFirstRun() {
263
- let firstRun = false;
264
- runOnce(() => {
265
- firstRun = true;
266
- }, "__vitest_first_run__");
267
- return firstRun;
268
- }
269
- function resetRunOnceCounter() {
270
- filesCount.clear();
48
+ function commonjsRequire(path) {
49
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
271
50
  }
272
51
 
273
52
  var chaiSubset = {exports: {}};
274
53
 
275
54
  (function (module, exports) {
276
- (function() {
277
- (function(chaiSubset) {
278
- if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') {
279
- return module.exports = chaiSubset;
280
- } else {
281
- return chai.use(chaiSubset);
282
- }
283
- })(function(chai, utils) {
284
- var Assertion = chai.Assertion;
285
- var assertionPrototype = Assertion.prototype;
286
-
287
- Assertion.addMethod('containSubset', function (expected) {
288
- var actual = utils.flag(this, 'object');
289
- var showDiff = chai.config.showDiff;
290
-
291
- assertionPrototype.assert.call(this,
292
- compare(expected, actual),
293
- 'expected #{act} to contain subset #{exp}',
294
- 'expected #{act} to not contain subset #{exp}',
295
- expected,
296
- actual,
297
- showDiff
298
- );
299
- });
300
-
301
- chai.assert.containSubset = function(val, exp, msg) {
302
- new chai.Assertion(val, msg).to.be.containSubset(exp);
303
- };
304
-
305
- function compare(expected, actual) {
306
- if (expected === actual) {
307
- return true;
308
- }
309
- if (typeof(actual) !== typeof(expected)) {
310
- return false;
311
- }
312
- if (typeof(expected) !== 'object' || expected === null) {
313
- return expected === actual;
314
- }
315
- if (!!expected && !actual) {
316
- return false;
55
+ (function() {
56
+ (function(chaiSubset) {
57
+ if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') {
58
+ return module.exports = chaiSubset;
59
+ } else {
60
+ return chai.use(chaiSubset);
317
61
  }
62
+ })(function(chai, utils) {
63
+ var Assertion = chai.Assertion;
64
+ var assertionPrototype = Assertion.prototype;
65
+
66
+ Assertion.addMethod('containSubset', function (expected) {
67
+ var actual = utils.flag(this, 'object');
68
+ var showDiff = chai.config.showDiff;
69
+
70
+ assertionPrototype.assert.call(this,
71
+ compare(expected, actual),
72
+ 'expected #{act} to contain subset #{exp}',
73
+ 'expected #{act} to not contain subset #{exp}',
74
+ expected,
75
+ actual,
76
+ showDiff
77
+ );
78
+ });
318
79
 
319
- if (Array.isArray(expected)) {
320
- if (typeof(actual.length) !== 'number') {
80
+ chai.assert.containSubset = function(val, exp, msg) {
81
+ new chai.Assertion(val, msg).to.be.containSubset(exp);
82
+ };
83
+
84
+ function compare(expected, actual) {
85
+ if (expected === actual) {
86
+ return true;
87
+ }
88
+ if (typeof(actual) !== typeof(expected)) {
321
89
  return false;
322
90
  }
323
- var aa = Array.prototype.slice.call(actual);
324
- return expected.every(function (exp) {
325
- return aa.some(function (act) {
326
- return compare(exp, act);
327
- });
328
- });
329
- }
330
-
331
- if (expected instanceof Date) {
332
- if (actual instanceof Date) {
333
- return expected.getTime() === actual.getTime();
334
- } else {
91
+ if (typeof(expected) !== 'object' || expected === null) {
92
+ return expected === actual;
93
+ }
94
+ if (!!expected && !actual) {
335
95
  return false;
336
96
  }
337
- }
338
97
 
339
- return Object.keys(expected).every(function (key) {
340
- var eo = expected[key];
341
- var ao = actual[key];
342
- if (typeof(eo) === 'object' && eo !== null && ao !== null) {
343
- return compare(eo, ao);
98
+ if (Array.isArray(expected)) {
99
+ if (typeof(actual.length) !== 'number') {
100
+ return false;
101
+ }
102
+ var aa = Array.prototype.slice.call(actual);
103
+ return expected.every(function (exp) {
104
+ return aa.some(function (act) {
105
+ return compare(exp, act);
106
+ });
107
+ });
344
108
  }
345
- if (typeof(eo) === 'function') {
346
- return eo(ao);
109
+
110
+ if (expected instanceof Date) {
111
+ if (actual instanceof Date) {
112
+ return expected.getTime() === actual.getTime();
113
+ } else {
114
+ return false;
115
+ }
347
116
  }
348
- return ao === eo;
349
- });
350
- }
351
- });
352
117
 
353
- }).call(commonjsGlobal);
354
- }(chaiSubset));
118
+ return Object.keys(expected).every(function (key) {
119
+ var eo = expected[key];
120
+ var ao = actual[key];
121
+ if (typeof(eo) === 'object' && eo !== null && ao !== null) {
122
+ return compare(eo, ao);
123
+ }
124
+ if (typeof(eo) === 'function') {
125
+ return eo(ao);
126
+ }
127
+ return ao === eo;
128
+ });
129
+ }
130
+ });
131
+
132
+ }).call(commonjsGlobal);
133
+ } (chaiSubset));
355
134
 
356
135
  var Subset = chaiSubset.exports;
357
136
 
@@ -597,7 +376,7 @@ const sparseArrayEquality = (a, b) => {
597
376
  return equals(a, b, [iterableEquality, typeEquality], true) && equals(aKeys, bKeys);
598
377
  };
599
378
 
600
- var naturalCompare$2 = {exports: {}};
379
+ var naturalCompare$1 = {exports: {}};
601
380
 
602
381
  /*
603
382
  * @version 1.4.0
@@ -649,13 +428,11 @@ var naturalCompare = function(a, b) {
649
428
  };
650
429
 
651
430
  try {
652
- naturalCompare$2.exports = naturalCompare;
431
+ naturalCompare$1.exports = naturalCompare;
653
432
  } catch (e) {
654
433
  String.naturalCompare = naturalCompare;
655
434
  }
656
435
 
657
- var naturalCompare$1 = naturalCompare$2.exports;
658
-
659
436
  const {
660
437
  DOMCollection,
661
438
  DOMElement,
@@ -740,7 +517,7 @@ function printBacktickString(str) {
740
517
  }
741
518
  function ensureDirectoryExists(filePath) {
742
519
  try {
743
- fs.mkdirSync(index$1.join(index$1.dirname(filePath)), { recursive: true });
520
+ fs.mkdirSync(index.join(index.dirname(filePath)), { recursive: true });
744
521
  } catch {
745
522
  }
746
523
  }
@@ -748,7 +525,7 @@ function normalizeNewlines(string) {
748
525
  return string.replace(/\r\n|\r/g, "\n");
749
526
  }
750
527
  async function saveSnapshotFile(snapshotData, snapshotPath) {
751
- const snapshots = Object.keys(snapshotData).sort(naturalCompare$1).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);
528
+ const snapshots = Object.keys(snapshotData).sort(naturalCompare$1.exports).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);
752
529
  ensureDirectoryExists(snapshotPath);
753
530
  await promises.writeFile(snapshotPath, `${writeSnapshotVersion()}
754
531
 
@@ -911,9 +688,10 @@ var __spreadValues$2 = (a, b) => {
911
688
  return a;
912
689
  };
913
690
  class SnapshotState {
914
- constructor(snapshotPath, options) {
915
- this._snapshotPath = snapshotPath;
916
- const { data, dirty } = getSnapshotData(this._snapshotPath, options.updateSnapshot);
691
+ constructor(testFilePath, snapshotPath, options) {
692
+ this.testFilePath = testFilePath;
693
+ this.snapshotPath = snapshotPath;
694
+ const { data, dirty } = getSnapshotData(this.snapshotPath, options.updateSnapshot);
917
695
  this._initialData = data;
918
696
  this._snapshotData = data;
919
697
  this._dirty = dirty;
@@ -968,6 +746,7 @@ ${JSON.stringify(stacks)}`);
968
746
  this.matched = 0;
969
747
  this.unmatched = 0;
970
748
  this.updated = 0;
749
+ this._dirty = false;
971
750
  }
972
751
  async save() {
973
752
  const hasExternalSnapshots = Object.keys(this._snapshotData).length;
@@ -979,13 +758,13 @@ ${JSON.stringify(stacks)}`);
979
758
  };
980
759
  if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {
981
760
  if (hasExternalSnapshots)
982
- await saveSnapshotFile(this._snapshotData, this._snapshotPath);
761
+ await saveSnapshotFile(this._snapshotData, this.snapshotPath);
983
762
  if (hasInlineSnapshots)
984
763
  await saveInlineSnapshots(this._inlineSnapshots);
985
764
  status.saved = true;
986
- } else if (!hasExternalSnapshots && fs.existsSync(this._snapshotPath)) {
765
+ } else if (!hasExternalSnapshots && fs.existsSync(this.snapshotPath)) {
987
766
  if (this._updateSnapshot === "all")
988
- fs.unlinkSync(this._snapshotPath);
767
+ fs.unlinkSync(this.snapshotPath);
989
768
  status.deleted = true;
990
769
  }
991
770
  return status;
@@ -1022,7 +801,7 @@ ${JSON.stringify(stacks)}`);
1022
801
  const expectedTrimmed = prepareExpected(expected);
1023
802
  const pass = expectedTrimmed === prepareExpected(receivedSerialized);
1024
803
  const hasSnapshot = expected !== void 0;
1025
- const snapshotIsPersisted = isInline || fs.existsSync(this._snapshotPath);
804
+ const snapshotIsPersisted = isInline || fs.existsSync(this.snapshotPath);
1026
805
  if (pass && !isInline) {
1027
806
  this._snapshotData[key] = receivedSerialized;
1028
807
  }
@@ -1070,26 +849,57 @@ ${JSON.stringify(stacks)}`);
1070
849
  }
1071
850
  }
1072
851
  }
852
+ async pack() {
853
+ const snapshot = {
854
+ filepath: this.testFilePath,
855
+ added: 0,
856
+ fileDeleted: false,
857
+ matched: 0,
858
+ unchecked: 0,
859
+ uncheckedKeys: [],
860
+ unmatched: 0,
861
+ updated: 0
862
+ };
863
+ const uncheckedCount = this.getUncheckedCount();
864
+ const uncheckedKeys = this.getUncheckedKeys();
865
+ if (uncheckedCount)
866
+ this.removeUncheckedKeys();
867
+ const status = await this.save();
868
+ snapshot.fileDeleted = status.deleted;
869
+ snapshot.added = this.added;
870
+ snapshot.matched = this.matched;
871
+ snapshot.unmatched = this.unmatched;
872
+ snapshot.updated = this.updated;
873
+ snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
874
+ snapshot.uncheckedKeys = Array.from(uncheckedKeys);
875
+ return snapshot;
876
+ }
1073
877
  }
1074
878
 
1075
879
  class SnapshotClient {
1076
880
  constructor() {
1077
- this.testFile = "";
881
+ this.snapshotStateMap = /* @__PURE__ */ new Map();
1078
882
  }
1079
883
  async setTest(test) {
884
+ var _a;
1080
885
  this.test = test;
1081
- if (this.testFile !== this.test.file.filepath) {
1082
- if (this.snapshotState)
1083
- this.saveSnap();
1084
- this.testFile = this.test.file.filepath;
1085
- this.snapshotState = new SnapshotState(await rpc().resolveSnapshotPath(this.testFile), getWorkerState().config.snapshotOptions);
886
+ if (((_a = this.snapshotState) == null ? void 0 : _a.testFilePath) !== this.test.file.filepath) {
887
+ this.saveCurrent();
888
+ const filePath = this.test.file.filepath;
889
+ if (!this.getSnapshotState(test)) {
890
+ this.snapshotStateMap.set(filePath, new SnapshotState(filePath, await rpc().resolveSnapshotPath(filePath), getWorkerState().config.snapshotOptions));
891
+ }
892
+ this.snapshotState = this.getSnapshotState(test);
1086
893
  }
1087
894
  }
895
+ getSnapshotState(test) {
896
+ return this.snapshotStateMap.get(test.file.filepath);
897
+ }
1088
898
  clearTest() {
1089
899
  this.test = void 0;
1090
900
  }
1091
- assert(received, message, isInline = false, properties, inlineSnapshot, error) {
1092
- if (!this.test)
901
+ assert(received, test = this.test, message, isInline = false, properties, inlineSnapshot, error) {
902
+ if (!test)
1093
903
  throw new Error("Snapshot cannot be used outside of test");
1094
904
  if (typeof properties === "object") {
1095
905
  if (typeof received !== "object" || !received)
@@ -1106,10 +916,11 @@ class SnapshotClient {
1106
916
  }
1107
917
  }
1108
918
  const testName = [
1109
- ...getNames(this.test).slice(1),
919
+ ...getNames(test).slice(1),
1110
920
  ...message ? [message] : []
1111
921
  ].join(" > ");
1112
- const { actual, expected, key, pass } = this.snapshotState.match({
922
+ const snapshotState = this.getSnapshotState(test);
923
+ const { actual, expected, key, pass } = snapshotState.match({
1113
924
  testName,
1114
925
  received,
1115
926
  isInline,
@@ -1125,39 +936,16 @@ class SnapshotClient {
1125
936
  }
1126
937
  }
1127
938
  }
1128
- async saveSnap() {
1129
- if (!this.testFile || !this.snapshotState)
939
+ async saveCurrent() {
940
+ if (!this.snapshotState)
1130
941
  return;
1131
- const result = await packSnapshotState(this.testFile, this.snapshotState);
942
+ const result = await this.snapshotState.pack();
1132
943
  await rpc().snapshotSaved(result);
1133
- this.testFile = "";
1134
944
  this.snapshotState = void 0;
1135
945
  }
1136
- }
1137
- async function packSnapshotState(filepath, state) {
1138
- const snapshot = {
1139
- filepath,
1140
- added: 0,
1141
- fileDeleted: false,
1142
- matched: 0,
1143
- unchecked: 0,
1144
- uncheckedKeys: [],
1145
- unmatched: 0,
1146
- updated: 0
1147
- };
1148
- const uncheckedCount = state.getUncheckedCount();
1149
- const uncheckedKeys = state.getUncheckedKeys();
1150
- if (uncheckedCount)
1151
- state.removeUncheckedKeys();
1152
- const status = await state.save();
1153
- snapshot.fileDeleted = status.deleted;
1154
- snapshot.added = state.added;
1155
- snapshot.matched = state.matched;
1156
- snapshot.unmatched = state.unmatched;
1157
- snapshot.updated = state.updated;
1158
- snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
1159
- snapshot.uncheckedKeys = Array.from(uncheckedKeys);
1160
- return snapshot;
946
+ clear() {
947
+ this.snapshotStateMap.clear();
948
+ }
1161
949
  }
1162
950
 
1163
951
  let _client;
@@ -1180,16 +968,18 @@ const SnapshotPlugin = (chai, utils) => {
1180
968
  for (const key of ["matchSnapshot", "toMatchSnapshot"]) {
1181
969
  utils.addMethod(chai.Assertion.prototype, key, function(properties, message) {
1182
970
  const expected = utils.flag(this, "object");
971
+ const test = utils.flag(this, "vitest-test");
1183
972
  if (typeof properties === "string" && typeof message === "undefined") {
1184
973
  message = properties;
1185
974
  properties = void 0;
1186
975
  }
1187
- getSnapshotClient().assert(expected, message, false, properties);
976
+ getSnapshotClient().assert(expected, test, message, false, properties);
1188
977
  });
1189
978
  }
1190
979
  utils.addMethod(chai.Assertion.prototype, "toMatchInlineSnapshot", function __VITEST_INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
1191
980
  const expected = utils.flag(this, "object");
1192
981
  const error = utils.flag(this, "error");
982
+ const test = utils.flag(this, "vitest-test");
1193
983
  if (typeof properties === "string") {
1194
984
  message = inlineSnapshot;
1195
985
  inlineSnapshot = properties;
@@ -1197,16 +987,18 @@ const SnapshotPlugin = (chai, utils) => {
1197
987
  }
1198
988
  if (inlineSnapshot)
1199
989
  inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
1200
- getSnapshotClient().assert(expected, message, true, properties, inlineSnapshot, error);
990
+ getSnapshotClient().assert(expected, test, message, true, properties, inlineSnapshot, error);
1201
991
  });
1202
992
  utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingSnapshot", function(message) {
1203
993
  const expected = utils.flag(this, "object");
1204
- getSnapshotClient().assert(getErrorString(expected), message);
994
+ const test = utils.flag(this, "vitest-test");
995
+ getSnapshotClient().assert(getErrorString(expected), test, message);
1205
996
  });
1206
997
  utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingInlineSnapshot", function __VITEST_INLINE_SNAPSHOT__(inlineSnapshot, message) {
1207
998
  const expected = utils.flag(this, "object");
1208
999
  const error = utils.flag(this, "error");
1209
- getSnapshotClient().assert(getErrorString(expected), message, true, void 0, inlineSnapshot, error);
1000
+ const test = utils.flag(this, "vitest-test");
1001
+ getSnapshotClient().assert(getErrorString(expected), test, message, true, void 0, inlineSnapshot, error);
1210
1002
  });
1211
1003
  };
1212
1004
 
@@ -1253,6 +1045,10 @@ const JestChaiExpect = (chai, utils) => {
1253
1045
  };
1254
1046
  });
1255
1047
  });
1048
+ def("withTest", function(test) {
1049
+ utils.flag(this, "vitest-test", test);
1050
+ return this;
1051
+ });
1256
1052
  def("toEqual", function(expected) {
1257
1053
  const actual = utils.flag(this, "object");
1258
1054
  const equal = equals(actual, expected, [iterableEquality]);
@@ -1392,11 +1188,11 @@ const JestChaiExpect = (chai, utils) => {
1392
1188
  return `${i}th`;
1393
1189
  };
1394
1190
  const formatCalls = (spy, msg, actualCall) => {
1395
- msg += c.gray(`
1191
+ msg += picocolors.exports.gray(`
1396
1192
 
1397
1193
  Received:
1398
1194
  ${spy.mock.calls.map((callArg, i) => {
1399
- let methodCall = c.bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
1195
+ let methodCall = picocolors.exports.bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
1400
1196
 
1401
1197
  `);
1402
1198
  if (actualCall)
@@ -1406,9 +1202,9 @@ ${spy.mock.calls.map((callArg, i) => {
1406
1202
  methodCall += "\n";
1407
1203
  return methodCall;
1408
1204
  }).join("\n")}`);
1409
- msg += c.gray(`
1205
+ msg += picocolors.exports.gray(`
1410
1206
 
1411
- Number of calls: ${c.bold(spy.mock.calls.length)}
1207
+ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1412
1208
  `);
1413
1209
  return msg;
1414
1210
  };
@@ -1511,8 +1307,8 @@ Number of calls: ${c.bold(spy.mock.calls.length)}
1511
1307
  def(["toHaveReturnedTimes", "toReturnTimes"], function(times) {
1512
1308
  const spy = getSpy(this);
1513
1309
  const spyName = spy.getMockName();
1514
- const successfullReturns = spy.mock.results.reduce((success, { type }) => type === "throw" ? success : ++success, 0);
1515
- this.assert(successfullReturns === times, `expected "${spyName}" to be successfully called ${times} times`, `expected "${spyName}" to not be successfully called ${times} times`, `expected number of returns: ${times}`, `received number of returns: ${successfullReturns}`);
1310
+ const successfulReturns = spy.mock.results.reduce((success, { type }) => type === "throw" ? success : ++success, 0);
1311
+ this.assert(successfulReturns === times, `expected "${spyName}" to be successfully called ${times} times`, `expected "${spyName}" to not be successfully called ${times} times`, `expected number of returns: ${times}`, `received number of returns: ${successfulReturns}`);
1516
1312
  });
1517
1313
  def(["toHaveReturnedWith", "toReturnWith"], function(value) {
1518
1314
  const spy = getSpy(this);
@@ -1840,90 +1636,345 @@ const getMatcherState = (assertion) => {
1840
1636
  equals,
1841
1637
  suppressedErrors: []
1842
1638
  });
1843
- return {
1844
- state: matcherState,
1845
- isNot,
1846
- obj
1639
+ return {
1640
+ state: matcherState,
1641
+ isNot,
1642
+ obj
1643
+ };
1644
+ };
1645
+ class JestExtendError extends Error {
1646
+ constructor(message, actual, expected) {
1647
+ super(message);
1648
+ this.actual = actual;
1649
+ this.expected = expected;
1650
+ }
1651
+ }
1652
+ function JestExtendPlugin(expect, matchers) {
1653
+ return (c, utils) => {
1654
+ Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
1655
+ function expectSyncWrapper(...args) {
1656
+ const { state, isNot, obj } = getMatcherState(this);
1657
+ const { pass, message, actual, expected } = expectAssertion.call(state, obj, ...args);
1658
+ if (pass && isNot || !pass && !isNot)
1659
+ throw new JestExtendError(message(), actual, expected);
1660
+ }
1661
+ async function expectAsyncWrapper(...args) {
1662
+ const { state, isNot, obj } = getMatcherState(this);
1663
+ const { pass, message, actual, expected } = await expectAssertion.call(state, obj, ...args);
1664
+ if (pass && isNot || !pass && !isNot)
1665
+ throw new JestExtendError(message(), actual, expected);
1666
+ }
1667
+ const expectAssertionWrapper = isAsyncFunction(expectAssertion) ? expectAsyncWrapper : expectSyncWrapper;
1668
+ utils.addMethod(c.Assertion.prototype, expectAssertionName, expectAssertionWrapper);
1669
+ class CustomMatcher extends AsymmetricMatcher {
1670
+ constructor(inverse = false, ...sample) {
1671
+ super(sample, inverse);
1672
+ }
1673
+ asymmetricMatch(other) {
1674
+ const { pass } = expectAssertion.call(this.getMatcherContext(), other, ...this.sample);
1675
+ return this.inverse ? !pass : pass;
1676
+ }
1677
+ toString() {
1678
+ return `${this.inverse ? "not." : ""}${expectAssertionName}`;
1679
+ }
1680
+ getExpectedType() {
1681
+ return "any";
1682
+ }
1683
+ toAsymmetricMatcher() {
1684
+ return `${this.toString()}<${this.sample.map(String).join(", ")}>`;
1685
+ }
1686
+ }
1687
+ Object.defineProperty(expect, expectAssertionName, {
1688
+ configurable: true,
1689
+ enumerable: true,
1690
+ value: (...sample) => new CustomMatcher(false, ...sample),
1691
+ writable: true
1692
+ });
1693
+ Object.defineProperty(expect.not, expectAssertionName, {
1694
+ configurable: true,
1695
+ enumerable: true,
1696
+ value: (...sample) => new CustomMatcher(true, ...sample),
1697
+ writable: true
1698
+ });
1699
+ });
1700
+ };
1701
+ }
1702
+ const JestExtend = (chai, utils) => {
1703
+ utils.addMethod(chai.expect, "extend", (expect, expects) => {
1704
+ chai.use(JestExtendPlugin(expect, expects));
1705
+ });
1706
+ };
1707
+
1708
+ chai$1.use(JestExtend);
1709
+ chai$1.use(JestChaiExpect);
1710
+ chai$1.use(Subset);
1711
+ chai$1.use(SnapshotPlugin);
1712
+ chai$1.use(JestAsymmetricMatchers);
1713
+
1714
+ function createExpect(test) {
1715
+ const expect2 = (value, message) => {
1716
+ const { assertionCalls } = getState();
1717
+ setState({ assertionCalls: assertionCalls + 1 });
1718
+ const assert2 = chai$1.expect(value, message);
1719
+ if (test)
1720
+ return assert2.withTest(test);
1721
+ else
1722
+ return assert2;
1723
+ };
1724
+ Object.assign(expect2, chai$1.expect);
1725
+ expect2.getState = getState;
1726
+ expect2.setState = setState;
1727
+ expect2.extend = (matchers) => chai$1.expect.extend(expect2, matchers);
1728
+ return expect2;
1729
+ }
1730
+ const expect = createExpect();
1731
+
1732
+ const collectorContext = {
1733
+ tasks: [],
1734
+ currentSuite: null
1735
+ };
1736
+ function collectTask(task) {
1737
+ var _a;
1738
+ (_a = collectorContext.currentSuite) == null ? void 0 : _a.tasks.push(task);
1739
+ }
1740
+ async function runWithSuite(suite, fn) {
1741
+ const prev = collectorContext.currentSuite;
1742
+ collectorContext.currentSuite = suite;
1743
+ await fn();
1744
+ collectorContext.currentSuite = prev;
1745
+ }
1746
+ function getDefaultTestTimeout() {
1747
+ return getWorkerState().config.testTimeout;
1748
+ }
1749
+ function getDefaultHookTimeout() {
1750
+ return getWorkerState().config.hookTimeout;
1751
+ }
1752
+ function withTimeout(fn, timeout = getDefaultTestTimeout(), isHook = false) {
1753
+ if (timeout <= 0 || timeout === Infinity)
1754
+ return fn;
1755
+ return (...args) => {
1756
+ return Promise.race([fn(...args), new Promise((resolve, reject) => {
1757
+ const timer = setTimeout(() => {
1758
+ clearTimeout(timer);
1759
+ reject(new Error(makeTimeoutMsg(isHook, timeout)));
1760
+ }, timeout);
1761
+ timer.unref();
1762
+ })]);
1763
+ };
1764
+ }
1765
+ function createTestContext(test) {
1766
+ const context = function() {
1767
+ throw new Error("done() callback is deprecated, use promise instead");
1768
+ };
1769
+ context.meta = test;
1770
+ let _expect;
1771
+ Object.defineProperty(context, "expect", {
1772
+ get() {
1773
+ if (!_expect)
1774
+ _expect = createExpect(test);
1775
+ return _expect;
1776
+ }
1777
+ });
1778
+ return context;
1779
+ }
1780
+ function makeTimeoutMsg(isHook, timeout) {
1781
+ return `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
1782
+ If this is a long-running test, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
1783
+ }
1784
+
1785
+ const fnMap = /* @__PURE__ */ new WeakMap();
1786
+ const hooksMap = /* @__PURE__ */ new WeakMap();
1787
+ function setFn(key, fn) {
1788
+ fnMap.set(key, fn);
1789
+ }
1790
+ function getFn(key) {
1791
+ return fnMap.get(key);
1792
+ }
1793
+ function setHooks(key, hooks) {
1794
+ hooksMap.set(key, hooks);
1795
+ }
1796
+ function getHooks(key) {
1797
+ return hooksMap.get(key);
1798
+ }
1799
+
1800
+ const suite = createSuite();
1801
+ const test = createTest(function(name, fn, timeout) {
1802
+ getCurrentSuite().test.fn.call(this, name, fn, timeout);
1803
+ });
1804
+ function formatTitle(template, items, idx) {
1805
+ if (template.includes("%#")) {
1806
+ template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/__vitest_escaped_%__/g, "%%");
1807
+ }
1808
+ const count = template.split("%").length - 1;
1809
+ let formatted = format(template, ...items.slice(0, count));
1810
+ if (isObject(items[0])) {
1811
+ formatted = formatted.replace(/\$([$\w_]+)/g, (_, key) => {
1812
+ return items[0][key];
1813
+ });
1814
+ }
1815
+ return formatted;
1816
+ }
1817
+ const describe = suite;
1818
+ const it = test;
1819
+ const defaultSuite = suite("");
1820
+ function clearCollectorContext() {
1821
+ collectorContext.tasks.length = 0;
1822
+ defaultSuite.clear();
1823
+ collectorContext.currentSuite = defaultSuite;
1824
+ }
1825
+ function getCurrentSuite() {
1826
+ return collectorContext.currentSuite || defaultSuite;
1827
+ }
1828
+ function createSuiteHooks() {
1829
+ return {
1830
+ beforeAll: [],
1831
+ afterAll: [],
1832
+ beforeEach: [],
1833
+ afterEach: []
1834
+ };
1835
+ }
1836
+ function createSuiteCollector(name, factory = () => {
1837
+ }, mode, concurrent) {
1838
+ const tasks = [];
1839
+ const factoryQueue = [];
1840
+ let suite2;
1841
+ initSuite();
1842
+ const test2 = createTest(function(name2, fn = noop, timeout) {
1843
+ const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
1844
+ const test3 = {
1845
+ id: "",
1846
+ type: "test",
1847
+ name: name2,
1848
+ mode: mode2,
1849
+ suite: void 0,
1850
+ fails: this.fails
1851
+ };
1852
+ if (this.concurrent || concurrent)
1853
+ test3.concurrent = true;
1854
+ const context = createTestContext(test3);
1855
+ Object.defineProperty(test3, "context", {
1856
+ value: context,
1857
+ enumerable: false
1858
+ });
1859
+ setFn(test3, withTimeout(() => fn(context), timeout));
1860
+ tasks.push(test3);
1861
+ });
1862
+ const collector = {
1863
+ type: "collector",
1864
+ name,
1865
+ mode,
1866
+ test: test2,
1867
+ tasks,
1868
+ collect,
1869
+ clear,
1870
+ on: addHook
1847
1871
  };
1848
- };
1849
- class JestExtendError extends Error {
1850
- constructor(message, actual, expected) {
1851
- super(message);
1852
- this.actual = actual;
1853
- this.expected = expected;
1872
+ function addHook(name2, ...fn) {
1873
+ getHooks(suite2)[name2].push(...fn);
1874
+ }
1875
+ function initSuite() {
1876
+ suite2 = {
1877
+ id: "",
1878
+ type: "suite",
1879
+ name,
1880
+ mode,
1881
+ tasks: []
1882
+ };
1883
+ setHooks(suite2, createSuiteHooks());
1884
+ }
1885
+ function clear() {
1886
+ tasks.length = 0;
1887
+ factoryQueue.length = 0;
1888
+ initSuite();
1889
+ }
1890
+ async function collect(file) {
1891
+ factoryQueue.length = 0;
1892
+ if (factory)
1893
+ await runWithSuite(collector, () => factory(test2));
1894
+ const allChildren = [];
1895
+ for (const i of [...factoryQueue, ...tasks])
1896
+ allChildren.push(i.type === "collector" ? await i.collect(file) : i);
1897
+ suite2.file = file;
1898
+ suite2.tasks = allChildren;
1899
+ allChildren.forEach((task) => {
1900
+ task.suite = suite2;
1901
+ if (file)
1902
+ task.file = file;
1903
+ });
1904
+ return suite2;
1854
1905
  }
1906
+ collectTask(collector);
1907
+ return collector;
1855
1908
  }
1856
- function JestExtendPlugin(expect, matchers) {
1857
- return (c, utils) => {
1858
- Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
1859
- function expectSyncWrapper(...args) {
1860
- const { state, isNot, obj } = getMatcherState(this);
1861
- const { pass, message, actual, expected } = expectAssertion.call(state, obj, ...args);
1862
- if (pass && isNot || !pass && !isNot)
1863
- throw new JestExtendError(message(), actual, expected);
1864
- }
1865
- async function expectAsyncWrapper(...args) {
1866
- const { state, isNot, obj } = getMatcherState(this);
1867
- const { pass, message, actual, expected } = await expectAssertion.call(state, obj, ...args);
1868
- if (pass && isNot || !pass && !isNot)
1869
- throw new JestExtendError(message(), actual, expected);
1870
- }
1871
- const expectAssertionWrapper = isAsyncFunction(expectAssertion) ? expectAsyncWrapper : expectSyncWrapper;
1872
- utils.addMethod(c.Assertion.prototype, expectAssertionName, expectAssertionWrapper);
1873
- class CustomMatcher extends AsymmetricMatcher {
1874
- constructor(inverse = false, ...sample) {
1875
- super(sample, inverse);
1876
- }
1877
- asymmetricMatch(other) {
1878
- const { pass } = expectAssertion.call(this.getMatcherContext(), other, ...this.sample);
1879
- return this.inverse ? !pass : pass;
1880
- }
1881
- toString() {
1882
- return `${this.inverse ? "not." : ""}${expectAssertionName}`;
1883
- }
1884
- getExpectedType() {
1885
- return "any";
1886
- }
1887
- toAsymmetricMatcher() {
1888
- return `${this.toString()}<${this.sample.map(String).join(", ")}>`;
1889
- }
1890
- }
1891
- Object.defineProperty(expect, expectAssertionName, {
1892
- configurable: true,
1893
- enumerable: true,
1894
- value: (...sample) => new CustomMatcher(false, ...sample),
1895
- writable: true
1909
+ function createSuite() {
1910
+ const suite2 = createChainable(["concurrent", "skip", "only", "todo"], function(name, factory) {
1911
+ const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
1912
+ return createSuiteCollector(name, factory, mode, this.concurrent);
1913
+ });
1914
+ suite2.each = (cases) => {
1915
+ return (name, fn) => {
1916
+ cases.forEach((i, idx) => {
1917
+ const items = toArray(i);
1918
+ suite2(formatTitle(name, items, idx), () => fn(...items));
1896
1919
  });
1897
- Object.defineProperty(expect.not, expectAssertionName, {
1898
- configurable: true,
1899
- enumerable: true,
1900
- value: (...sample) => new CustomMatcher(true, ...sample),
1901
- writable: true
1920
+ };
1921
+ };
1922
+ suite2.skipIf = (condition) => condition ? suite2.skip : suite2;
1923
+ suite2.runIf = (condition) => condition ? suite2 : suite2.skip;
1924
+ return suite2;
1925
+ }
1926
+ function createTest(fn) {
1927
+ const test2 = createChainable(["concurrent", "skip", "only", "todo", "fails"], fn);
1928
+ test2.each = (cases) => {
1929
+ return (name, fn2) => {
1930
+ cases.forEach((i, idx) => {
1931
+ const items = toArray(i);
1932
+ test2(formatTitle(name, items, idx), () => fn2(...items));
1902
1933
  });
1903
- });
1934
+ };
1904
1935
  };
1936
+ test2.skipIf = (condition) => condition ? test2.skip : test2;
1937
+ test2.runIf = (condition) => condition ? test2 : test2.skip;
1938
+ return test2;
1905
1939
  }
1906
- const JestExtend = (chai, utils) => {
1907
- utils.addMethod(chai.expect, "extend", (expect, expects) => {
1908
- chai.use(JestExtendPlugin(expect, expects));
1909
- });
1910
- };
1911
1940
 
1912
- chai$1.use(JestExtend);
1913
- chai$1.use(JestChaiExpect);
1914
- chai$1.use(Subset);
1915
- chai$1.use(SnapshotPlugin);
1916
- chai$1.use(JestAsymmetricMatchers);
1941
+ const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
1942
+ const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
1943
+ const beforeEach = (fn, timeout) => getCurrentSuite().on("beforeEach", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
1944
+ const afterEach = (fn, timeout) => getCurrentSuite().on("afterEach", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true));
1917
1945
 
1918
- const expect = (value, message) => {
1919
- const { assertionCalls } = getState();
1920
- setState({ assertionCalls: assertionCalls + 1 });
1921
- return chai$1.expect(value, message);
1922
- };
1923
- Object.assign(expect, chai$1.expect);
1924
- expect.getState = getState;
1925
- expect.setState = setState;
1926
- expect.extend = (matchers) => chai$1.expect.extend(expect, matchers);
1946
+ function withCallback(fn) {
1947
+ return new Promise((resolve, reject) => fn((err) => {
1948
+ if (err)
1949
+ reject(err);
1950
+ else
1951
+ resolve();
1952
+ }));
1953
+ }
1954
+
1955
+ const filesCount = /* @__PURE__ */ new Map();
1956
+ const cache = /* @__PURE__ */ new Map();
1957
+ function runOnce(fn, key) {
1958
+ const filepath = getWorkerState().filepath || "__unknown_files__";
1959
+ if (!key) {
1960
+ filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
1961
+ key = String(filesCount.get(filepath));
1962
+ }
1963
+ const id = `${filepath}:${key}`;
1964
+ if (!cache.has(id))
1965
+ cache.set(id, fn());
1966
+ return cache.get(id);
1967
+ }
1968
+ function isFirstRun() {
1969
+ let firstRun = false;
1970
+ runOnce(() => {
1971
+ firstRun = true;
1972
+ }, "__vitest_first_run__");
1973
+ return firstRun;
1974
+ }
1975
+ function resetRunOnceCounter() {
1976
+ filesCount.clear();
1977
+ }
1927
1978
 
1928
1979
  /**
1929
1980
  * A reference to the global object
@@ -2086,62 +2137,62 @@ var deprecated = {};
2086
2137
 
2087
2138
  (function (exports) {
2088
2139
 
2089
- /**
2090
- * Returns a function that will invoke the supplied function and print a
2091
- * deprecation warning to the console each time it is called.
2092
- *
2093
- * @param {Function} func
2094
- * @param {string} msg
2095
- * @returns {Function}
2096
- */
2097
- exports.wrap = function(func, msg) {
2098
- var wrapped = function() {
2099
- exports.printWarning(msg);
2100
- return func.apply(this, arguments);
2101
- };
2102
- if (func.prototype) {
2103
- wrapped.prototype = func.prototype;
2104
- }
2105
- return wrapped;
2106
- };
2107
-
2108
- /**
2109
- * Returns a string which can be supplied to `wrap()` to notify the user that a
2110
- * particular part of the sinon API has been deprecated.
2111
- *
2112
- * @param {string} packageName
2113
- * @param {string} funcName
2114
- * @returns {string}
2115
- */
2116
- exports.defaultMsg = function(packageName, funcName) {
2117
- return (
2118
- packageName +
2119
- "." +
2120
- funcName +
2121
- " is deprecated and will be removed from the public API in a future version of " +
2122
- packageName +
2123
- "."
2124
- );
2125
- };
2126
-
2127
- /**
2128
- * Prints a warning on the console, when it exists
2129
- *
2130
- * @param {string} msg
2131
- * @returns {undefined}
2132
- */
2133
- exports.printWarning = function(msg) {
2134
- /* istanbul ignore next */
2135
- if (typeof process === "object" && process.emitWarning) {
2136
- // Emit Warnings in Node
2137
- process.emitWarning(msg);
2138
- } else if (console.info) {
2139
- console.info(msg);
2140
- } else {
2141
- console.log(msg);
2142
- }
2143
- };
2144
- }(deprecated));
2140
+ /**
2141
+ * Returns a function that will invoke the supplied function and print a
2142
+ * deprecation warning to the console each time it is called.
2143
+ *
2144
+ * @param {Function} func
2145
+ * @param {string} msg
2146
+ * @returns {Function}
2147
+ */
2148
+ exports.wrap = function(func, msg) {
2149
+ var wrapped = function() {
2150
+ exports.printWarning(msg);
2151
+ return func.apply(this, arguments);
2152
+ };
2153
+ if (func.prototype) {
2154
+ wrapped.prototype = func.prototype;
2155
+ }
2156
+ return wrapped;
2157
+ };
2158
+
2159
+ /**
2160
+ * Returns a string which can be supplied to `wrap()` to notify the user that a
2161
+ * particular part of the sinon API has been deprecated.
2162
+ *
2163
+ * @param {string} packageName
2164
+ * @param {string} funcName
2165
+ * @returns {string}
2166
+ */
2167
+ exports.defaultMsg = function(packageName, funcName) {
2168
+ return (
2169
+ packageName +
2170
+ "." +
2171
+ funcName +
2172
+ " is deprecated and will be removed from the public API in a future version of " +
2173
+ packageName +
2174
+ "."
2175
+ );
2176
+ };
2177
+
2178
+ /**
2179
+ * Prints a warning on the console, when it exists
2180
+ *
2181
+ * @param {string} msg
2182
+ * @returns {undefined}
2183
+ */
2184
+ exports.printWarning = function(msg) {
2185
+ /* istanbul ignore next */
2186
+ if (typeof process === "object" && process.emitWarning) {
2187
+ // Emit Warnings in Node
2188
+ process.emitWarning(msg);
2189
+ } else if (console.info) {
2190
+ console.info(msg);
2191
+ } else {
2192
+ console.log(msg);
2193
+ }
2194
+ };
2195
+ } (deprecated));
2145
2196
 
2146
2197
  /**
2147
2198
  * Returns true when fn returns true for all members of obj.
@@ -2236,392 +2287,392 @@ var prototypes = {
2236
2287
  var typeDetect = {exports: {}};
2237
2288
 
2238
2289
  (function (module, exports) {
2239
- (function (global, factory) {
2240
- module.exports = factory() ;
2241
- }(commonjsGlobal, (function () {
2242
- /* !
2243
- * type-detect
2244
- * Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
2245
- * MIT Licensed
2246
- */
2247
- var promiseExists = typeof Promise === 'function';
2248
-
2249
- /* eslint-disable no-undef */
2250
- var globalObject = typeof self === 'object' ? self : commonjsGlobal; // eslint-disable-line id-blacklist
2251
-
2252
- var symbolExists = typeof Symbol !== 'undefined';
2253
- var mapExists = typeof Map !== 'undefined';
2254
- var setExists = typeof Set !== 'undefined';
2255
- var weakMapExists = typeof WeakMap !== 'undefined';
2256
- var weakSetExists = typeof WeakSet !== 'undefined';
2257
- var dataViewExists = typeof DataView !== 'undefined';
2258
- var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
2259
- var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
2260
- var setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
2261
- var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
2262
- var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
2263
- var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
2264
- var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
2265
- var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
2266
- var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
2267
- var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
2268
- var toStringLeftSliceLength = 8;
2269
- var toStringRightSliceLength = -1;
2270
- /**
2271
- * ### typeOf (obj)
2272
- *
2273
- * Uses `Object.prototype.toString` to determine the type of an object,
2274
- * normalising behaviour across engine versions & well optimised.
2275
- *
2276
- * @param {Mixed} object
2277
- * @return {String} object type
2278
- * @api public
2279
- */
2280
- function typeDetect(obj) {
2281
- /* ! Speed optimisation
2282
- * Pre:
2283
- * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)
2284
- * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)
2285
- * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)
2286
- * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)
2287
- * function x 2,556,769 ops/sec ±1.73% (77 runs sampled)
2288
- * Post:
2289
- * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)
2290
- * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)
2291
- * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)
2292
- * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)
2293
- * function x 31,296,870 ops/sec ±0.96% (83 runs sampled)
2294
- */
2295
- var typeofObj = typeof obj;
2296
- if (typeofObj !== 'object') {
2297
- return typeofObj;
2298
- }
2299
-
2300
- /* ! Speed optimisation
2301
- * Pre:
2302
- * null x 28,645,765 ops/sec ±1.17% (82 runs sampled)
2303
- * Post:
2304
- * null x 36,428,962 ops/sec ±1.37% (84 runs sampled)
2305
- */
2306
- if (obj === null) {
2307
- return 'null';
2308
- }
2309
-
2310
- /* ! Spec Conformance
2311
- * Test: `Object.prototype.toString.call(window)``
2312
- * - Node === "[object global]"
2313
- * - Chrome === "[object global]"
2314
- * - Firefox === "[object Window]"
2315
- * - PhantomJS === "[object Window]"
2316
- * - Safari === "[object Window]"
2317
- * - IE 11 === "[object Window]"
2318
- * - IE Edge === "[object Window]"
2319
- * Test: `Object.prototype.toString.call(this)``
2320
- * - Chrome Worker === "[object global]"
2321
- * - Firefox Worker === "[object DedicatedWorkerGlobalScope]"
2322
- * - Safari Worker === "[object DedicatedWorkerGlobalScope]"
2323
- * - IE 11 Worker === "[object WorkerGlobalScope]"
2324
- * - IE Edge Worker === "[object WorkerGlobalScope]"
2325
- */
2326
- if (obj === globalObject) {
2327
- return 'global';
2328
- }
2329
-
2330
- /* ! Speed optimisation
2331
- * Pre:
2332
- * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)
2333
- * Post:
2334
- * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
2335
- */
2336
- if (
2337
- Array.isArray(obj) &&
2338
- (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))
2339
- ) {
2340
- return 'Array';
2341
- }
2342
-
2343
- // Not caching existence of `window` and related properties due to potential
2344
- // for `window` to be unset before tests in quasi-browser environments.
2345
- if (typeof window === 'object' && window !== null) {
2346
- /* ! Spec Conformance
2347
- * (https://html.spec.whatwg.org/multipage/browsers.html#location)
2348
- * WhatWG HTML$7.7.3 - The `Location` interface
2349
- * Test: `Object.prototype.toString.call(window.location)``
2350
- * - IE <=11 === "[object Object]"
2351
- * - IE Edge <=13 === "[object Object]"
2352
- */
2353
- if (typeof window.location === 'object' && obj === window.location) {
2354
- return 'Location';
2355
- }
2356
-
2357
- /* ! Spec Conformance
2358
- * (https://html.spec.whatwg.org/#document)
2359
- * WhatWG HTML$3.1.1 - The `Document` object
2360
- * Note: Most browsers currently adher to the W3C DOM Level 2 spec
2361
- * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268)
2362
- * which suggests that browsers should use HTMLTableCellElement for
2363
- * both TD and TH elements. WhatWG separates these.
2364
- * WhatWG HTML states:
2365
- * > For historical reasons, Window objects must also have a
2366
- * > writable, configurable, non-enumerable property named
2367
- * > HTMLDocument whose value is the Document interface object.
2368
- * Test: `Object.prototype.toString.call(document)``
2369
- * - Chrome === "[object HTMLDocument]"
2370
- * - Firefox === "[object HTMLDocument]"
2371
- * - Safari === "[object HTMLDocument]"
2372
- * - IE <=10 === "[object Document]"
2373
- * - IE 11 === "[object HTMLDocument]"
2374
- * - IE Edge <=13 === "[object HTMLDocument]"
2375
- */
2376
- if (typeof window.document === 'object' && obj === window.document) {
2377
- return 'Document';
2378
- }
2379
-
2380
- if (typeof window.navigator === 'object') {
2381
- /* ! Spec Conformance
2382
- * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray)
2383
- * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray
2384
- * Test: `Object.prototype.toString.call(navigator.mimeTypes)``
2385
- * - IE <=10 === "[object MSMimeTypesCollection]"
2386
- */
2387
- if (typeof window.navigator.mimeTypes === 'object' &&
2388
- obj === window.navigator.mimeTypes) {
2389
- return 'MimeTypeArray';
2390
- }
2391
-
2392
- /* ! Spec Conformance
2393
- * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
2394
- * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray
2395
- * Test: `Object.prototype.toString.call(navigator.plugins)``
2396
- * - IE <=10 === "[object MSPluginsCollection]"
2397
- */
2398
- if (typeof window.navigator.plugins === 'object' &&
2399
- obj === window.navigator.plugins) {
2400
- return 'PluginArray';
2401
- }
2402
- }
2403
-
2404
- if ((typeof window.HTMLElement === 'function' ||
2405
- typeof window.HTMLElement === 'object') &&
2406
- obj instanceof window.HTMLElement) {
2407
- /* ! Spec Conformance
2408
- * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
2409
- * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement`
2410
- * Test: `Object.prototype.toString.call(document.createElement('blockquote'))``
2411
- * - IE <=10 === "[object HTMLBlockElement]"
2412
- */
2413
- if (obj.tagName === 'BLOCKQUOTE') {
2414
- return 'HTMLQuoteElement';
2415
- }
2416
-
2417
- /* ! Spec Conformance
2418
- * (https://html.spec.whatwg.org/#htmltabledatacellelement)
2419
- * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`
2420
- * Note: Most browsers currently adher to the W3C DOM Level 2 spec
2421
- * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
2422
- * which suggests that browsers should use HTMLTableCellElement for
2423
- * both TD and TH elements. WhatWG separates these.
2424
- * Test: Object.prototype.toString.call(document.createElement('td'))
2425
- * - Chrome === "[object HTMLTableCellElement]"
2426
- * - Firefox === "[object HTMLTableCellElement]"
2427
- * - Safari === "[object HTMLTableCellElement]"
2428
- */
2429
- if (obj.tagName === 'TD') {
2430
- return 'HTMLTableDataCellElement';
2431
- }
2432
-
2433
- /* ! Spec Conformance
2434
- * (https://html.spec.whatwg.org/#htmltableheadercellelement)
2435
- * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`
2436
- * Note: Most browsers currently adher to the W3C DOM Level 2 spec
2437
- * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
2438
- * which suggests that browsers should use HTMLTableCellElement for
2439
- * both TD and TH elements. WhatWG separates these.
2440
- * Test: Object.prototype.toString.call(document.createElement('th'))
2441
- * - Chrome === "[object HTMLTableCellElement]"
2442
- * - Firefox === "[object HTMLTableCellElement]"
2443
- * - Safari === "[object HTMLTableCellElement]"
2444
- */
2445
- if (obj.tagName === 'TH') {
2446
- return 'HTMLTableHeaderCellElement';
2447
- }
2448
- }
2449
- }
2450
-
2451
- /* ! Speed optimisation
2452
- * Pre:
2453
- * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)
2454
- * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)
2455
- * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)
2456
- * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)
2457
- * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)
2458
- * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)
2459
- * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)
2460
- * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)
2461
- * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)
2462
- * Post:
2463
- * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)
2464
- * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)
2465
- * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)
2466
- * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)
2467
- * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)
2468
- * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)
2469
- * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)
2470
- * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)
2471
- * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)
2472
- */
2473
- var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);
2474
- if (typeof stringTag === 'string') {
2475
- return stringTag;
2476
- }
2477
-
2478
- var objPrototype = Object.getPrototypeOf(obj);
2479
- /* ! Speed optimisation
2480
- * Pre:
2481
- * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled)
2482
- * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled)
2483
- * Post:
2484
- * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled)
2485
- * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled)
2486
- */
2487
- if (objPrototype === RegExp.prototype) {
2488
- return 'RegExp';
2489
- }
2490
-
2491
- /* ! Speed optimisation
2492
- * Pre:
2493
- * date x 2,130,074 ops/sec ±4.42% (68 runs sampled)
2494
- * Post:
2495
- * date x 3,953,779 ops/sec ±1.35% (77 runs sampled)
2496
- */
2497
- if (objPrototype === Date.prototype) {
2498
- return 'Date';
2499
- }
2500
-
2501
- /* ! Spec Conformance
2502
- * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag)
2503
- * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise":
2504
- * Test: `Object.prototype.toString.call(Promise.resolve())``
2505
- * - Chrome <=47 === "[object Object]"
2506
- * - Edge <=20 === "[object Object]"
2507
- * - Firefox 29-Latest === "[object Promise]"
2508
- * - Safari 7.1-Latest === "[object Promise]"
2509
- */
2510
- if (promiseExists && objPrototype === Promise.prototype) {
2511
- return 'Promise';
2512
- }
2513
-
2514
- /* ! Speed optimisation
2515
- * Pre:
2516
- * set x 2,222,186 ops/sec ±1.31% (82 runs sampled)
2517
- * Post:
2518
- * set x 4,545,879 ops/sec ±1.13% (83 runs sampled)
2519
- */
2520
- if (setExists && objPrototype === Set.prototype) {
2521
- return 'Set';
2522
- }
2523
-
2524
- /* ! Speed optimisation
2525
- * Pre:
2526
- * map x 2,396,842 ops/sec ±1.59% (81 runs sampled)
2527
- * Post:
2528
- * map x 4,183,945 ops/sec ±6.59% (82 runs sampled)
2529
- */
2530
- if (mapExists && objPrototype === Map.prototype) {
2531
- return 'Map';
2532
- }
2533
-
2534
- /* ! Speed optimisation
2535
- * Pre:
2536
- * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled)
2537
- * Post:
2538
- * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled)
2539
- */
2540
- if (weakSetExists && objPrototype === WeakSet.prototype) {
2541
- return 'WeakSet';
2542
- }
2543
-
2544
- /* ! Speed optimisation
2545
- * Pre:
2546
- * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled)
2547
- * Post:
2548
- * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled)
2549
- */
2550
- if (weakMapExists && objPrototype === WeakMap.prototype) {
2551
- return 'WeakMap';
2552
- }
2553
-
2554
- /* ! Spec Conformance
2555
- * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag)
2556
- * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView":
2557
- * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))``
2558
- * - Edge <=13 === "[object Object]"
2559
- */
2560
- if (dataViewExists && objPrototype === DataView.prototype) {
2561
- return 'DataView';
2562
- }
2563
-
2564
- /* ! Spec Conformance
2565
- * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag)
2566
- * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator":
2567
- * Test: `Object.prototype.toString.call(new Map().entries())``
2568
- * - Edge <=13 === "[object Object]"
2569
- */
2570
- if (mapExists && objPrototype === mapIteratorPrototype) {
2571
- return 'Map Iterator';
2572
- }
2573
-
2574
- /* ! Spec Conformance
2575
- * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag)
2576
- * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator":
2577
- * Test: `Object.prototype.toString.call(new Set().entries())``
2578
- * - Edge <=13 === "[object Object]"
2579
- */
2580
- if (setExists && objPrototype === setIteratorPrototype) {
2581
- return 'Set Iterator';
2582
- }
2583
-
2584
- /* ! Spec Conformance
2585
- * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag)
2586
- * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator":
2587
- * Test: `Object.prototype.toString.call([][Symbol.iterator]())``
2588
- * - Edge <=13 === "[object Object]"
2589
- */
2590
- if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
2591
- return 'Array Iterator';
2592
- }
2593
-
2594
- /* ! Spec Conformance
2595
- * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag)
2596
- * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator":
2597
- * Test: `Object.prototype.toString.call(''[Symbol.iterator]())``
2598
- * - Edge <=13 === "[object Object]"
2599
- */
2600
- if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
2601
- return 'String Iterator';
2602
- }
2603
-
2604
- /* ! Speed optimisation
2605
- * Pre:
2606
- * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled)
2607
- * Post:
2608
- * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled)
2609
- */
2610
- if (objPrototype === null) {
2611
- return 'Object';
2612
- }
2613
-
2614
- return Object
2615
- .prototype
2616
- .toString
2617
- .call(obj)
2618
- .slice(toStringLeftSliceLength, toStringRightSliceLength);
2619
- }
2290
+ (function (global, factory) {
2291
+ module.exports = factory() ;
2292
+ }(commonjsGlobal, (function () {
2293
+ /* !
2294
+ * type-detect
2295
+ * Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
2296
+ * MIT Licensed
2297
+ */
2298
+ var promiseExists = typeof Promise === 'function';
2299
+
2300
+ /* eslint-disable no-undef */
2301
+ var globalObject = typeof self === 'object' ? self : commonjsGlobal; // eslint-disable-line id-blacklist
2302
+
2303
+ var symbolExists = typeof Symbol !== 'undefined';
2304
+ var mapExists = typeof Map !== 'undefined';
2305
+ var setExists = typeof Set !== 'undefined';
2306
+ var weakMapExists = typeof WeakMap !== 'undefined';
2307
+ var weakSetExists = typeof WeakSet !== 'undefined';
2308
+ var dataViewExists = typeof DataView !== 'undefined';
2309
+ var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
2310
+ var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
2311
+ var setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
2312
+ var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
2313
+ var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
2314
+ var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
2315
+ var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
2316
+ var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
2317
+ var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
2318
+ var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
2319
+ var toStringLeftSliceLength = 8;
2320
+ var toStringRightSliceLength = -1;
2321
+ /**
2322
+ * ### typeOf (obj)
2323
+ *
2324
+ * Uses `Object.prototype.toString` to determine the type of an object,
2325
+ * normalising behaviour across engine versions & well optimised.
2326
+ *
2327
+ * @param {Mixed} object
2328
+ * @return {String} object type
2329
+ * @api public
2330
+ */
2331
+ function typeDetect(obj) {
2332
+ /* ! Speed optimisation
2333
+ * Pre:
2334
+ * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)
2335
+ * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)
2336
+ * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)
2337
+ * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)
2338
+ * function x 2,556,769 ops/sec ±1.73% (77 runs sampled)
2339
+ * Post:
2340
+ * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)
2341
+ * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)
2342
+ * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)
2343
+ * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)
2344
+ * function x 31,296,870 ops/sec ±0.96% (83 runs sampled)
2345
+ */
2346
+ var typeofObj = typeof obj;
2347
+ if (typeofObj !== 'object') {
2348
+ return typeofObj;
2349
+ }
2350
+
2351
+ /* ! Speed optimisation
2352
+ * Pre:
2353
+ * null x 28,645,765 ops/sec ±1.17% (82 runs sampled)
2354
+ * Post:
2355
+ * null x 36,428,962 ops/sec ±1.37% (84 runs sampled)
2356
+ */
2357
+ if (obj === null) {
2358
+ return 'null';
2359
+ }
2360
+
2361
+ /* ! Spec Conformance
2362
+ * Test: `Object.prototype.toString.call(window)``
2363
+ * - Node === "[object global]"
2364
+ * - Chrome === "[object global]"
2365
+ * - Firefox === "[object Window]"
2366
+ * - PhantomJS === "[object Window]"
2367
+ * - Safari === "[object Window]"
2368
+ * - IE 11 === "[object Window]"
2369
+ * - IE Edge === "[object Window]"
2370
+ * Test: `Object.prototype.toString.call(this)``
2371
+ * - Chrome Worker === "[object global]"
2372
+ * - Firefox Worker === "[object DedicatedWorkerGlobalScope]"
2373
+ * - Safari Worker === "[object DedicatedWorkerGlobalScope]"
2374
+ * - IE 11 Worker === "[object WorkerGlobalScope]"
2375
+ * - IE Edge Worker === "[object WorkerGlobalScope]"
2376
+ */
2377
+ if (obj === globalObject) {
2378
+ return 'global';
2379
+ }
2380
+
2381
+ /* ! Speed optimisation
2382
+ * Pre:
2383
+ * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)
2384
+ * Post:
2385
+ * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
2386
+ */
2387
+ if (
2388
+ Array.isArray(obj) &&
2389
+ (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))
2390
+ ) {
2391
+ return 'Array';
2392
+ }
2393
+
2394
+ // Not caching existence of `window` and related properties due to potential
2395
+ // for `window` to be unset before tests in quasi-browser environments.
2396
+ if (typeof window === 'object' && window !== null) {
2397
+ /* ! Spec Conformance
2398
+ * (https://html.spec.whatwg.org/multipage/browsers.html#location)
2399
+ * WhatWG HTML$7.7.3 - The `Location` interface
2400
+ * Test: `Object.prototype.toString.call(window.location)``
2401
+ * - IE <=11 === "[object Object]"
2402
+ * - IE Edge <=13 === "[object Object]"
2403
+ */
2404
+ if (typeof window.location === 'object' && obj === window.location) {
2405
+ return 'Location';
2406
+ }
2407
+
2408
+ /* ! Spec Conformance
2409
+ * (https://html.spec.whatwg.org/#document)
2410
+ * WhatWG HTML$3.1.1 - The `Document` object
2411
+ * Note: Most browsers currently adher to the W3C DOM Level 2 spec
2412
+ * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268)
2413
+ * which suggests that browsers should use HTMLTableCellElement for
2414
+ * both TD and TH elements. WhatWG separates these.
2415
+ * WhatWG HTML states:
2416
+ * > For historical reasons, Window objects must also have a
2417
+ * > writable, configurable, non-enumerable property named
2418
+ * > HTMLDocument whose value is the Document interface object.
2419
+ * Test: `Object.prototype.toString.call(document)``
2420
+ * - Chrome === "[object HTMLDocument]"
2421
+ * - Firefox === "[object HTMLDocument]"
2422
+ * - Safari === "[object HTMLDocument]"
2423
+ * - IE <=10 === "[object Document]"
2424
+ * - IE 11 === "[object HTMLDocument]"
2425
+ * - IE Edge <=13 === "[object HTMLDocument]"
2426
+ */
2427
+ if (typeof window.document === 'object' && obj === window.document) {
2428
+ return 'Document';
2429
+ }
2430
+
2431
+ if (typeof window.navigator === 'object') {
2432
+ /* ! Spec Conformance
2433
+ * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray)
2434
+ * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray
2435
+ * Test: `Object.prototype.toString.call(navigator.mimeTypes)``
2436
+ * - IE <=10 === "[object MSMimeTypesCollection]"
2437
+ */
2438
+ if (typeof window.navigator.mimeTypes === 'object' &&
2439
+ obj === window.navigator.mimeTypes) {
2440
+ return 'MimeTypeArray';
2441
+ }
2442
+
2443
+ /* ! Spec Conformance
2444
+ * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
2445
+ * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray
2446
+ * Test: `Object.prototype.toString.call(navigator.plugins)``
2447
+ * - IE <=10 === "[object MSPluginsCollection]"
2448
+ */
2449
+ if (typeof window.navigator.plugins === 'object' &&
2450
+ obj === window.navigator.plugins) {
2451
+ return 'PluginArray';
2452
+ }
2453
+ }
2454
+
2455
+ if ((typeof window.HTMLElement === 'function' ||
2456
+ typeof window.HTMLElement === 'object') &&
2457
+ obj instanceof window.HTMLElement) {
2458
+ /* ! Spec Conformance
2459
+ * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
2460
+ * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement`
2461
+ * Test: `Object.prototype.toString.call(document.createElement('blockquote'))``
2462
+ * - IE <=10 === "[object HTMLBlockElement]"
2463
+ */
2464
+ if (obj.tagName === 'BLOCKQUOTE') {
2465
+ return 'HTMLQuoteElement';
2466
+ }
2467
+
2468
+ /* ! Spec Conformance
2469
+ * (https://html.spec.whatwg.org/#htmltabledatacellelement)
2470
+ * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`
2471
+ * Note: Most browsers currently adher to the W3C DOM Level 2 spec
2472
+ * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
2473
+ * which suggests that browsers should use HTMLTableCellElement for
2474
+ * both TD and TH elements. WhatWG separates these.
2475
+ * Test: Object.prototype.toString.call(document.createElement('td'))
2476
+ * - Chrome === "[object HTMLTableCellElement]"
2477
+ * - Firefox === "[object HTMLTableCellElement]"
2478
+ * - Safari === "[object HTMLTableCellElement]"
2479
+ */
2480
+ if (obj.tagName === 'TD') {
2481
+ return 'HTMLTableDataCellElement';
2482
+ }
2483
+
2484
+ /* ! Spec Conformance
2485
+ * (https://html.spec.whatwg.org/#htmltableheadercellelement)
2486
+ * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`
2487
+ * Note: Most browsers currently adher to the W3C DOM Level 2 spec
2488
+ * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
2489
+ * which suggests that browsers should use HTMLTableCellElement for
2490
+ * both TD and TH elements. WhatWG separates these.
2491
+ * Test: Object.prototype.toString.call(document.createElement('th'))
2492
+ * - Chrome === "[object HTMLTableCellElement]"
2493
+ * - Firefox === "[object HTMLTableCellElement]"
2494
+ * - Safari === "[object HTMLTableCellElement]"
2495
+ */
2496
+ if (obj.tagName === 'TH') {
2497
+ return 'HTMLTableHeaderCellElement';
2498
+ }
2499
+ }
2500
+ }
2501
+
2502
+ /* ! Speed optimisation
2503
+ * Pre:
2504
+ * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)
2505
+ * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)
2506
+ * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)
2507
+ * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)
2508
+ * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)
2509
+ * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)
2510
+ * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)
2511
+ * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)
2512
+ * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)
2513
+ * Post:
2514
+ * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)
2515
+ * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)
2516
+ * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)
2517
+ * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)
2518
+ * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)
2519
+ * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)
2520
+ * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)
2521
+ * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)
2522
+ * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)
2523
+ */
2524
+ var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);
2525
+ if (typeof stringTag === 'string') {
2526
+ return stringTag;
2527
+ }
2528
+
2529
+ var objPrototype = Object.getPrototypeOf(obj);
2530
+ /* ! Speed optimisation
2531
+ * Pre:
2532
+ * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled)
2533
+ * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled)
2534
+ * Post:
2535
+ * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled)
2536
+ * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled)
2537
+ */
2538
+ if (objPrototype === RegExp.prototype) {
2539
+ return 'RegExp';
2540
+ }
2541
+
2542
+ /* ! Speed optimisation
2543
+ * Pre:
2544
+ * date x 2,130,074 ops/sec ±4.42% (68 runs sampled)
2545
+ * Post:
2546
+ * date x 3,953,779 ops/sec ±1.35% (77 runs sampled)
2547
+ */
2548
+ if (objPrototype === Date.prototype) {
2549
+ return 'Date';
2550
+ }
2551
+
2552
+ /* ! Spec Conformance
2553
+ * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag)
2554
+ * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise":
2555
+ * Test: `Object.prototype.toString.call(Promise.resolve())``
2556
+ * - Chrome <=47 === "[object Object]"
2557
+ * - Edge <=20 === "[object Object]"
2558
+ * - Firefox 29-Latest === "[object Promise]"
2559
+ * - Safari 7.1-Latest === "[object Promise]"
2560
+ */
2561
+ if (promiseExists && objPrototype === Promise.prototype) {
2562
+ return 'Promise';
2563
+ }
2564
+
2565
+ /* ! Speed optimisation
2566
+ * Pre:
2567
+ * set x 2,222,186 ops/sec ±1.31% (82 runs sampled)
2568
+ * Post:
2569
+ * set x 4,545,879 ops/sec ±1.13% (83 runs sampled)
2570
+ */
2571
+ if (setExists && objPrototype === Set.prototype) {
2572
+ return 'Set';
2573
+ }
2574
+
2575
+ /* ! Speed optimisation
2576
+ * Pre:
2577
+ * map x 2,396,842 ops/sec ±1.59% (81 runs sampled)
2578
+ * Post:
2579
+ * map x 4,183,945 ops/sec ±6.59% (82 runs sampled)
2580
+ */
2581
+ if (mapExists && objPrototype === Map.prototype) {
2582
+ return 'Map';
2583
+ }
2584
+
2585
+ /* ! Speed optimisation
2586
+ * Pre:
2587
+ * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled)
2588
+ * Post:
2589
+ * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled)
2590
+ */
2591
+ if (weakSetExists && objPrototype === WeakSet.prototype) {
2592
+ return 'WeakSet';
2593
+ }
2594
+
2595
+ /* ! Speed optimisation
2596
+ * Pre:
2597
+ * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled)
2598
+ * Post:
2599
+ * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled)
2600
+ */
2601
+ if (weakMapExists && objPrototype === WeakMap.prototype) {
2602
+ return 'WeakMap';
2603
+ }
2604
+
2605
+ /* ! Spec Conformance
2606
+ * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag)
2607
+ * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView":
2608
+ * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))``
2609
+ * - Edge <=13 === "[object Object]"
2610
+ */
2611
+ if (dataViewExists && objPrototype === DataView.prototype) {
2612
+ return 'DataView';
2613
+ }
2614
+
2615
+ /* ! Spec Conformance
2616
+ * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag)
2617
+ * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator":
2618
+ * Test: `Object.prototype.toString.call(new Map().entries())``
2619
+ * - Edge <=13 === "[object Object]"
2620
+ */
2621
+ if (mapExists && objPrototype === mapIteratorPrototype) {
2622
+ return 'Map Iterator';
2623
+ }
2624
+
2625
+ /* ! Spec Conformance
2626
+ * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag)
2627
+ * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator":
2628
+ * Test: `Object.prototype.toString.call(new Set().entries())``
2629
+ * - Edge <=13 === "[object Object]"
2630
+ */
2631
+ if (setExists && objPrototype === setIteratorPrototype) {
2632
+ return 'Set Iterator';
2633
+ }
2634
+
2635
+ /* ! Spec Conformance
2636
+ * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag)
2637
+ * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator":
2638
+ * Test: `Object.prototype.toString.call([][Symbol.iterator]())``
2639
+ * - Edge <=13 === "[object Object]"
2640
+ */
2641
+ if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
2642
+ return 'Array Iterator';
2643
+ }
2644
+
2645
+ /* ! Spec Conformance
2646
+ * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag)
2647
+ * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator":
2648
+ * Test: `Object.prototype.toString.call(''[Symbol.iterator]())``
2649
+ * - Edge <=13 === "[object Object]"
2650
+ */
2651
+ if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
2652
+ return 'String Iterator';
2653
+ }
2654
+
2655
+ /* ! Speed optimisation
2656
+ * Pre:
2657
+ * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled)
2658
+ * Post:
2659
+ * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled)
2660
+ */
2661
+ if (objPrototype === null) {
2662
+ return 'Object';
2663
+ }
2664
+
2665
+ return Object
2666
+ .prototype
2667
+ .toString
2668
+ .call(obj)
2669
+ .slice(toStringLeftSliceLength, toStringRightSliceLength);
2670
+ }
2620
2671
 
2621
- return typeDetect;
2672
+ return typeDetect;
2622
2673
 
2623
- })));
2624
- }(typeDetect));
2674
+ })));
2675
+ } (typeDetect));
2625
2676
 
2626
2677
  var type = typeDetect.exports;
2627
2678
 
@@ -3089,6 +3140,7 @@ function withGlobal(_global) {
3089
3140
  target.parse = source.parse;
3090
3141
  target.UTC = source.UTC;
3091
3142
  target.prototype.toUTCString = source.prototype.toUTCString;
3143
+ target.isFake = true;
3092
3144
 
3093
3145
  return target;
3094
3146
  }
@@ -4299,6 +4351,14 @@ function withGlobal(_global) {
4299
4351
  );
4300
4352
  }
4301
4353
 
4354
+ if (_global.Date.isFake === true) {
4355
+ // Timers are already faked; this is a problem.
4356
+ // Make the user reset timers before continuing.
4357
+ throw new TypeError(
4358
+ "Can't install fake timers twice on the same global object."
4359
+ );
4360
+ }
4361
+
4302
4362
  // eslint-disable-next-line no-param-reassign
4303
4363
  config = typeof config !== "undefined" ? config : {};
4304
4364
  config.shouldAdvanceTime = config.shouldAdvanceTime || false;
@@ -4576,8 +4636,10 @@ class VitestUtils {
4576
4636
  });
4577
4637
  this._mocker = typeof __vitest_mocker__ !== "undefined" ? __vitest_mocker__ : null;
4578
4638
  this._mockedDate = null;
4579
- if (!this._mocker)
4580
- throw new Error("Vitest was initialized with native Node instead of Vite Node");
4639
+ if (!this._mocker) {
4640
+ const errorMsg = 'Vitest was initialized with native Node instead of Vite Node.\n\nOne of the following is possible:\n- "vitest" is imported outside of your tests (in that case, use "vitest/node" or import.meta.vitest)\n- "vitest" is imported inside "globalSetup" (use "setupFiles", because "globalSetup" runs in a different context)\n- Your dependency inside "node_modules" imports "vitest" directly (in that case, inline that dependency, using "deps.inline" config)\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n';
4641
+ throw new Error(errorMsg);
4642
+ }
4581
4643
  }
4582
4644
  useFakeTimers() {
4583
4645
  this._timers.useFakeTimers();
@@ -4689,26 +4751,4 @@ function isWatchMode() {
4689
4751
  return getRunningMode() === "watch";
4690
4752
  }
4691
4753
 
4692
- var index = /*#__PURE__*/Object.freeze({
4693
- __proto__: null,
4694
- suite: suite,
4695
- test: test,
4696
- describe: describe,
4697
- it: it,
4698
- runOnce: runOnce,
4699
- isFirstRun: isFirstRun,
4700
- beforeAll: beforeAll,
4701
- afterAll: afterAll,
4702
- beforeEach: beforeEach,
4703
- afterEach: afterEach,
4704
- assert: assert,
4705
- should: should,
4706
- chai: chai$1,
4707
- expect: expect,
4708
- vitest: vitest,
4709
- vi: vi,
4710
- getRunningMode: getRunningMode,
4711
- isWatchMode: isWatchMode
4712
- });
4713
-
4714
- export { RealDate as R, context as a, getSnapshotClient as b, clearContext as c, defaultSuite as d, setState as e, getFn as f, getHooks as g, getState as h, index as i, suite as j, describe as k, it as l, runOnce as m, isFirstRun as n, beforeAll as o, afterAll as p, beforeEach as q, resetRunOnceCounter as r, setHooks as s, test as t, afterEach as u, vi as v, expect as w, vitest as x, getRunningMode as y, isWatchMode as z };
4754
+ 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 };