vitest 1.2.1 → 1.3.0

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 (56) hide show
  1. package/LICENSE.md +29 -0
  2. package/dist/browser.d.ts +3 -2
  3. package/dist/browser.js +2 -1
  4. package/dist/chunks/{api-setup.omeaEsoT.js → api-setup.Xh60JpeM.js} +27 -64
  5. package/dist/chunks/{integrations-globals.9QpVy4UR.js → integrations-globals.FlQVNhQx.js} +6 -6
  6. package/dist/chunks/{runtime-runBaseTests.S8ZSFig3.js → runtime-runBaseTests.0UwIvo_U.js} +9 -9
  7. package/dist/cli-wrapper.js +1 -1
  8. package/dist/cli.js +1314 -69
  9. package/dist/config.cjs +1 -1
  10. package/dist/config.d.ts +1 -1
  11. package/dist/coverage.d.ts +3 -3
  12. package/dist/environments.d.ts +1 -1
  13. package/dist/environments.js +1 -1
  14. package/dist/execute.d.ts +3 -3
  15. package/dist/execute.js +2 -2
  16. package/dist/index.d.ts +74 -78
  17. package/dist/index.js +7 -7
  18. package/dist/node.d.ts +3 -3
  19. package/dist/node.js +21 -21
  20. package/dist/{reporters-rzC174PQ.d.ts → reporters-QGe8gs4b.d.ts} +147 -56
  21. package/dist/reporters.d.ts +1 -1
  22. package/dist/reporters.js +20 -6
  23. package/dist/runners.d.ts +6 -6
  24. package/dist/runners.js +10 -10
  25. package/dist/{suite-MFRDkZcV.d.ts → suite-xGC-mxBC.d.ts} +1 -1
  26. package/dist/suite.d.ts +3 -3
  27. package/dist/suite.js +3 -3
  28. package/dist/vendor/{base.4sEqnqgY.js → base.RpormaJz.js} +2 -2
  29. package/dist/vendor/{base.QYERqzkH.js → base.knFzp7G3.js} +1 -1
  30. package/dist/vendor/{benchmark.IlKmJkUU.js → benchmark.eeqk2rd8.js} +1 -1
  31. package/dist/vendor/{node.p6h5JSuL.js → cli-api.RIYLcWhB.js} +1559 -3672
  32. package/dist/vendor/{constants.i1PoEnhr.js → constants.K-Wf1PUy.js} +3 -1
  33. package/dist/vendor/{execute.edwByI27.js → execute.aFSzc0Da.js} +26 -26
  34. package/dist/vendor/{index.cAUulNDf.js → index.8bPxjt7g.js} +6 -1
  35. package/dist/vendor/{index.kwCLJK4i.js → index.CKbXK54q.js} +7 -3
  36. package/dist/vendor/{environments.sU0TD7wX.js → index.GVFv9dZ0.js} +3 -0
  37. package/dist/vendor/index.QcWmThJv.js +4927 -0
  38. package/dist/vendor/{index.rJjbcrrp.js → index.ir9i0ywP.js} +1 -1
  39. package/dist/vendor/{index.vs_-lzuF.js → index.n-Ib4UWN.js} +4 -3
  40. package/dist/vendor/{rpc.w4v8oCkK.js → rpc.joBhAkyK.js} +10 -1
  41. package/dist/vendor/setup-common.NSpEdAQm.js +45 -0
  42. package/dist/vendor/{vi.Bw2UL9c9.js → vi.-Nr_x6dl.js} +8 -5
  43. package/dist/vendor/{vm.9N6CwTZh.js → vm.UmCkcXp-.js} +39 -12
  44. package/dist/worker.js +5 -10
  45. package/dist/workers/forks.js +3 -3
  46. package/dist/workers/runVmTests.js +13 -9
  47. package/dist/workers/threads.js +3 -3
  48. package/dist/workers/vmForks.js +4 -4
  49. package/dist/workers/vmThreads.js +4 -4
  50. package/dist/workers.d.ts +3 -3
  51. package/dist/workers.js +8 -8
  52. package/globals.d.ts +2 -0
  53. package/jsdom.d.ts +6 -0
  54. package/package.json +26 -22
  55. package/dist/vendor/reporters.cA9x-5v-.js +0 -2664
  56. package/dist/vendor/setup-common.4GIL70qB.js +0 -29
