vitest 0.34.5 → 1.0.0-beta.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 (39) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/child.js +23 -22
  4. package/dist/{chunk-api-setup.d65b007d.js → chunk-api-setup.0aeabd21.js} +1 -1
  5. package/dist/{chunk-install-pkg.e623b1bf.js → chunk-install-pkg.991b9ea3.js} +5 -4
  6. package/dist/{chunk-integrations-globals.5afac659.js → chunk-integrations-globals.c3c5e678.js} +4 -3
  7. package/dist/cli.js +11 -6
  8. package/dist/config.cjs +1 -2
  9. package/dist/config.d.ts +2 -3
  10. package/dist/config.js +1 -2
  11. package/dist/coverage.d.ts +1 -1
  12. package/dist/entry-vm.js +5 -4
  13. package/dist/entry.js +8 -4
  14. package/dist/environments.d.ts +1 -1
  15. package/dist/environments.js +1 -1
  16. package/dist/execute.d.ts +1 -1
  17. package/dist/index.d.ts +9 -10
  18. package/dist/index.js +4 -3
  19. package/dist/node.d.ts +2 -2
  20. package/dist/node.js +7 -6
  21. package/dist/{reporters-5f784f42.d.ts → reporters-7bd09217.d.ts} +165 -103
  22. package/dist/reporters.d.ts +1 -1
  23. package/dist/runners.d.ts +10 -10
  24. package/dist/runners.js +13 -12
  25. package/dist/suite-543d56bd.d.ts +10 -0
  26. package/dist/suite.d.ts +15 -1
  27. package/dist/suite.js +7 -1
  28. package/dist/vendor-benchmark.44931cfa.js +41 -0
  29. package/dist/{vendor-environments.b9b2f624.js → vendor-environments.e73c5410.js} +15 -4
  30. package/dist/{vendor-index.b271ebe4.js → vendor-index.1ca68bd5.js} +7 -5
  31. package/dist/{vendor-index.3e351f42.js → vendor-index.d36f5516.js} +5 -5
  32. package/dist/{vendor-index.7646b3af.js → vendor-index.f7fcd5e8.js} +2 -1
  33. package/dist/vendor-inspector.209edf5a.js +26 -0
  34. package/dist/{vendor-node.81dd929c.js → vendor-node.6fe91553.js} +413 -298
  35. package/dist/{vendor-vi.6873a1c1.js → vendor-vi.7f2b988f.js} +28 -53
  36. package/dist/vm.js +4 -5
  37. package/dist/worker.js +9 -7
  38. package/package.json +14 -13
  39. package/dist/vendor-inspector.47fc8cbb.js +0 -23
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startTests } from '@vitest/runner';
2
- import { R as ResolvedConfig, e as CoverageOptions, f as CoverageProvider, g as CoverageProviderModule } from './reporters-5f784f42.js';
2
+ import { R as ResolvedConfig, e as CoverageOptions, f as CoverageProvider, g as CoverageProviderModule } from './reporters-7bd09217.js';
3
3
  import { VitestExecutor } from './execute.js';
4
4
  import 'vite';
5
5
  import 'vite-node';
package/dist/browser.js CHANGED
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
13
13
  globalSetup = true;
14
14
  setSafeTimers();
15
15
  if (config.globals)
16
- (await import('./chunk-integrations-globals.5afac659.js')).registerApiGlobally();
16
+ (await import('./chunk-integrations-globals.c3c5e678.js')).registerApiGlobally();
17
17
  }
