vitest 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { runInThisContext } from 'node:vm';
2
2
  import * as spyModule from '@vitest/spy';
3
3
  import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
4
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startModuleRunner.C2tTvmF9.js';
4
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startModuleRunner.iF1E9Bt4.js';
5
5
  import { performance } from 'node:perf_hooks';
6
6
  import { startTests, collectTests } from '@vitest/runner';
7
7
  import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './resolveSnapshotEnvironment.DJJKMKxb.js';
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
619
619
 
620
620
  const cac = (name = "") => new CAC(name);
621
621
 
622
- var version = "4.0.0";
622
+ var version = "4.0.1";
623
623
 
624
624
  const apiConfig = (port) => ({
625
625
  port: {
@@ -1294,7 +1294,7 @@ function normalizeCliOptions(cliFilters, argv) {
1294
1294
  }
1295
1295
  async function start(mode, cliFilters, options) {
1296
1296
  try {
1297
- const { startVitest } = await import('./cli-api.PwHwIMss.js').then(function (n) { return n.p; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1297
+ const { startVitest } = await import('./cli-api.W2Q-JQoO.js').then(function (n) { return n.p; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1298
1298
  if (!ctx.shouldKeepServer()) await ctx.exit();
1299
1299
  } catch (e) {
1300
1300
  const { errorBanner } = await import('./index.CcRZ6fUh.js').then(function (n) { return n.u; });
@@ -1309,7 +1309,7 @@ async function init(project) {
1309
1309
  }
1310
1310
  async function collect(mode, cliFilters, options) {
1311
1311
  try {
1312
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.PwHwIMss.js').then(function (n) { return n.p; }), ctx = await prepareVitest(mode, {
1312
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.W2Q-JQoO.js').then(function (n) { return n.p; }), ctx = await prepareVitest(mode, {
1313
1313
  ...normalizeCliOptions(cliFilters, options),
1314
1314
  watch: false,
1315
1315
  run: true
@@ -11,7 +11,7 @@ import * as nodeos from 'node:os';
11
11
  import nodeos__default, { tmpdir } from 'node:os';
12
12
  import { generateHash as generateHash$1, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, hasFailed, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, getTasks, isTestCase } from '@vitest/runner/utils';
13
13
  import { SnapshotManager } from '@vitest/snapshot/manager';
14
- import { v as version$1 } from './cac.B99MQg-w.js';
14
+ import { v as version$1 } from './cac.DrF4Gm0S.js';
15
15
  import { c as createBirpc } from './index.Bgo3tNWt.js';
16
16
  import { p as parse, d as stringify, e as TraceMap, o as originalPositionFor, h as ancestor, i as printError, f as formatProjectName, w as withLabel, j as errorBanner, k as divider, l as Typechecker, m as generateCodeFrame, n as createDefinesScript, R as ReportersMap, B as BlobReporter, r as readBlobs, q as convertTasksToEvents, H as HangingProcessReporter } from './index.CcRZ6fUh.js';
17
17
  import require$$0$3 from 'events';
@@ -30,12 +30,12 @@ import { rootDir, distDir } from '../path.js';
30
30
  import createDebug from 'debug';
31
31
  import { h as hash, R as RandomSequencer, i as isPackageExists, c as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, a as resolveApiServerConfig } from './coverage.FU3w4IrQ.js';
32
32
  import { readFile, writeFile, rename, stat, unlink, rm, mkdir, copyFile } from 'node:fs/promises';
33
+ import { builtinModules, createRequire, isBuiltin } from 'node:module';
33
34
  import { VitestModuleEvaluator } from '#module-evaluator';
34
35
  import { ModuleRunner } from 'vite/module-runner';
35
36
  import { Console } from 'node:console';
36
37
  import c from 'tinyrainbow';
37
38
  import { highlight } from '@vitest/utils/highlight';
38
- import { createRequire, builtinModules, isBuiltin } from 'node:module';
39
39
  import url, { fileURLToPath, pathToFileURL } from 'node:url';
40
40
  import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
41
41
  import { isatty } from 'node:tty';
@@ -5818,13 +5818,16 @@ function normalizeResolvedIdToUrl(environment, resolvedId) {
5818
5818
  return url;
5819
5819
  }
5820
5820
 
5821
+ const nodeBuiltins = builtinModules.filter((id) => !id.includes(":"));
5821
5822
  class ServerModuleRunner extends ModuleRunner {
5822
5823
  constructor(environment, fetcher, config) {
5823
5824
  super({
5824
5825
  hmr: false,
5825
5826
  transport: { async invoke(event) {
5826
5827
  if (event.type !== "custom") throw new Error(`Vitest Module Runner doesn't support Vite HMR events.`);
5827
- const { data } = event.data;
5828
+ const { name, data } = event.data;
5829
+ if (name === "getBuiltins") return { result: [...nodeBuiltins, /^node:/] };
5830
+ if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
5828
5831
  try {
5829
5832
  return { result: await fetcher(data[0], data[1], environment, false, data[2]) };
5830
5833
  } catch (error) {
@@ -1,5 +1,5 @@
1
1
  import v8 from 'node:v8';
2
- import { i as init } from './init.B2EESLQM.js';
2
+ import { i as init } from './init.94FWN9pW.js';
3
3
 
4
4
  if (!process.send) throw new Error("Expected worker to be run in node:child_process");
5
5
  // Store globals in case tests overwrite them
@@ -1,5 +1,5 @@
1
1
  import { isMainThread, parentPort } from 'node:worker_threads';
2
- import { i as init } from './init.B2EESLQM.js';
2
+ import { i as init } from './init.94FWN9pW.js';
3
3
 
4
4
  if (isMainThread || !parentPort) throw new Error("Expected worker to be run in node:worker_threads");
5
5
  function workerInit(options) {
@@ -5,7 +5,7 @@ import { isBuiltin } from 'node:module';
5
5
  import { pathToFileURL } from 'node:url';
6
6
  import { resolve } from 'pathe';
7
7
  import { ModuleRunner } from 'vite/module-runner';
8
- import { b as VitestTransport } from './startModuleRunner.C2tTvmF9.js';
8
+ import { b as VitestTransport } from './startModuleRunner.iF1E9Bt4.js';
9
9
  import { e as environments } from './index.CbWINfS7.js';
10
10
  import { s as setupInspect } from './inspector.DLZxSeU3.js';
11
11
  import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
@@ -98,7 +98,7 @@ async function execute(method, ctx, worker) {
98
98
  if (!worker[methodName] || typeof worker[methodName] !== "function") throw new TypeError(`Test worker should expose "runTests" method. Received "${typeof worker.runTests}".`);
99
99
  await worker[methodName](state);
100
100
  } finally {
101
- await Promise.all(cleanups.map((fn) => fn())), await rpcDone().catch(() => {}), await environmentLoader?.close(), rpc.$close();
101
+ await rpcDone().catch(() => {}), await Promise.all(cleanups.map((fn) => fn())).catch(() => {}), await environmentLoader?.close();
102
102
  }
103
103
  }
104
104
  function run(ctx, worker) {
@@ -10,7 +10,7 @@ import { findNearestPackageData } from '@vitest/utils/resolver';
10
10
  import { dirname as dirname$1 } from 'node:path';
11
11
  import { CSS_LANGS_RE, KNOWN_ASSET_RE } from '@vitest/utils/constants';
12
12
  import { getDefaultRequestStubs } from '../module-evaluator.js';
13
- import { s as startVitestModuleRunner, c as createNodeImportMeta, a as VITEST_VM_CONTEXT_SYMBOL } from './startModuleRunner.C2tTvmF9.js';
13
+ import { s as startVitestModuleRunner, c as createNodeImportMeta, a as VITEST_VM_CONTEXT_SYMBOL } from './startModuleRunner.iF1E9Bt4.js';
14
14
  import { p as provideWorkerState } from './utils.CG9h5ccR.js';
15
15
 
16
16
  function interopCommonJsModule(interopDefault, mod) {
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.B99MQg-w.js';
1
+ import { c as createCLI } from './chunks/cac.DrF4Gm0S.js';
2
2
  import '@vitest/utils/helpers';
3
3
  import 'events';
4
4
  import 'pathe';
@@ -1,5 +1,5 @@
1
1
  export { VitestModuleEvaluator } from './module-evaluator.js';
2
- export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.C2tTvmF9.js';
2
+ export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.iF1E9Bt4.js';
3
3
  export { g as getWorkerState } from './chunks/utils.CG9h5ccR.js';
4
4
  import 'node:module';
5
5
  import 'node:url';
package/dist/node.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as vite from 'vite';
2
2
  import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
3
3
  export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
4
- import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.PwHwIMss.js';
5
- export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.PwHwIMss.js';
6
- export { p as parseCLI } from './chunks/cac.B99MQg-w.js';
4
+ import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.W2Q-JQoO.js';
5
+ export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.W2Q-JQoO.js';
6
+ export { p as parseCLI } from './chunks/cac.DrF4Gm0S.js';
7
7
  import { r as resolveConfig$2 } from './chunks/coverage.FU3w4IrQ.js';
8
8
  export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.FU3w4IrQ.js';
9
9
  import { slash, deepClone } from '@vitest/utils/helpers';
package/dist/worker.js CHANGED
@@ -1,11 +1,11 @@
1
- export { r as runBaseTests } from './chunks/base.CtHM3ryk.js';
2
- export { i as init } from './chunks/init.B2EESLQM.js';
1
+ export { r as runBaseTests } from './chunks/base.BYPMk0VN.js';
2
+ export { i as init } from './chunks/init.94FWN9pW.js';
3
3
  import 'node:vm';
4
4
  import '@vitest/spy';
5
5
  import './chunks/evaluatedModules.Dg1zASAC.js';
6
6
  import 'pathe';
7
7
  import 'vite/module-runner';
8
- import './chunks/startModuleRunner.C2tTvmF9.js';
8
+ import './chunks/startModuleRunner.iF1E9Bt4.js';
9
9
  import 'node:fs';
10
10
  import 'node:module';
11
11
  import '@vitest/utils/helpers';
@@ -1,11 +1,11 @@
1
- import { r as runBaseTests } from '../chunks/base.CtHM3ryk.js';
2
- import { w as workerInit } from '../chunks/init-forks.DSafeltJ.js';
1
+ import { r as runBaseTests } from '../chunks/base.BYPMk0VN.js';
2
+ import { w as workerInit } from '../chunks/init-forks.WglB-sfY.js';
3
3
  import 'node:vm';
4
4
  import '@vitest/spy';
5
5
  import '../chunks/evaluatedModules.Dg1zASAC.js';
6
6
  import 'pathe';
7
7
  import 'vite/module-runner';
8
- import '../chunks/startModuleRunner.C2tTvmF9.js';
8
+ import '../chunks/startModuleRunner.iF1E9Bt4.js';
9
9
  import 'node:fs';
10
10
  import 'node:module';
11
11
  import '@vitest/utils/helpers';
@@ -43,7 +43,7 @@ import '@vitest/utils/constants';
43
43
  import '../chunks/index.RwjEGCQ0.js';
44
44
  import 'expect-type';
45
45
  import 'node:v8';
46
- import '../chunks/init.B2EESLQM.js';
46
+ import '../chunks/init.94FWN9pW.js';
47
47
  import '../chunks/index.CbWINfS7.js';
48
48
  import 'node:console';
49
49
 
@@ -1,11 +1,11 @@
1
- import { r as runBaseTests } from '../chunks/base.CtHM3ryk.js';
2
- import { w as workerInit } from '../chunks/init-threads.SUtZ-067.js';
1
+ import { r as runBaseTests } from '../chunks/base.BYPMk0VN.js';
2
+ import { w as workerInit } from '../chunks/init-threads.Czek6eA5.js';
3
3
  import 'node:vm';
4
4
  import '@vitest/spy';
5
5
  import '../chunks/evaluatedModules.Dg1zASAC.js';
6
6
  import 'pathe';
7
7
  import 'vite/module-runner';
8
- import '../chunks/startModuleRunner.C2tTvmF9.js';
8
+ import '../chunks/startModuleRunner.iF1E9Bt4.js';
9
9
  import 'node:fs';
10
10
  import 'node:module';
11
11
  import '@vitest/utils/helpers';
@@ -43,7 +43,7 @@ import '@vitest/utils/constants';
43
43
  import '../chunks/index.RwjEGCQ0.js';
44
44
  import 'expect-type';
45
45
  import 'node:worker_threads';
46
- import '../chunks/init.B2EESLQM.js';
46
+ import '../chunks/init.94FWN9pW.js';
47
47
  import '../chunks/index.CbWINfS7.js';
48
48
  import 'node:console';
49
49
 
@@ -1,7 +1,7 @@
1
- import { w as workerInit } from '../chunks/init-forks.DSafeltJ.js';
2
- import { r as runVmTests } from '../chunks/vm.DBeOXrP9.js';
1
+ import { w as workerInit } from '../chunks/init-forks.WglB-sfY.js';
2
+ import { r as runVmTests } from '../chunks/vm.CuMWYx_F.js';
3
3
  import 'node:v8';
4
- import '../chunks/init.B2EESLQM.js';
4
+ import '../chunks/init.94FWN9pW.js';
5
5
  import '@vitest/utils/error';
6
6
  import '@vitest/utils/source-map';
7
7
  import 'node:fs';
@@ -9,7 +9,7 @@ import 'node:module';
9
9
  import 'node:url';
10
10
  import 'pathe';
11
11
  import 'vite/module-runner';
12
- import '../chunks/startModuleRunner.C2tTvmF9.js';
12
+ import '../chunks/startModuleRunner.iF1E9Bt4.js';
13
13
  import '@vitest/utils/helpers';
14
14
  import '../path.js';
15
15
  import 'node:path';
@@ -1,7 +1,7 @@
1
- import { w as workerInit } from '../chunks/init-threads.SUtZ-067.js';
2
- import { r as runVmTests } from '../chunks/vm.DBeOXrP9.js';
1
+ import { w as workerInit } from '../chunks/init-threads.Czek6eA5.js';
2
+ import { r as runVmTests } from '../chunks/vm.CuMWYx_F.js';
3
3
  import 'node:worker_threads';
4
- import '../chunks/init.B2EESLQM.js';
4
+ import '../chunks/init.94FWN9pW.js';
5
5
  import '@vitest/utils/error';
6
6
  import '@vitest/utils/source-map';
7
7
  import 'node:fs';
@@ -9,7 +9,7 @@ import 'node:module';
9
9
  import 'node:url';
10
10
  import 'pathe';
11
11
  import 'vite/module-runner';
12
- import '../chunks/startModuleRunner.C2tTvmF9.js';
12
+ import '../chunks/startModuleRunner.iF1E9Bt4.js';
13
13
  import '@vitest/utils/helpers';
14
14
  import '../path.js';
15
15
  import 'node:path';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "4.0.0",
4
+ "version": "4.0.1",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -134,10 +134,10 @@
134
134
  "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
135
135
  "happy-dom": "*",
136
136
  "jsdom": "*",
137
- "@vitest/browser-playwright": "4.0.0",
138
- "@vitest/browser-preview": "4.0.0",
139
- "@vitest/ui": "4.0.0",
140
- "@vitest/browser-webdriverio": "4.0.0"
137
+ "@vitest/browser-preview": "4.0.1",
138
+ "@vitest/browser-playwright": "4.0.1",
139
+ "@vitest/browser-webdriverio": "4.0.1",
140
+ "@vitest/ui": "4.0.1"
141
141
  },
142
142
  "peerDependenciesMeta": {
143
143
  "@edge-runtime/vm": {
@@ -182,13 +182,13 @@
182
182
  "tinyrainbow": "^3.0.3",
183
183
  "vite": "^6.0.0 || ^7.0.0",
184
184
  "why-is-node-running": "^2.3.0",
185
- "@vitest/expect": "4.0.0",
186
- "@vitest/mocker": "4.0.0",
187
- "@vitest/pretty-format": "4.0.0",
188
- "@vitest/runner": "4.0.0",
189
- "@vitest/snapshot": "4.0.0",
190
- "@vitest/utils": "4.0.0",
191
- "@vitest/spy": "4.0.0"
185
+ "@vitest/expect": "4.0.1",
186
+ "@vitest/mocker": "4.0.1",
187
+ "@vitest/pretty-format": "4.0.1",
188
+ "@vitest/runner": "4.0.1",
189
+ "@vitest/snapshot": "4.0.1",
190
+ "@vitest/spy": "4.0.1",
191
+ "@vitest/utils": "4.0.1"
192
192
  },
193
193
  "devDependencies": {
194
194
  "@antfu/install-pkg": "^1.1.0",
@@ -437,8 +437,8 @@ class VitestTransport {
437
437
  if (event.type !== "custom") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support Vite HMR events.`) };
438
438
  if (event.event !== "vite:invoke") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support ${event.event} event.`) };
439
439
  const { name, data } = event.data;
440
- if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
441
440
  if (name === "getBuiltins") return { result: [...nodeBuiltins, /^node:/] };
441
+ if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
442
442
  try {
443
443
  return { result: await this.options.fetchModule(...data) };
444
444
  } catch (error) {