@@ -23,4 +23,4 @@ function removeUndefinedValues(obj) {
23
23
  return obj;
24
24
  }
25
25
 
26
- export { isWindows as a, isNode as b, relativePath as c, isRunningInBenchmark as i, removeUndefinedValues as r };
26
+ export { isNode as a, removeUndefinedValues as b, isWindows as c, isRunningInBenchmark as i, relativePath as r };
@@ -1,7 +1,7 @@
1
- import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- import { b as bench } from './benchmark.IlKmJkUU.js';
1
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
+ import { b as bench } from './benchmark.eeqk2rd8.js';
3
3
  import { i as isFirstRun, a as runOnce } from './run-once.Olz_Zkd8.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.Bw2UL9c9.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.-Nr_x6dl.js';
5
5
  import { g as getWorkerState } from './global.CkGT_TMy.js';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
@@ -117,6 +117,7 @@ var VitestIndex = /*#__PURE__*/Object.freeze({
117
117
  isWatchMode: isWatchMode,
118
118
  it: it,
119
119
  onTestFailed: onTestFailed,
120
+ onTestFinished: onTestFinished,
120
121
  runOnce: runOnce,
121
122
  should: should,
122
123
  suite: suite,
@@ -1,5 +1,5 @@
1
1
  import { getSafeTimers } from '@vitest/utils';
2
- import { c as createBirpc } from './index.cAUulNDf.js';
2
+ import { c as createBirpc } from './index.8bPxjt7g.js';
3
3
  import { g as getWorkerState } from './global.CkGT_TMy.js';
4
4
 
5
5
  const { get } = Reflect;
@@ -51,6 +51,15 @@ function createRuntimeRpc(options) {
51
51
  },
52
52
  {
53
53
  eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
54
+ onTimeoutError(functionName, args) {
55
+ var _a;
56
+ let message = `[vitest-worker]: Timeout calling "${functionName}"`;
57
+ if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId")
58
+ message += ` with "${JSON.stringify(args)}"`;
59
+ if (functionName === "onUnhandledError")
60
+ message += ` with "${((_a = args[0]) == null ? void 0 : _a.message) || args[0]}"`;
61
+ throw new Error(message);
62
+ },
54
63
  ...options
55
64
  }
56
65
  ));
@@ -0,0 +1,45 @@
1
+ import { setSafeTimers } from '@vitest/utils';
2
+ import { addSerializer } from '@vitest/snapshot';
3
+ import { r as resetRunOnceCounter } from './run-once.Olz_Zkd8.js';
4
+
5
+ let globalSetup = false;
6
+ async function setupCommonEnv(config) {
7
+ resetRunOnceCounter();
8
+ setupDefines(config.defines);
9
+ if (globalSetup)
10
+ return;
11
+ globalSetup = true;
12
+ setSafeTimers();
13
+ if (config.globals)
14
+ (await import('../chunks/integrations-globals.FlQVNhQx.js')).registerApiGlobally();
15
+ }
16
+ function setupDefines(defines) {
17
+ for (const key in defines)
18
+ globalThis[key] = defines[key];
19
+ }
20
+ async function loadDiffConfig(config, executor) {
21
+ if (typeof config.diff !== "string")
22
+ return;
23
+ const diffModule = await executor.executeId(config.diff);
24
+ if (diffModule && typeof diffModule.default === "object" && diffModule.default != null)
25
+ return diffModule.default;
26
+ else
27
+ throw new Error(`invalid diff config file ${config.diff}. Must have a default export with config object`);
28
+ }
29
+ async function loadSnapshotSerializers(config, executor) {
30
+ const files = config.snapshotSerializers;
31
+ const snapshotSerializers = await Promise.all(
32
+ files.map(async (file) => {
33
+ const mo = await executor.executeId(file);
34
+ if (!mo || typeof mo.default !== "object" || mo.default === null)
35
+ throw new Error(`invalid snapshot serializer file ${file}. Must export a default object`);
36
+ const config2 = mo.default;
37
+ if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function")
38
+ throw new Error(`invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`);
39
+ return config2;
40
+ })
41
+ );
42
+ snapshotSerializers.forEach((serializer) => addSerializer(serializer));
43
+ }
44
+
45
+ export { loadSnapshotSerializers as a, loadDiffConfig as l, setupCommonEnv as s };
@@ -9,7 +9,7 @@ import { g as getFullName } from './tasks.IknbGB2n.js';
9
9
  import { g as getWorkerState, a as getCurrentEnvironment } from './global.CkGT_TMy.js';