18
18
  function setupDefines(defines) {
19
19
  for (const key in defines)
package/dist/child.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import v8 from 'node:v8';
3
- import { c as createBirpc } from './vendor-index.b271ebe4.js';
3
+ import { c as createBirpc } from './vendor-index.1ca68bd5.js';
4
4
  import { parseRegexp } from '@vitest/utils';
5
- import { l as loadEnvironment } from './vendor-environments.b9b2f624.js';
5
+ import { workerId } from 'tinypool';
6
+ import { l as loadEnvironment } from './vendor-environments.e73c5410.js';
6
7
  import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.07d1a420.js';
7
8
  import { r as rpcDone, c as createSafeRpc } from './vendor-rpc.cbd8e972.js';
8
- import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
9
+ import { s as setupInspect } from './vendor-inspector.209edf5a.js';
9
10
  import 'pathe';
10
11
  import './vendor-index.0b5b3600.js';
11
12
  import 'acorn';
@@ -28,9 +29,13 @@ import './vendor-base.9c08bbd0.js';
28
29
  import 'vite-node/constants';
29
30
 
30
31
  async function init(ctx) {
31
- const { config } = ctx;
32
- process.env.VITEST_WORKER_ID = "1";
33
- process.env.VITEST_POOL_ID = "1";
32
+ const { config, workerId: workerId$1 } = ctx;
33
+ process.env.VITEST_WORKER_ID = String(workerId$1);
34
+ process.env.VITEST_POOL_ID = String(workerId);
35
+ try {
36
+ process.title = `node (vitest ${workerId})`;
37
+ } catch {
38
+ }
34
39
  let setCancel = (_reason) => {
35
40
  };
36
41
  const onCancel = new Promise((resolve) => {
@@ -49,15 +54,18 @@ async function init(ctx) {
49
54
  (_a = process.send) == null ? void 0 : _a.call(process, v);
50
55
  },
51
56
  on(fn) {
52
- process.on("message", fn);
57
+ process.on("message", (message, ...extras) => {
58
+ if (message == null ? void 0 : message.__tinypool_worker_message__)
59
+ return;
60
+ return fn(message, ...extras);
61
+ });
53
62
  }
54
63
  }
55
64
  ));
56
65
  const environment = await loadEnvironment(ctx.environment.name, {
57
66
  root: ctx.config.root,
58
- fetchModule(id) {
59
- return rpc.fetch(id, "ssr");
60
- }
67
+ fetchModule: (id) => rpc.fetch(id, "ssr"),
68
+ resolveId: (id, importer) => rpc.resolveId(id, importer, "ssr")
61
69
  });
62
70
  if (ctx.environment.transformMode)
63
71
  environment.transformMode = ctx.environment.transformMode;
@@ -72,7 +80,8 @@ async function init(ctx) {
72
80
  environment: 0,
73
81
  prepare: performance.now()
74
82
  },
75
- rpc
83
+ rpc,
84
+ isChildProcess: true
76
85
  };
77
86
  globalThis.__vitest_worker__ = state;