10
10
  import { getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils';
11
11
  import { parseSingleStack } from '@vitest/utils/source-map';
12
- import { i as isChildProcess } from './base.QYERqzkH.js';
12
+ import { i as isChildProcess } from './base.knFzp7G3.js';
13
13
  import { R as RealDate, r as resetDate, m as mockDate } from './date.Ns1pGd_X.js';
14
14
  import { spyOn, fn, isMockFunction, mocks } from '@vitest/spy';
15
15
 
@@ -3036,6 +3036,7 @@ defaultImplementation.install;
3036
3036
  var withGlobal_1 = withGlobal;
3037
3037
 
3038
3038
  class FakeTimers {
3039
+ _global;
3039
3040
  _clock;
3040
3041
  _fakingTime;
3041
3042
  _fakingDate;
@@ -3050,6 +3051,7 @@ class FakeTimers {
3050
3051
  this._fakingDate = false;
3051
3052
  this._fakingTime = false;
3052
3053
  this._fakeTimers = withGlobal_1(global);
3054
+ this._global = global;
3053
3055
  }
3054
3056
  clearAllTimers() {
3055
3057
  if (this._fakingTime)
@@ -3130,11 +3132,11 @@ class FakeTimers {
3130
3132
  throw new Error("process.nextTick cannot be mocked inside child_process");
3131
3133
  const existingFakedMethods = (((_c = this._userConfig) == null ? void 0 : _c.toFake) || toFake).filter((method) => {
3132
3134
  switch (method) {
3133
- case "hrtime":
3134
- case "nextTick":
3135
- return typeof process !== "undefined" && method in process && process[method];
3135
+ case "setImmediate":
3136
+ case "clearImmediate":
3137
+ return method in this._global && this._global[method];
3136
3138
  default:
3137
- return method in globalThis && globalThis[method];
3139
+ return true;
3138
3140
  }
3139
3141
  });
3140
3142
  this._clock = this._fakeTimers.install({
@@ -3448,6 +3450,7 @@ function createVitest() {
3448
3450
  async importMock(path) {
3449
3451
  return _mocker.importMock(path, getImporter());
3450
3452
  },
3453
+ // this is typed in the interface so it's not necessary to type it here
3451
3454
  mocked(item, _options = {}) {
3452
3455
  return item;
3453
3456
  },
@@ -1,15 +1,15 @@
1
1
  import vm, { isContext } from 'node:vm';
2
- import { pathToFileURL, fileURLToPath } from 'node:url';
2
+ import { fileURLToPath, pathToFileURL } from 'node:url';
3
3
  import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
4
4
  import { createCustomConsole } from '../chunks/runtime-console.Iloo9fIt.js';
5
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.edwByI27.js';
5
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.aFSzc0Da.js';
6
6
  import { distDir } from '../path.js';
7
7
  import { dirname as dirname$1 } from 'node:path';
8
- import { statSync, readFileSync } from 'node:fs';
8
+ import { statSync, existsSync, readFileSync } from 'node:fs';
9
9
  import { isNodeBuiltin, isPrimitive, toArray, getCachedData, setCacheData } from 'vite-node/utils';
10
10
  import { createRequire, Module } from 'node:module';
11
11
  import { CSS_LANGS_RE, KNOWN_ASSET_RE } from 'vite-node/constants';
12
- import './index.rJjbcrrp.js';
12
+ import './index.ir9i0ywP.js';
13
13
  import { p as provideWorkerState } from './global.CkGT_TMy.js';
14
14
 
15
15
  const _require = createRequire(import.meta.url);
@@ -54,6 +54,9 @@ class CommonjsExecutor {
54
54
  requiresCache.set(this, _require2);
55
55
  return _require2;
56
56
  }
57
+ static register = () => {
58
+ throw new Error(`[vitest] "register" is not available when running in Vitest.`);
59
+ };
57
60
  _compile(code, filename) {
58
61
  const cjsModule = Module$1.wrap(code);
59
62
  const script = new vm.Script(cjsModule, {
@@ -283,8 +286,13 @@ class EsmExecutor {
283
286
  importModuleDynamically: this.executor.importModuleDynamically,
284
287
  initializeImportMeta: (meta, mod) => {
285
288
  meta.url = mod.identifier;
289
+ if (mod.identifier.startsWith("file:")) {
290
+ const filename = fileURLToPath(mod.identifier);
291
+ meta.filename = filename;
292
+ meta.dirname = dirname$1(filename);
293
+ }
286
294
  meta.resolve = (specifier, importer) => {
287
- return this.executor.resolve(specifier, importer ?? mod.identifier);
295
+ return this.executor.resolve(specifier, importer != null ? importer.toString() : mod.identifier);
288
296
  };
289
297
  }
290
298
  }
@@ -292,6 +300,14 @@ class EsmExecutor {
292
300
  this.moduleCache.set(fileUrl, m);
293
301
  return m;
294
302
  }
303
+ async createWebAssemblyModule(fileUrl, code) {
304
+ const cached = this.moduleCache.get(fileUrl);
305
+ if (cached)
306
+ return cached;
307
+ const m = this.loadWebAssemblyModule(code, fileUrl);
308
+ this.moduleCache.set(fileUrl, m);
309
+ return m;
310
+ }
295
311
  async loadWebAssemblyModule(source, identifier) {
296
312
  const cached = this.moduleCache.get(identifier);
297
313
  if (cached)
@@ -302,20 +318,20 @@ class EsmExecutor {
302
318
  const moduleLookup = {};
303
319
  for (const { module } of imports) {
304
320
  if (moduleLookup[module] === void 0) {
305
- const resolvedModule = await this.executor.resolveModule(
321
+ moduleLookup[module] = await this.executor.resolveModule(
306
322
  module,
307
323
  identifier
308
324
  );
309
- moduleLookup[module] = await this.evaluateModule(resolvedModule);
310
325
  }
311
326
  }
312
327
  const syntheticModule = new SyntheticModule$1(
313
328
  exports.map(({ name }) => name),
314
- () => {
329
+ async () => {
315
330
  const importsObject = {};
316
331
  for (const { module, name } of imports) {
317
332
  if (!importsObject[module])
318
333
  importsObject[module] = {};
334
+ await this.evaluateModule(moduleLookup[module]);
319
335
  importsObject[module][name] = moduleLookup[module].namespace[name];
320
336
  }
321
337
  const wasmInstance = new WebAssembly.Instance(
@@ -349,7 +365,7 @@ class EsmExecutor {
349
365
  throw new Error("Missing data URI encoding");
350
366
  if (encoding !== "base64")
351
367
  throw new Error(`Invalid data URI encoding: ${encoding}`);
352
- const module = await this.loadWebAssemblyModule(
368
+ const module = this.loadWebAssemblyModule(
353
369
  Buffer.from(match.groups.code, "base64"),
354
370
  identifier
355
371
  );
@@ -493,10 +509,12 @@ class ExternalModulesExecutor {
493
509
  return this.esm.evaluateModule(module);
494
510
  };
495
511
  resolveModule = async (specifier, referencer) => {
496
- const identifier = await this.resolve(specifier, referencer);
512
+ let identifier = this.resolve(specifier, referencer);
513
+ if (identifier instanceof Promise)
514
+ identifier = await identifier;
497
515
  return await this.createModule(identifier);
498
516
  };
499
- async resolve(specifier, parent) {
517
+ resolve(specifier, parent) {
500
518
  for (const resolver of this.resolvers) {
501
519
  const id = resolver(specifier, parent);
502
520
  if (id)
@@ -577,6 +595,8 @@ class ExternalModulesExecutor {
577
595
  type = "module";
578
596
  } else if (extension === ".cjs") {
579
597
  type = "commonjs";
598
+ } else if (extension === ".wasm") {
599
+ type = "wasm";
580
600
  } else {
581
601
  const pkgData = this.findNearestPackageData(normalize(pathUrl));
582
602
  type = pkgData.type === "module" ? "module" : "commonjs";
@@ -585,6 +605,11 @@ class ExternalModulesExecutor {
585
605
  }
586
606
  async createModule(identifier) {
587
607
  const { type, url, path } = this.getModuleInformation(identifier);
608
+ if ((type === "module" || type === "commonjs" || type === "wasm") && !existsSync(path)) {
609
+ const error = new Error(`Cannot find module '${path}'`);
610
+ error.code = "ERR_MODULE_NOT_FOUND";
611
+ throw error;
612
+ }
588
613
  switch (type) {
589
614
  case "data":
590
615
  return this.esm.createDataModule(identifier);
@@ -594,6 +619,8 @@ class ExternalModulesExecutor {
594
619
  }
595
620
  case "vite":
596
621
  return await this.vite.createViteModule(url);
622
+ case "wasm":
623
+ return await this.esm.createWebAssemblyModule(url, this.fs.readBuffer(path));
597
624
  case "module":
598
625
  return await this.esm.createEsModule(url, this.fs.readFile(path));
599
626
  case "commonjs": {
@@ -664,7 +691,7 @@ async function runVmTests(state) {
664
691
  provideWorkerState(context, state);
665
692
  context.process = process;
666
693
  context.global = context;
667
- context.console = createCustomConsole(state);
694
+ context.console = state.config.disableConsoleIntercept ? console : createCustomConsole(state);
668
695
  context.setImmediate = setImmediate;
669
696
  context.clearImmediate = clearImmediate;
670
697
  const stubs = getDefaultRequestStubs(context);
package/dist/worker.js CHANGED
@@ -2,13 +2,13 @@ import { pathToFileURL } from 'node:url';
2
2
  import { workerId } from 'tinypool';
3
3
  import { ViteNodeRunner, ModuleCacheMap } from 'vite-node/client';
4
4
  import { resolve, normalize } from 'pathe';
5
- import { e as environments } from './vendor/environments.sU0TD7wX.js';
6
- import { i as isChildProcess, s as setProcessTitle } from './vendor/base.QYERqzkH.js';
5
+ import { e as environments } from './vendor/index.GVFv9dZ0.js';
6
+ import { i as isChildProcess, s as setProcessTitle } from './vendor/base.knFzp7G3.js';
7
7
  import { createRequire } from 'node:module';
8
- import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.w4v8oCkK.js';
8
+ import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.joBhAkyK.js';
9
9
  import 'node:console';
10
10
  import '@vitest/utils';
11
- import './vendor/index.cAUulNDf.js';
11
+ import './vendor/index.8bPxjt7g.js';
12
12
  import './vendor/global.CkGT_TMy.js';
13
13
 
14
14
  function isBuiltinEnvironment(env) {
@@ -80,7 +80,6 @@ async function run(ctx) {
80
80
  const inspectorCleanup = setupInspect(ctx.config);
81
81
  process.env.VITEST_WORKER_ID = String(ctx.workerId);
82
82
  process.env.VITEST_POOL_ID = String(workerId);
83
- let state = null;
84
83
  try {
85
84
  if (ctx.worker[0] === ".")
86
85
  throw new Error(`Path to the test runner cannot be relative, received "${ctx.worker}"`);
@@ -96,7 +95,7 @@ async function run(ctx) {
96
95
  const environment = await loadEnvironment(ctx, rpc);
97
96
  if (ctx.environment.transformMode)
98
97
  environment.transformMode = ctx.environment.transformMode;
99
- state = {
98
+ const state = {
100
99
  ctx,
101
100
  // here we create a new one, workers can reassign this if they need to keep it non-isolated
102
101
  moduleCache: new ModuleCacheMap(),
@@ -118,10 +117,6 @@ async function run(ctx) {
118
117
  await rpcDone().catch(() => {
119
118
  });
120
119
  inspectorCleanup();
121
- if (state) {
122
- state.environment = null;
123
- state = null;
124
- }
125
120
  }
126
121
  }
127
122
 
@@ -1,10 +1,10 @@
1
1
  import v8 from 'node:v8';
2
2
  import { c as createForksRpcOptions, u as unwrapForksConfig } from '../vendor/utils.GbToHGHI.js';
3
- import { r as runBaseTests } from '../vendor/base.4sEqnqgY.js';
3
+ import { r as runBaseTests } from '../vendor/base.RpormaJz.js';
4
4
  import '@vitest/utils';
5
5
  import 'vite-node/client';
6
6
  import '../vendor/global.CkGT_TMy.js';
7
- import '../vendor/execute.edwByI27.js';
7
+ import '../vendor/execute.aFSzc0Da.js';
8
8
  import 'node:vm';
9
9
  import 'node:url';
10
10
  import 'vite-node/utils';
@@ -12,7 +12,7 @@ import 'pathe';
12
12
  import '@vitest/utils/error';
13
13
  import '../path.js';
14
14
  import 'node:fs';
15
- import '../vendor/base.QYERqzkH.js';
15
+ import '../vendor/base.knFzp7G3.js';
16
16
 
17
17
  class ForksBaseWorker {
18
18
  getRpcOptions() {
@@ -5,31 +5,32 @@ import timers from 'node:timers';
5
5
  import { performance } from 'node:perf_hooks';
6
6
  import { startTests } from '@vitest/runner';
7
7
  import { setupColors, createColors } from '@vitest/utils';
8
- import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.kwCLJK4i.js';
8
+ import { installSourcemapsSupport } from 'vite-node/source-map';
9
+ import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.CKbXK54q.js';
9
10
  import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
10
11
  import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
11
- import { V as VitestIndex } from '../vendor/index.vs_-lzuF.js';
12
- import { s as setupCommonEnv } from '../vendor/setup-common.4GIL70qB.js';
12
+ import { V as VitestIndex } from '../vendor/index.n-Ib4UWN.js';
13
+ import { s as setupCommonEnv } from '../vendor/setup-common.NSpEdAQm.js';
13
14
  import 'chai';
14
15
  import '@vitest/snapshot/environment';
15
16
  import 'pathe';
16
17
  import '../path.js';
17
18
  import 'node:url';
18
- import '../vendor/rpc.w4v8oCkK.js';
19
- import '../vendor/index.cAUulNDf.js';
20
- import '../vendor/benchmark.IlKmJkUU.js';
19
+ import '../vendor/rpc.joBhAkyK.js';
20
+ import '../vendor/index.8bPxjt7g.js';
21
+ import '../vendor/benchmark.eeqk2rd8.js';
21
22
  import '@vitest/runner/utils';
22
- import '../vendor/index.rJjbcrrp.js';
23
+ import '../vendor/index.ir9i0ywP.js';
23
24
  import 'std-env';
24
25
  import '../vendor/run-once.Olz_Zkd8.js';
25
- import '../vendor/vi.Bw2UL9c9.js';
26
+ import '../vendor/vi.-Nr_x6dl.js';
26
27
  import '../vendor/_commonjsHelpers.jjO7Zipk.js';
27
28
  import '@vitest/expect';
28
29
  import '@vitest/snapshot';
29
30
  import '@vitest/utils/error';
30
31
  import '../vendor/tasks.IknbGB2n.js';
31
32
  import '@vitest/utils/source-map';
32
- import '../vendor/base.QYERqzkH.js';
33
+ import '../vendor/base.knFzp7G3.js';
33
34
  import '../vendor/date.Ns1pGd_X.js';
34
35
  import '@vitest/spy';
35
36
 
@@ -53,6 +54,9 @@ async function run(files, config, executor) {
53
54
  util,
54
55
  timers
55
56
  };
57
+ installSourcemapsSupport({
58
+ getSourceMap: (source) => workerState.moduleCache.getSourceMap(source)
59
+ });
56
60
  await startCoverageInsideWorker(config.coverage, executor);
57
61
  if (config.chaiConfig)
58
62
  setupChaiConfig(config.chaiConfig);
@@ -1,8 +1,8 @@
1
- import { r as runBaseTests } from '../vendor/base.4sEqnqgY.js';
1
+ import { r as runBaseTests } from '../vendor/base.RpormaJz.js';
2
2
  import { a as createThreadsRpcOptions } from '../vendor/utils.GbToHGHI.js';
3
3
  import 'vite-node/client';
4
4
  import '../vendor/global.CkGT_TMy.js';
5
- import '../vendor/execute.edwByI27.js';
5
+ import '../vendor/execute.aFSzc0Da.js';
6
6
  import 'node:vm';
7
7
  import 'node:url';
8
8
  import 'vite-node/utils';
@@ -11,7 +11,7 @@ import '@vitest/utils/error';
11
11
  import '../path.js';
12
12
  import 'node:fs';
13
13
  import '@vitest/utils';
14
- import '../vendor/base.QYERqzkH.js';
14
+ import '../vendor/base.knFzp7G3.js';
15
15
 
16
16
  class ThreadsBaseWorker {
17
17
  getRpcOptions(ctx) {
@@ -1,6 +1,6 @@
1
1
  import v8 from 'node:v8';
2
2
  import { c as createForksRpcOptions, u as unwrapForksConfig } from '../vendor/utils.GbToHGHI.js';
3
- import { r as runVmTests } from '../vendor/vm.9N6CwTZh.js';
3
+ import { r as runVmTests } from '../vendor/vm.UmCkcXp-.js';
4
4
  import '@vitest/utils';
5
5
  import 'node:vm';
6
6
  import 'node:url';
@@ -10,16 +10,16 @@ import 'node:stream';
10
10
  import 'node:console';
11
11
  import 'node:path';
12
12
  import '../vendor/date.Ns1pGd_X.js';
13
- import '../vendor/execute.edwByI27.js';
13
+ import '../vendor/execute.aFSzc0Da.js';
14
14
  import 'vite-node/client';
15
15
  import 'vite-node/utils';
16
16
  import '@vitest/utils/error';
17
17
  import '../path.js';
18
18
  import 'node:fs';
19
- import '../vendor/base.QYERqzkH.js';
19
+ import '../vendor/base.knFzp7G3.js';
20
20
  import 'node:module';
21
21
  import 'vite-node/constants';
22
- import '../vendor/index.rJjbcrrp.js';
22
+ import '../vendor/index.ir9i0ywP.js';
23
23
  import 'std-env';
24
24
  import '@vitest/runner/utils';
25
25
  import '../vendor/global.CkGT_TMy.js';
@@ -1,5 +1,5 @@
1
1
  import { a as createThreadsRpcOptions } from '../vendor/utils.GbToHGHI.js';
2
- import { r as runVmTests } from '../vendor/vm.9N6CwTZh.js';
2
+ import { r as runVmTests } from '../vendor/vm.UmCkcXp-.js';
3
3
  import '@vitest/utils';
4
4
  import 'node:vm';
5
5
  import 'node:url';
@@ -9,16 +9,16 @@ import 'node:stream';
9
9
  import 'node:console';
10
10
  import 'node:path';
11
11
  import '../vendor/date.Ns1pGd_X.js';
12
- import '../vendor/execute.edwByI27.js';
12
+ import '../vendor/execute.aFSzc0Da.js';
13
13
  import 'vite-node/client';
14
14
  import 'vite-node/utils';
15
15
  import '@vitest/utils/error';
16
16
  import '../path.js';
17
17
  import 'node:fs';
18
- import '../vendor/base.QYERqzkH.js';
18
+ import '../vendor/base.knFzp7G3.js';
19
19
  import 'node:module';
20
20
  import 'vite-node/constants';
21
- import '../vendor/index.rJjbcrrp.js';
21
+ import '../vendor/index.ir9i0ywP.js';
22
22
  import 'std-env';
23
23
  import '@vitest/runner/utils';
24
24
  import '../vendor/global.CkGT_TMy.js';
package/dist/workers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v8 from 'v8';
2
- import { n as BirpcOptions, f as RuntimeRPC, o as ContextRPC, p as WorkerGlobalState, q as WorkerContext, R as ResolvedConfig } from './reporters-rzC174PQ.js';
2
+ import { n as BirpcOptions, f as RuntimeRPC, o as ContextRPC, p as WorkerGlobalState, q as WorkerContext, R as ResolvedConfig } from './reporters-QGe8gs4b.js';
3
3
  import { Awaitable } from '@vitest/utils';
4
4
  import 'vite';
5
5
  import '@vitest/runner';
@@ -17,8 +17,8 @@ import 'chai';
17
17
 
18
18
  type WorkerRpcOptions = Pick<BirpcOptions<RuntimeRPC>, 'on' | 'post' | 'serialize' | 'deserialize'>;
19
19
  interface VitestWorker {
20
- getRpcOptions(ctx: ContextRPC): WorkerRpcOptions;
21
- runTests(state: WorkerGlobalState): Awaitable<unknown>;
20
+ getRpcOptions: (ctx: ContextRPC) => WorkerRpcOptions;
21
+ runTests: (state: WorkerGlobalState) => Awaitable<unknown>;
22
22
  }
23
23
 
24
24
  declare function createThreadsRpcOptions({ port }: WorkerContext): WorkerRpcOptions;
package/dist/workers.js CHANGED
@@ -1,30 +1,30 @@
1
1
  export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapForksConfig } from './vendor/utils.GbToHGHI.js';
2
2
  export { p as provideWorkerState } from './vendor/global.CkGT_TMy.js';
3
3
  export { run as runVitestWorker } from './worker.js';
4
- export { r as runVmTests } from './vendor/vm.9N6CwTZh.js';
5
- export { r as runBaseTests } from './vendor/base.4sEqnqgY.js';
4
+ export { r as runVmTests } from './vendor/vm.UmCkcXp-.js';
5
+ export { r as runBaseTests } from './vendor/base.RpormaJz.js';
6
6
  import '@vitest/utils';
7
7
  import 'node:url';
8
8
  import 'tinypool';
9
9
  import 'vite-node/client';
10
10
  import 'pathe';
11
- import './vendor/environments.sU0TD7wX.js';
11
+ import './vendor/index.GVFv9dZ0.js';
12
12
  import 'node:console';
13
- import './vendor/base.QYERqzkH.js';
13
+ import './vendor/base.knFzp7G3.js';
14
14
  import 'node:module';
15
- import './vendor/rpc.w4v8oCkK.js';
16
- import './vendor/index.cAUulNDf.js';
15
+ import './vendor/rpc.joBhAkyK.js';
16
+ import './vendor/index.8bPxjt7g.js';
17
17
  import 'node:vm';
18
18
  import './chunks/runtime-console.Iloo9fIt.js';
19
19
  import 'node:stream';
20
20
  import 'node:path';
21
21
  import './vendor/date.Ns1pGd_X.js';
22
- import './vendor/execute.edwByI27.js';
22
+ import './vendor/execute.aFSzc0Da.js';
23
23
  import 'vite-node/utils';
24
24
  import '@vitest/utils/error';
25
25
  import './path.js';
26
26
  import 'node:fs';
27
27
  import 'vite-node/constants';
28
- import './vendor/index.rJjbcrrp.js';
28
+ import './vendor/index.ir9i0ywP.js';
29
29
  import 'std-env';
30
30
  import '@vitest/runner/utils';
package/globals.d.ts CHANGED
@@ -13,5 +13,7 @@ declare global {
13
13
  const afterAll: typeof import('vitest')['afterAll']
14
14
  const beforeEach: typeof import('vitest')['beforeEach']
15
15
  const afterEach: typeof import('vitest')['afterEach']
16
+ const onTestFailed: typeof import('vitest')['onTestFailed']
17
+ const onTestFinished: typeof import('vitest')['onTestFinished']
16
18
  }
17
19
  export {}
package/jsdom.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { JSDOM } from 'jsdom'
2
+
3
+ declare global {
4
+ const jsdom: JSDOM
5
+ }
6
+ export {}