78
87
  if (ctx.invalidates) {
@@ -96,6 +105,8 @@ function unwrapConfig(config) {
96
105
  return config;
97
106
  }
98
107
  async function run(ctx) {
108
+ const exit = process.exit;
109
+ ctx.config = unwrapConfig(ctx.config);
99
110
  const inspectorCleanup = setupInspect(ctx.config);
100
111
  try {
101
112
  const state = await init(ctx);
@@ -106,18 +117,8 @@ async function run(ctx) {
106
117
  await rpcDone();
107
118
  } finally {
108
119
  inspectorCleanup();
120
+ process.exit = exit;
109
121
  }
110
122
  }
111
- const procesExit = process.exit;
112
- process.on("message", async (message) => {
113
- if (typeof message === "object" && message.command === "start") {
114
- try {
115
- message.config = unwrapConfig(message.config);
116
- await run(message);
117
- } finally {
118
- procesExit();
119
- }
120
- }
121
- });
122
123
 
123
124
  export { run };
@@ -1,6 +1,6 @@
1
1
  import { existsSync, promises } from 'node:fs';
2
2
  import { dirname } from 'pathe';
3
- import { c as createBirpc } from './vendor-index.b271ebe4.js';
3
+ import { c as createBirpc } from './vendor-index.1ca68bd5.js';
4
4
  import require$$0$2 from 'stream';
5
5
  import require$$0 from 'zlib';
6
6
  import require$$0$1 from 'buffer';
@@ -4,7 +4,7 @@ import { g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8
4
4
  import require$$2 from 'util';
5
5
  import require$$0$1 from 'child_process';
6
6
  import { p as pathKeyExports, s as signalExitExports, m as mergeStream$1, g as getStreamExports, c as crossSpawnExports } from './vendor-index.85fc950a.js';
7
- import { o as onetimeExports } from './vendor-node.81dd929c.js';
7
+ import { o as onetimeExports } from './vendor-node.6fe91553.js';
8
8
  import require$$0 from 'os';
9
9
  import 'node:buffer';
10
10
  import 'node:path';
@@ -34,10 +34,11 @@ import './vendor-global.97e4527c.js';
34
34
  import './vendor-coverage.78040316.js';
35
35
  import './vendor-paths.84fc7a99.js';
36
36
  import 'node:v8';
37
- import './vendor-index.b271ebe4.js';
37
+ import 'node:events';
38
+ import 'tinypool';
39
+ import './vendor-index.1ca68bd5.js';
38
40
  import './vendor-base.9c08bbd0.js';
39
41
  import 'node:worker_threads';
40
- import 'tinypool';
41
42
  import 'local-pkg';
42
43
  import './vendor-reporters.f6975b8d.js';
43
44
  import 'node:perf_hooks';
@@ -51,7 +52,7 @@ import 'acorn';
51
52
  import 'acorn-walk';
52
53
  import 'magic-string';
53
54
  import 'strip-literal';
54
- import './vendor-environments.b9b2f624.js';
55
+ import './vendor-environments.e73c5410.js';
55
56
  import './vendor-index.0b5b3600.js';
56
57
  import 'node:assert';
57
58
  import 'node:console';
@@ -1,13 +1,15 @@
1
1
  import { g as globalApis } from './vendor-constants.538d9b49.js';
2
- import { i as index } from './vendor-index.7646b3af.js';
2
+ import { i as index } from './vendor-index.f7fcd5e8.js';
3
3
  import '@vitest/runner';
4
- import './vendor-vi.6873a1c1.js';
4
+ import './vendor-benchmark.44931cfa.js';
5
5
  import '@vitest/runner/utils';
6
6
  import '@vitest/utils';
7
7
  import './vendor-index.29282562.js';
8
8
  import 'pathe';
9
9
  import 'std-env';
10
10
  import './vendor-global.97e4527c.js';
11
+ import './vendor-run-once.3e5ef7d7.js';
12
+ import './vendor-vi.7f2b988f.js';
11
13
  import 'chai';
12
14
  import './vendor-_commonjsHelpers.7d1333e8.js';
13
15
  import '@vitest/expect';
@@ -18,7 +20,6 @@ import '@vitest/utils/source-map';
18
20
  import 'util';
19
21
  import './vendor-date.6e993429.js';
20
22
  import '@vitest/spy';
21
- import './vendor-run-once.3e5ef7d7.js';
22
23
 
23
24
  function registerApiGlobally() {
24
25
  globalApis.forEach((api) => {
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { normalize } from 'pathe';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest } from './vendor-node.81dd929c.js';
4
+ import { v as version, s as startVitest } from './vendor-node.6fe91553.js';
5
5
  import './vendor-index.29282562.js';
6
6
  import { d as divider } from './vendor-reporters.f6975b8d.js';
7
7
  import { t as toArray } from './vendor-base.9c08bbd0.js';
@@ -25,17 +25,18 @@ import 'vite-node/server';
25
25
  import './vendor-coverage.78040316.js';
26
26
  import './vendor-paths.84fc7a99.js';
27
27
  import 'node:v8';
28
- import 'node:child_process';
29
- import './vendor-index.b271ebe4.js';
30
- import 'node:worker_threads';
31
28
  import 'node:os';
29
+ import 'node:events';
32
30
  import 'tinypool';
31
+ import './vendor-index.1ca68bd5.js';
32
+ import 'node:worker_threads';
33
33
  import '@vitest/utils';
34
34
  import 'local-pkg';
35
35
  import 'std-env';
36
36
  import 'node:crypto';
37
37
  import './vendor-index.85fc950a.js';
38
38
  import 'node:buffer';
39
+ import 'node:child_process';
39
40
  import 'child_process';
40
41
  import 'assert';
41
42
  import 'buffer';
@@ -48,7 +49,7 @@ import 'acorn-walk';
48
49
  import '@vitest/runner/utils';
49
50
  import 'magic-string';
50
51
  import 'strip-literal';
51
- import './vendor-environments.b9b2f624.js';
52
+ import './vendor-environments.e73c5410.js';
52
53
  import './vendor-index.0b5b3600.js';
53
54
  import 'node:module';
54
55
  import 'node:assert';
@@ -60,7 +61,7 @@ import 'node:perf_hooks';
60
61
  import './vendor-tasks.f9d75aed.js';
61
62
 
62
63
  const cli = cac("vitest");
63
- cli.version(version).option("-r, --root <path>", "Root path").option("-c, --config <path>", "Path to config file").option("-u, --update", "Update snapshot").option("-w, --watch", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp pattern").option("--dir <path>", "Base directory to scan for the test files").option("--ui", "Enable UI").option("--open", "Open UI automatically (default: !process.env.CI))").option("--api [api]", "Serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "Enabled threads (default: true)").option("--single-thread", "Run tests inside a single thread, requires --threads (default: false)").option("--experimental-vm-threads", "Run tests in a worker pool using VM isolation (default: false)").option("--experimental-vm-worker-memory-limit", "Set the maximum allowed memory for a worker. When reached, a new worker will be created instead").option("--silent", "Silent console output from tests").option("--hideSkippedTests", "Hide logs for skipped tests").option("--isolate", "Isolate environment for each test file (default: true)").option("--reporter <name>", "Specify reporters").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report").option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser api with happy-dom").option("--browser [options]", "Run tests in the browser (default: false)").option("--environment <env>", "Specify runner environment, if not running in the browser (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order, use --sequence.concurrent to run tests in parallel)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").option("--test-timeout <time>", "Default timeout of a test in milliseconds (default: 5000)").option("--bail <number>", "Stop test execution when given number of tests have failed", { default: 0 }).option("--retry <times>", "Retry the test specific number of times if it fails", { default: 0 }).option("--diff <path>", "Path to a diff config that will be used to generate diff interface").help();
64
+ cli.version(version).option("-r, --root <path>", "Root path").option("-c, --config <path>", "Path to config file").option("-u, --update", "Update snapshot").option("-w, --watch", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp pattern").option("--dir <path>", "Base directory to scan for the test files").option("--ui", "Enable UI").option("--open", "Open UI automatically (default: !process.env.CI))").option("--api [api]", "Serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--silent", "Silent console output from tests").option("--hideSkippedTests", "Hide logs for skipped tests").option("--reporter <name>", "Specify reporters").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report").option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser api with happy-dom").option("--browser [options]", "Run tests in the browser (default: false)").option("--pool <pool>", "Specify pool, if not running in the browser (default: threads)").option("--poolOptions <options>", "Specify pool options").option("--poolOptions.threads.isolate", "Isolate tests in threads pool (default: true)").option("--poolOptions.forks.isolate", "Isolate tests in forks pool (default: true)").option("--environment <env>", "Specify runner environment, if not running in the browser (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order, use --sequence.concurrent to run tests in parallel)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").option("--test-timeout <time>", "Default timeout of a test in milliseconds (default: 5000)").option("--bail <number>", "Stop test execution when given number of tests have failed", { default: 0 }).option("--retry <times>", "Retry the test specific number of times if it fails", { default: 0 }).option("--diff <path>", "Path to a diff config that will be used to generate diff interface").help();
64
65
  cli.command("run [...filters]").action(run);
65
66
  cli.command("related [...filters]").action(runRelated);
66
67
  cli.command("watch [...filters]").action(watch);
@@ -131,6 +132,10 @@ function normalizeCliOptions(argv) {
131
132
  return argv;
132
133
  }
133
134
  async function start(mode, cliFilters, options) {
135
+ try {
136
+ process.title = "node (vitest)";
137
+ } catch {
138
+ }
134
139
  try {
135
140
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
136
141
  if (!(ctx == null ? void 0 : ctx.shouldKeepServer()))
package/dist/config.cjs CHANGED
@@ -55,7 +55,7 @@ const config = {
55
55
  watch: !stdEnv.isCI,
56
56
  globals: false,
57
57
  environment: "node",
58
- threads: true,
58
+ pool: "threads",
59
59
  clearMocks: false,
60
60
  restoreMocks: false,
61
61
  mockReset: false,
@@ -64,7 +64,6 @@ const config = {
64
64
  testTimeout: 5e3,
65
65
  hookTimeout: 1e4,
66
66
  teardownTimeout: 1e4,
67
- isolate: true,
68
67
  watchExclude: ["**/node_modules/**", "**/dist/**"],
69
68
  forceRerunTriggers: [
70
69
  "**/package.json/**",
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
3
- import { a as ResolvedCoverageOptions, U as UserConfig, C as CoverageV8Options, P as ProjectConfig } from './reporters-5f784f42.js';
3
+ import { a as ResolvedCoverageOptions, U as UserConfig, C as CoverageV8Options, P as ProjectConfig } from './reporters-7bd09217.js';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
6
6
  import '@vitest/snapshot';
@@ -24,7 +24,7 @@ declare const config: {
24
24
  watch: boolean;
25
25
  globals: boolean;
26
26
  environment: "node";
27
- threads: boolean;
27
+ pool: string;
28
28
  clearMocks: boolean;
29
29
  restoreMocks: boolean;
30
30
  mockReset: boolean;
@@ -33,7 +33,6 @@ declare const config: {
33
33
  testTimeout: number;
34
34
  hookTimeout: number;
35
35
  teardownTimeout: number;
36
- isolate: boolean;
37
36
  watchExclude: string[];
38
37
  forceRerunTriggers: string[];
39
38
  update: boolean;
package/dist/config.js CHANGED
@@ -53,7 +53,7 @@ const config = {
53
53
  watch: !isCI,
54
54
  globals: false,
55
55
  environment: "node",
56
- threads: true,
56
+ pool: "threads",
57
57
  clearMocks: false,
58
58
  restoreMocks: false,
59
59
  mockReset: false,
@@ -62,7 +62,6 @@ const config = {
62
62
  testTimeout: 5e3,
63
63
  hookTimeout: 1e4,
64
64
  teardownTimeout: 1e4,
65
- isolate: true,
66
65
  watchExclude: ["**/node_modules/**", "**/dist/**"],
67
66
  forceRerunTriggers: [
68
67
  "**/package.json/**",
@@ -1,4 +1,4 @@
1
- import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-5f784f42.js';
1
+ import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-7bd09217.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/entry-vm.js CHANGED
@@ -3,10 +3,10 @@ import { createRequire } from 'node:module';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { startTests } from '@vitest/runner';
5
5
  import { setupColors, createColors } from '@vitest/utils';
6
- import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.3e351f42.js';
6
+ import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.d36f5516.js';
7
7
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor-coverage.78040316.js';
8
8
  import { g as getWorkerState } from './vendor-global.97e4527c.js';
9
- import { i as index } from './vendor-index.7646b3af.js';
9
+ import { i as index } from './vendor-index.f7fcd5e8.js';
10
10
  import { setupCommonEnv } from './browser.js';
11
11
  import 'chai';
12
12
  import '@vitest/snapshot/environment';
@@ -14,10 +14,12 @@ import 'pathe';
14
14
  import './vendor-paths.84fc7a99.js';
15
15
  import 'node:url';
16
16
  import './vendor-rpc.cbd8e972.js';
17
- import './vendor-vi.6873a1c1.js';
17
+ import './vendor-benchmark.44931cfa.js';
18
18
  import '@vitest/runner/utils';
19
19
  import './vendor-index.29282562.js';
20
20
  import 'std-env';
21
+ import './vendor-run-once.3e5ef7d7.js';
22
+ import './vendor-vi.7f2b988f.js';
21
23
  import './vendor-_commonjsHelpers.7d1333e8.js';
22
24
  import '@vitest/expect';
23
25
  import '@vitest/snapshot';
@@ -27,7 +29,6 @@ import '@vitest/utils/source-map';
27
29
  import 'util';
28
30
  import './vendor-date.6e993429.js';
29
31
  import '@vitest/spy';
30
- import './vendor-run-once.3e5ef7d7.js';
31
32
 
32
33
  async function run(files, config, executor) {
33
34
  const workerState = getWorkerState();
package/dist/entry.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { startTests } from '@vitest/runner';
3
3
  import './vendor-index.29282562.js';
4
- import { d as globalExpect, r as resetModules, v as vi } from './vendor-vi.6873a1c1.js';
4
+ import { a as globalExpect, r as resetModules, v as vi } from './vendor-vi.7f2b988f.js';
5
5
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor-coverage.78040316.js';
6
- import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.3e351f42.js';
6
+ import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.d36f5516.js';
7
7
  import { createRequire } from 'node:module';
8
8
  import { isatty } from 'node:tty';
9
9
  import { installSourcemapsSupport } from 'vite-node/source-map';
10
10
  import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
11
- import { i as index } from './vendor-index.7646b3af.js';
11
+ import { i as index } from './vendor-index.f7fcd5e8.js';
12
12
  import { setupCommonEnv } from './browser.js';
13
13
  import { g as getWorkerState } from './vendor-global.97e4527c.js';
14
14
  import 'pathe';
@@ -28,6 +28,7 @@ import '@vitest/snapshot/environment';
28
28
  import './vendor-paths.84fc7a99.js';
29
29
  import 'node:url';
30
30
  import './vendor-rpc.cbd8e972.js';
31
+ import './vendor-benchmark.44931cfa.js';
31
32
  import './vendor-run-once.3e5ef7d7.js';
32
33
 
33
34
  let globalSetup = false;
@@ -93,9 +94,12 @@ async function run(files, config, environment, executor) {
93
94
  workerState.environment = environment.environment;
94
95
  workerState.durations.environment = performance.now();
95
96
  await withEnv(environment, environment.options || config.environmentOptions || {}, async () => {
97
+ var _a, _b, _c, _d;
96
98
  workerState.durations.environment = performance.now() - workerState.durations.environment;
97
99
  for (const file of files) {
98
- if (config.isolate) {
100
+ const isIsolatedThreads = config.pool === "threads" && (((_b = (_a = config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.isolate) ?? true);
101
+ const isIsolatedForks = config.pool === "forks" && (((_d = (_c = config.poolOptions) == null ? void 0 : _c.forks) == null ? void 0 : _d.isolate) ?? true);
102
+ if (isIsolatedThreads || isIsolatedForks) {
99
103
  workerState.mockMap.clear();
100
104
  resetModules(workerState.moduleCache, true);
101
105
  }
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-5f784f42.js';
1
+ import { E as Environment } from './reporters-7bd09217.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -1,4 +1,4 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './vendor-environments.b9b2f624.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './vendor-environments.e73c5410.js';
2
2
  import 'pathe';
3
3
  import './vendor-index.0b5b3600.js';
4
4
  import 'acorn';
package/dist/execute.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import vm from 'node:vm';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
3
  import { ViteNodeRunnerOptions } from 'vite-node';
4
- import { ag as PendingSuiteMock, ah as MockFactory, Z as WorkerGlobalState, ai as MockMap, K as RuntimeRPC } from './reporters-5f784f42.js';
4
+ import { ah as PendingSuiteMock, ai as MockFactory, Z as WorkerGlobalState, aj as MockMap, K as RuntimeRPC } from './reporters-7bd09217.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { Test, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
- export { DoneCallback, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
- import { h as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, i as RuntimeConfig, A as AfterSuiteRunMeta, j as UserConsoleLog, R as ResolvedConfig, k as ModuleGraphData, l as Reporter } from './reporters-5f784f42.js';
4
- export { x as ApiConfig, a1 as ArgumentsType, a0 as Arrayable, _ as Awaitable, B as BaseCoverageOptions, af as BenchFunction, ad as Benchmark, ae as BenchmarkResult, ac as BenchmarkUserOptions, t as BuiltinEnvironment, w as CSSModuleScopeStrategy, o as CollectLineNumbers, p as CollectLines, a3 as Constructable, r as Context, Q as ContextRPC, N as ContextTestEnvironment, aa as CoverageIstanbulOptions, e as CoverageOptions, f as CoverageProvider, g as CoverageProviderModule, a9 as CoverageReporter, C as CoverageV8Options, ab as CustomProviderOptions, D as DepsOptimizationOptions, E as Environment, y as EnvironmentOptions, a5 as EnvironmentReturn, H as HappyDOMOptions, I as InlineConfig, J as JSDOMOptions, a4 as ModuleCache, a2 as MutableArray, $ as Nullable, a7 as OnServerRestartHandler, P as ProjectConfig, m as RawErrsMap, a8 as ReportContext, X as ResolveIdFunction, a as ResolvedCoverageOptions, O as ResolvedTestEnvironment, q as RootAndTarget, L as RunnerRPC, K as RuntimeRPC, z as TransformModePatterns, n as TscErrorInfo, G as TypecheckConfig, U as UserConfig, b as Vitest, u as VitestEnvironment, v as VitestPool, V as VitestRunMode, a6 as VmEnvironmentReturn, S as WorkerContext, Z as WorkerGlobalState, Y as WorkerRPC } from './reporters-5f784f42.js';
1
+ import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
+ export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
+ export { b as bench } from './suite-543d56bd.js';
5
4
  import { ExpectStatic } from '@vitest/expect';
6
5
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, h as RuntimeConfig, A as AfterSuiteRunMeta, i as UserConsoleLog, R as ResolvedConfig, j as ModuleGraphData, k as Reporter } from './reporters-7bd09217.js';
7
+ export { x as ApiConfig, a1 as ArgumentsType, a0 as Arrayable, _ as Awaitable, B as BaseCoverageOptions, af as BenchFunction, ad as Benchmark, ag as BenchmarkAPI, ae as BenchmarkResult, ac as BenchmarkUserOptions, u as BuiltinEnvironment, w as CSSModuleScopeStrategy, n as CollectLineNumbers, o as CollectLines, a3 as Constructable, q as Context, Q as ContextRPC, N as ContextTestEnvironment, aa as CoverageIstanbulOptions, e as CoverageOptions, f as CoverageProvider, g as CoverageProviderModule, a9 as CoverageReporter, C as CoverageV8Options, ab as CustomProviderOptions, D as DepsOptimizationOptions, E as Environment, y as EnvironmentOptions, a5 as EnvironmentReturn, H as HappyDOMOptions, I as InlineConfig, J as JSDOMOptions, a4 as ModuleCache, a2 as MutableArray, $ as Nullable, a7 as OnServerRestartHandler, r as Pool, t as PoolOptions, P as ProjectConfig, l as RawErrsMap, a8 as ReportContext, X as ResolveIdFunction, a as ResolvedCoverageOptions, O as ResolvedTestEnvironment, p as RootAndTarget, L as RunnerRPC, K as RuntimeRPC, z as TransformModePatterns, m as TscErrorInfo, G as TypecheckConfig, U as UserConfig, b as Vitest, v as VitestEnvironment, V as VitestRunMode, a6 as VmEnvironmentReturn, S as WorkerContext, Z as WorkerGlobalState, Y as WorkerRPC } from './reporters-7bd09217.js';
7
8
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
8
9
  export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
9
10
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
@@ -17,8 +18,8 @@ export { assert, should } from 'chai';
17
18
  export { UserWorkspaceConfig } from './config.js';
18
19
  export { ErrorWithDiff, ParsedStack } from '@vitest/utils';
19
20
  export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
20
- import 'vite-node';
21
21
  import '@vitest/runner/utils';
22
+ import 'vite-node';
22
23
  import 'vite-node/client';
23
24
  import '@vitest/snapshot/manager';
24
25
  import 'vite-node/server';
@@ -184,13 +185,11 @@ interface AssertType {
184
185
  }
185
186
  declare const assertType: AssertType;
186
187
 
187
- declare const bench: BenchmarkAPI;
188
-
189
188
  /**
190
189
  * This utils allows computational intensive tasks to only be ran once
191
190
  * across test reruns to improve the watch mode performance.
192
191
  *
193
- * Currently only works with `isolate: false`
192
+ * Currently only works with `poolOptions.<pool>.isolate: false`
194
193
  *
195
194
  * @experimental
196
195
  */
@@ -205,7 +204,7 @@ declare function runOnce<T>(fn: (() => T), key?: string): T;
205
204
  */
206
205
  declare function isFirstRun(): boolean;
207
206
 
208
- declare function createExpect(test?: Test): ExpectStatic;
207
+ declare function createExpect(test?: TaskPopulated): ExpectStatic;
209
208
  declare const globalExpect: ExpectStatic;
210
209
 
211
210
  type WaitForCallback<T> = () => T | Promise<T>;
@@ -408,4 +407,4 @@ interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' |
408
407
  onCancel(reason: CancelReason): void;
409
408
  }
410
409
 
411
- export { AfterSuiteRunMeta, AssertType, BenchmarkAPI, ExpectTypeOf, ModuleGraphData, Reporter, ResolvedConfig, RuntimeConfig, TransformResultWithSource, UserConsoleLog, WebSocketEvents, WebSocketHandlers, assertType, bench, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, isFirstRun, isWatchMode, runOnce, vi, vitest };
410
+ export { AfterSuiteRunMeta, AssertType, ExpectTypeOf, ModuleGraphData, Reporter, ResolvedConfig, RuntimeConfig, TransformResultWithSource, UserConsoleLog, WebSocketEvents, WebSocketHandlers, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, isFirstRun, isWatchMode, runOnce, vi, vitest };
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- export { e as bench, c as createExpect, d as expect, v as vi, f as vitest } from './vendor-vi.6873a1c1.js';
2
+ export { b as bench } from './vendor-benchmark.44931cfa.js';
3
3
  export { i as isFirstRun, r as runOnce } from './vendor-run-once.3e5ef7d7.js';
4
- import { d as dist } from './vendor-index.7646b3af.js';
5
- export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.7646b3af.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor-vi.7f2b988f.js';
5
+ import { d as dist } from './vendor-index.f7fcd5e8.js';
6
+ export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.f7fcd5e8.js';
6
7
  import * as chai from 'chai';
7
8
  export { chai };
8
9
  export { assert, should } from 'chai';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VitestRunMode, U as UserConfig, b as Vitest, T as TestSequencer, W as WorkspaceSpec } from './reporters-5f784f42.js';
2
- export { d as TestSequencerConstructor, c as VitestWorkspace, s as startVitest } from './reporters-5f784f42.js';
1
+ import { V as VitestRunMode, U as UserConfig, b as Vitest, T as TestSequencer, W as WorkspaceSpec } from './reporters-7bd09217.js';
2
+ export { d as TestSequencerConstructor, c as VitestWorkspace, s as startVitest } from './reporters-7bd09217.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-node.81dd929c.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-node.6fe91553.js';
2
2
  import 'pathe';
3
3
  import 'vite';
4
4
  import 'node:path';
@@ -26,12 +26,12 @@ import './vendor-global.97e4527c.js';
26
26
  import './vendor-coverage.78040316.js';
27
27
  import './vendor-paths.84fc7a99.js';
28
28
  import 'node:v8';
29
- import 'node:child_process';
30
- import './vendor-index.b271ebe4.js';
31
- import './vendor-base.9c08bbd0.js';
32
- import 'node:worker_threads';
33
29
  import 'node:os';
30
+ import 'node:events';
34
31
  import 'tinypool';
32
+ import './vendor-index.1ca68bd5.js';
33
+ import './vendor-base.9c08bbd0.js';
34
+ import 'node:worker_threads';
35
35
  import 'local-pkg';
36
36
  import './vendor-reporters.f6975b8d.js';
37
37
  import 'node:perf_hooks';
@@ -41,6 +41,7 @@ import 'node:module';
41
41
  import 'node:crypto';
42
42
  import './vendor-index.85fc950a.js';
43
43
  import 'node:buffer';
44
+ import 'node:child_process';
44
45
  import 'child_process';
45
46
  import 'assert';
46
47
  import 'buffer';
@@ -51,7 +52,7 @@ import 'acorn';
51
52
  import 'acorn-walk';
52
53
  import 'magic-string';
53
54
  import 'strip-literal';
54
- import './vendor-environments.b9b2f624.js';
55
+ import './vendor-environments.e73c5410.js';
55
56
  import './vendor-index.0b5b3600.js';
56
57
  import 'node:assert';
57
58
  import 'node:console';