vitest 0.34.2 → 0.34.4

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 (38) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +1 -1
  3. package/dist/child.js +2 -2
  4. package/dist/{chunk-api-setup.cc5282f7.js → chunk-api-setup.d65b007d.js} +4 -4
  5. package/dist/{chunk-install-pkg.7e19b3a0.js → chunk-install-pkg.b2bdbadc.js} +4 -3
  6. package/dist/{chunk-integrations-globals.522ae1ae.js → chunk-integrations-globals.09bbbed7.js} +3 -3
  7. package/dist/cli.js +9 -8
  8. package/dist/config.cjs +3 -1
  9. package/dist/config.d.ts +3 -3
  10. package/dist/config.js +3 -1
  11. package/dist/coverage.d.ts +3 -3
  12. package/dist/entry-vm.js +3 -3
  13. package/dist/entry.js +6 -3
  14. package/dist/environments.d.ts +3 -3
  15. package/dist/environments.js +1 -1
  16. package/dist/execute.d.ts +3 -3
  17. package/dist/execute.js +1 -1
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.js +4 -4
  20. package/dist/loader.js +1 -1
  21. package/dist/node.d.ts +4 -4
  22. package/dist/node.js +4 -3
  23. package/dist/{types-63abf2e0.d.ts → reporters-cb94c88b.d.ts} +18 -15
  24. package/dist/reporters.d.ts +16 -0
  25. package/dist/reporters.js +16 -0
  26. package/dist/runners.d.ts +3 -3
  27. package/dist/runners.js +2 -2
  28. package/dist/{vendor-environments.37f266a9.js → vendor-environments.c9c96bf7.js} +16 -4
  29. package/dist/{vendor-execute.4fc8203a.js → vendor-execute.a63e187f.js} +8 -6
  30. package/dist/{vendor-index.087d1af7.js → vendor-index.29282562.js} +1 -1
  31. package/dist/{vendor-index.b5efbd68.js → vendor-index.e951dd92.js} +1 -1
  32. package/dist/{vendor-node.7b1bd3c5.js → vendor-node.b14cb9ad.js} +156 -2669
  33. package/dist/vendor-reporters.f6975b8d.js +2584 -0
  34. package/dist/{vendor-vi.f8055ff2.js → vendor-vi.befc11a6.js} +24 -23
  35. package/dist/vm.js +2 -2
  36. package/dist/worker.js +2 -2
  37. package/package.json +12 -8
  38. package/reporters.d.ts +1 -0
package/dist/browser.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { startTests } from '@vitest/runner';
2
- import { R as ResolvedConfig, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule } from './types-63abf2e0.js';
3
- import '@vitest/snapshot';
4
- import '@vitest/expect';
2
+ import { R as ResolvedConfig, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule } from './reporters-cb94c88b.js';
5
3
  import 'vite';
6
4
  import 'vite-node';
5
+ import '@vitest/snapshot';
6
+ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
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.522ae1ae.js')).registerApiGlobally();
16
+ (await import('./chunk-integrations-globals.09bbbed7.js')).registerApiGlobally();
17
17
  }
18
18
  function setupDefines(defines) {
19
19
  for (const key in defines)
package/dist/child.js CHANGED
@@ -2,8 +2,8 @@ import { performance } from 'node:perf_hooks';
2
2
  import v8 from 'node:v8';
3
3
  import { c as createBirpc } from './vendor-index.b271ebe4.js';
4
4
  import { parseRegexp } from '@vitest/utils';
5
- import { l as loadEnvironment } from './vendor-environments.37f266a9.js';
6
- import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.4fc8203a.js';
5
+ import { l as loadEnvironment } from './vendor-environments.c9c96bf7.js';
6
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.a63e187f.js';
7
7
  import { r as rpcDone, c as createSafeRpc } from './vendor-rpc.cbd8e972.js';
8
8
  import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
9
9
  import 'node:url';
@@ -13,7 +13,7 @@ import require$$2$1 from 'http';
13
13
  import require$$7 from 'url';
14
14
  import { g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8.js';
15
15
  import { A as API_PATH } from './vendor-constants.538d9b49.js';
16
- import './vendor-index.087d1af7.js';
16
+ import './vendor-index.29282562.js';
17
17
  import '@vitest/utils';
18
18
  import { parseErrorStacktrace } from '@vitest/utils/source-map';
19
19
  import { i as isPrimitive } from './vendor-base.9c08bbd0.js';
@@ -4555,18 +4555,18 @@ function setup(vitestOrWorkspace, server) {
4555
4555
  },
4556
4556
  async saveTestFile(id, content) {
4557
4557
  if (!ctx.state.filesMap.has(id) || !existsSync(id))
4558
- return;
4558
+ throw new Error(`Test file "${id}" was not registered, so it cannot be updated using the API.`);
4559
4559
  return promises.writeFile(id, content, "utf-8");
4560
4560
  },
4561
4561
  async saveSnapshotFile(id, content) {
4562
4562
  if (!ctx.snapshot.resolvedPaths.has(id))
4563
- return;
4563
+ throw new Error(`Snapshot file "${id}" does not exist.`);
4564
4564
  await promises.mkdir(dirname(id), { recursive: true });
4565
4565
  return promises.writeFile(id, content, "utf-8");
4566
4566
  },
4567
4567
  async removeSnapshotFile(id) {
4568
4568
  if (!ctx.snapshot.resolvedPaths.has(id) || !existsSync(id))
4569
- return;
4569
+ throw new Error(`Snapshot file "${id}" does not exist.`);
4570
4570
  return promises.unlink(id);
4571
4571
  },
4572
4572
  snapshotSaved(snapshot) {
@@ -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.1f85e5f1.js';
7
- import { o as onetimeExports } from './vendor-node.7b1bd3c5.js';
7
+ import { o as onetimeExports } from './vendor-node.b14cb9ad.js';
8
8
  import require$$0 from 'os';
9
9
  import 'node:buffer';
10
10
  import 'node:path';
@@ -26,7 +26,7 @@ import 'vite-node/utils';
26
26
  import 'vite-node/client';
27
27
  import '@vitest/snapshot/manager';
28
28
  import 'vite-node/server';
29
- import './vendor-index.087d1af7.js';
29
+ import './vendor-index.29282562.js';
30
30
  import 'std-env';
31
31
  import '@vitest/runner/utils';
32
32
  import '@vitest/utils';
@@ -39,6 +39,7 @@ import './vendor-base.9c08bbd0.js';
39
39
  import 'node:worker_threads';
40
40
  import 'tinypool';
41
41
  import 'local-pkg';
42
+ import './vendor-reporters.f6975b8d.js';
42
43
  import 'node:perf_hooks';
43
44
  import './vendor-tasks.f9d75aed.js';
44
45
  import '@vitest/utils/source-map';
@@ -50,7 +51,7 @@ import 'acorn';
50
51
  import 'acorn-walk';
51
52
  import 'magic-string';
52
53
  import 'strip-literal';
53
- import './vendor-environments.37f266a9.js';
54
+ import './vendor-environments.c9c96bf7.js';
54
55
  import './vendor-index.0b5b3600.js';
55
56
  import 'node:assert';
56
57
  import 'node:console';
@@ -1,10 +1,10 @@
1
1
  import { g as globalApis } from './vendor-constants.538d9b49.js';
2
- import { i as index } from './vendor-index.b5efbd68.js';
2
+ import { i as index } from './vendor-index.e951dd92.js';
3
3
  import '@vitest/runner';
4
- import './vendor-vi.f8055ff2.js';
4
+ import './vendor-vi.befc11a6.js';
5
5
  import '@vitest/runner/utils';
6
6
  import '@vitest/utils';
7
- import './vendor-index.087d1af7.js';
7
+ import './vendor-index.29282562.js';
8
8
  import 'pathe';
9
9
  import 'std-env';
10
10
  import './vendor-global.97e4527c.js';
package/dist/cli.js CHANGED
@@ -1,8 +1,9 @@
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, d as divider } from './vendor-node.7b1bd3c5.js';
5
- import './vendor-index.087d1af7.js';
4
+ import { v as version, s as startVitest } from './vendor-node.b14cb9ad.js';
5
+ import './vendor-index.29282562.js';
6
+ import { d as divider } from './vendor-reporters.f6975b8d.js';
6
7
  import { t as toArray } from './vendor-base.9c08bbd0.js';
7
8
  import 'vite';
8
9
  import 'node:path';
@@ -32,11 +33,6 @@ import 'tinypool';
32
33
  import '@vitest/utils';
33
34
  import 'local-pkg';
34
35
  import 'std-env';
35
- import 'node:perf_hooks';
36
- import './vendor-tasks.f9d75aed.js';
37
- import '@vitest/runner/utils';
38
- import '@vitest/utils/source-map';
39
- import 'node:module';
40
36
  import 'node:crypto';
41
37
  import './vendor-index.1f85e5f1.js';
42
38
  import 'node:buffer';
@@ -44,19 +40,24 @@ import 'child_process';
44
40
  import 'assert';
45
41
  import 'buffer';
46
42
  import 'node:util';
43
+ import '@vitest/utils/source-map';
47
44
  import 'node:fs/promises';
48
45
  import 'module';
49
46
  import 'acorn';
50
47
  import 'acorn-walk';
48
+ import '@vitest/runner/utils';
51
49
  import 'magic-string';
52
50
  import 'strip-literal';
53
- import './vendor-environments.37f266a9.js';
51
+ import './vendor-environments.c9c96bf7.js';
54
52
  import './vendor-index.0b5b3600.js';
53
+ import 'node:module';
55
54
  import 'node:assert';
56
55
  import 'node:console';
57
56
  import 'node:readline';
58
57
  import 'readline';
59
58
  import './vendor-global.97e4527c.js';
59
+ import 'node:perf_hooks';
60
+ import './vendor-tasks.f9d75aed.js';
60
61
 
61
62
  const cli = cac("vitest");
62
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 }).help();
package/dist/config.cjs CHANGED
@@ -22,6 +22,7 @@ const defaultCoverageExcludes = [
22
22
  "**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)",
23
23
  "**/__tests__/**",
24
24
  "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
25
+ "**/vitest.{workspace,projects}.[jt]s?(on)",
25
26
  "**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
26
27
  ];
27
28
  const coverageConfigDefaults = {
@@ -33,7 +34,8 @@ const coverageConfigDefaults = {
33
34
  exclude: defaultCoverageExcludes,
34
35
  reportOnFailure: false,
35
36
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
36
- extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
37
+ extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"],
38
+ allowExternal: false
37
39
  };
38
40
  const fakeTimersDefaults = {
39
41
  loopLimit: 1e4,
package/dist/config.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
3
- import { c as ResolvedCoverageOptions, U as UserConfig, d as CoverageV8Options, P as ProjectConfig } from './types-63abf2e0.js';
4
- import '@vitest/snapshot';
5
- import '@vitest/expect';
3
+ import { c as ResolvedCoverageOptions, U as UserConfig, d as CoverageV8Options, P as ProjectConfig } from './reporters-cb94c88b.js';
6
4
  import '@vitest/runner';
7
5
  import 'vite-node';
6
+ import '@vitest/snapshot';
7
+ import '@vitest/expect';
8
8
  import '@vitest/runner/utils';
9
9
  import '@vitest/utils';
10
10
  import 'tinybench';
package/dist/config.js CHANGED
@@ -20,6 +20,7 @@ const defaultCoverageExcludes = [
20
20
  "**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)",
21
21
  "**/__tests__/**",
22
22
  "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
23
+ "**/vitest.{workspace,projects}.[jt]s?(on)",
23
24
  "**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
24
25
  ];
25
26
  const coverageConfigDefaults = {
@@ -31,7 +32,8 @@ const coverageConfigDefaults = {
31
32
  exclude: defaultCoverageExcludes,
32
33
  reportOnFailure: false,
33
34
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
34
- extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
35
+ extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"],
36
+ allowExternal: false
35
37
  };
36
38
  const fakeTimersDefaults = {
37
39
  loopLimit: 1e4,
@@ -1,9 +1,9 @@
1
- import { B as BaseCoverageOptions, c as ResolvedCoverageOptions } from './types-63abf2e0.js';
2
- import '@vitest/snapshot';
3
- import '@vitest/expect';
1
+ import { B as BaseCoverageOptions, c as ResolvedCoverageOptions } from './reporters-cb94c88b.js';
4
2
  import 'vite';
5
3
  import '@vitest/runner';
6
4
  import 'vite-node';
5
+ import '@vitest/snapshot';
6
+ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
package/dist/entry-vm.js CHANGED
@@ -6,7 +6,7 @@ import { setupColors, createColors } from '@vitest/utils';
6
6
  import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.9378c9a4.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.b5efbd68.js';
9
+ import { i as index } from './vendor-index.e951dd92.js';
10
10
  import { setupCommonEnv } from './browser.js';
11
11
  import 'chai';
12
12
  import '@vitest/snapshot/environment';
@@ -14,9 +14,9 @@ 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.f8055ff2.js';
17
+ import './vendor-vi.befc11a6.js';
18
18
  import '@vitest/runner/utils';
19
- import './vendor-index.087d1af7.js';
19
+ import './vendor-index.29282562.js';
20
20
  import 'std-env';
21
21
  import './vendor-_commonjsHelpers.7d1333e8.js';
22
22
  import '@vitest/expect';
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
- import './vendor-index.087d1af7.js';
4
- import { d as globalExpect, r as resetModules, v as vi } from './vendor-vi.f8055ff2.js';
3
+ import './vendor-index.29282562.js';
4
+ import { d as globalExpect, r as resetModules, v as vi } from './vendor-vi.befc11a6.js';
5
5
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor-coverage.78040316.js';
6
6
  import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.9378c9a4.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.b5efbd68.js';
11
+ import { i as index } from './vendor-index.e951dd92.js';
12
12
  import { setupCommonEnv } from './browser.js';
13
13
  import { g as getWorkerState } from './vendor-global.97e4527c.js';
14
14
  import 'pathe';
@@ -50,6 +50,9 @@ async function setupGlobalEnv(config, { environment }) {
50
50
  _require.extensions[".scss"] = () => ({});
51
51
  _require.extensions[".sass"] = () => ({});
52
52
  _require.extensions[".less"] = () => ({});
53
+ process.env.SSR = "";
54
+ } else {
55
+ process.env.SSR = "1";
53
56
  }
54
57
  installSourcemapsSupport({
55
58
  getSourceMap: (source) => state.moduleCache.getSourceMap(source)
@@ -1,9 +1,9 @@
1
- import { E as Environment } from './types-63abf2e0.js';
2
- import '@vitest/snapshot';
3
- import '@vitest/expect';
1
+ import { E as Environment } from './reporters-cb94c88b.js';
4
2
  import 'vite';
5
3
  import '@vitest/runner';
6
4
  import 'vite-node';
5
+ import '@vitest/snapshot';
6
+ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
@@ -1,4 +1,4 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './vendor-environments.37f266a9.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './vendor-environments.c9c96bf7.js';
2
2
  import 'node:url';
3
3
  import 'pathe';
4
4
  import './vendor-index.0b5b3600.js';
package/dist/execute.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import vm from 'node:vm';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
3
  import { ViteNodeRunnerOptions } from 'vite-node';
4
- import { h as PendingSuiteMock, M as MockFactory, i as WorkerGlobalState, j as MockMap, k as RuntimeRPC } from './types-63abf2e0.js';
5
- import '@vitest/snapshot';
6
- import '@vitest/expect';
4
+ import { h as PendingSuiteMock, M as MockFactory, i as WorkerGlobalState, j as MockMap, k as RuntimeRPC } from './reporters-cb94c88b.js';
7
5
  import 'vite';
8
6
  import '@vitest/runner';
7
+ import '@vitest/snapshot';
8
+ import '@vitest/expect';
9
9
  import '@vitest/runner/utils';
10
10
  import '@vitest/utils';
11
11
  import 'tinybench';
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './vendor-execute.4fc8203a.js';
1
+ export { V as VitestExecutor } from './vendor-execute.a63e187f.js';
2
2
  import 'node:url';
3
3
  import 'node:vm';
4
4
  import 'vite-node/client';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Test, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
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 { l as BenchmarkAPI, F as FakeTimerInstallOpts, m as MockFactoryWithHelper, n as RuntimeConfig, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './types-63abf2e0.js';
4
- export { I as ApiConfig, a4 as ArgumentsType, a3 as Arrayable, a1 as Awaitable, B as BaseCoverageOptions, ai as BenchFunction, ag as Benchmark, ah as BenchmarkResult, af as BenchmarkUserOptions, y as BuiltinEnvironment, G as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a6 as Constructable, x as Context, Z as ContextRPC, X as ContextTestEnvironment, ad as CoverageIstanbulOptions, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule, ac as CoverageReporter, d as CoverageV8Options, ae as CustomProviderOptions, L as DepsOptimizationOptions, E as Environment, K as EnvironmentOptions, a8 as EnvironmentReturn, H as HappyDOMOptions, O as InlineConfig, J as JSDOMOptions, a7 as ModuleCache, a5 as MutableArray, a2 as Nullable, aa as OnServerRestartHandler, P as ProjectConfig, r as RawErrsMap, ab as ReportContext, $ as ResolveIdFunction, c as ResolvedCoverageOptions, Y as ResolvedTestEnvironment, w as RootAndTarget, S as RunnerRPC, k as RuntimeRPC, N as TransformModePatterns, t as TscErrorInfo, Q as TypecheckConfig, U as UserConfig, e as Vitest, z as VitestEnvironment, D as VitestPool, V as VitestRunMode, a9 as VmEnvironmentReturn, _ as WorkerContext, i as WorkerGlobalState, a0 as WorkerRPC } from './types-63abf2e0.js';
3
+ import { l as BenchmarkAPI, F as FakeTimerInstallOpts, m as MockFactoryWithHelper, n as RuntimeConfig, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-cb94c88b.js';
4
+ export { I as ApiConfig, a4 as ArgumentsType, a3 as Arrayable, a1 as Awaitable, B as BaseCoverageOptions, ai as BenchFunction, ag as Benchmark, ah as BenchmarkResult, af as BenchmarkUserOptions, y as BuiltinEnvironment, G as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a6 as Constructable, x as Context, Z as ContextRPC, X as ContextTestEnvironment, ad as CoverageIstanbulOptions, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule, ac as CoverageReporter, d as CoverageV8Options, ae as CustomProviderOptions, L as DepsOptimizationOptions, E as Environment, K as EnvironmentOptions, a8 as EnvironmentReturn, H as HappyDOMOptions, O as InlineConfig, J as JSDOMOptions, a7 as ModuleCache, a5 as MutableArray, a2 as Nullable, aa as OnServerRestartHandler, P as ProjectConfig, r as RawErrsMap, ab as ReportContext, $ as ResolveIdFunction, c as ResolvedCoverageOptions, Y as ResolvedTestEnvironment, w as RootAndTarget, S as RunnerRPC, k as RuntimeRPC, N as TransformModePatterns, t as TscErrorInfo, Q as TypecheckConfig, U as UserConfig, e as Vitest, z as VitestEnvironment, D as VitestPool, V as VitestRunMode, a9 as VmEnvironmentReturn, _ as WorkerContext, i as WorkerGlobalState, a0 as WorkerRPC } from './reporters-cb94c88b.js';
5
5
  import { ExpectStatic } from '@vitest/expect';
6
6
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
7
7
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
@@ -351,7 +351,7 @@ interface VitestUtils {
351
351
  declare const vitest: VitestUtils;
352
352
  declare const vi: VitestUtils;
353
353
 
354
- declare function getRunningMode(): "run" | "watch";
354
+ declare function getRunningMode(): "watch" | "run";
355
355
  declare function isWatchMode(): boolean;
356
356
 
357
357
  interface TransformResultWithSource extends TransformResult {
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
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.f8055ff2.js';
2
+ export { e as bench, c as createExpect, d as expect, v as vi, f as vitest } from './vendor-vi.befc11a6.js';
3
3
  export { i as isFirstRun, r as runOnce } from './vendor-run-once.3e5ef7d7.js';
4
- import { d as dist } from './vendor-index.b5efbd68.js';
5
- export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.b5efbd68.js';
4
+ import { d as dist } from './vendor-index.e951dd92.js';
5
+ export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.e951dd92.js';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
8
8
  export { assert, should } from 'chai';
9
9
  import '@vitest/runner/utils';
10
10
  import '@vitest/utils';
11
- import './vendor-index.087d1af7.js';
11
+ import './vendor-index.29282562.js';
12
12
  import 'pathe';
13
13
  import 'std-env';
14
14
  import './vendor-global.97e4527c.js';
package/dist/loader.js CHANGED
@@ -2,7 +2,7 @@ import { pathToFileURL, fileURLToPath } from 'node:url';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { i as isNodeBuiltin, h as hasCJSSyntax } from './vendor-index.0b5b3600.js';
4
4
  import { normalizeModuleId } from 'vite-node/utils';
5
- import './vendor-index.087d1af7.js';
5
+ import './vendor-index.29282562.js';
6
6
  import { g as getWorkerState } from './vendor-global.97e4527c.js';
7
7
  import 'acorn';
8
8
  import 'node:module';
package/dist/node.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { V as VitestRunMode, U as UserConfig, e as Vitest, T as TestSequencer, W as WorkspaceSpec } from './types-63abf2e0.js';
2
- export { g as TestSequencerConstructor, f as VitestWorkspace, s as startVitest } from './types-63abf2e0.js';
1
+ import { V as VitestRunMode, U as UserConfig, e as Vitest, T as TestSequencer, W as WorkspaceSpec } from './reporters-cb94c88b.js';
2
+ export { g as TestSequencerConstructor, f as VitestWorkspace, s as startVitest } from './reporters-cb94c88b.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
- import '@vitest/snapshot';
5
- import '@vitest/expect';
6
4
  import '@vitest/runner';
7
5
  import 'vite-node';
6
+ import '@vitest/snapshot';
7
+ import '@vitest/expect';
8
8
  import '@vitest/runner/utils';
9
9
  import '@vitest/utils';
10
10
  import 'tinybench';
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.7b1bd3c5.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-node.b14cb9ad.js';
2
2
  import 'pathe';
3
3
  import 'vite';
4
4
  import 'node:path';
@@ -18,7 +18,7 @@ import 'vite-node/utils';
18
18
  import 'vite-node/client';
19
19
  import '@vitest/snapshot/manager';
20
20
  import 'vite-node/server';
21
- import './vendor-index.087d1af7.js';
21
+ import './vendor-index.29282562.js';
22
22
  import 'std-env';
23
23
  import '@vitest/runner/utils';
24
24
  import '@vitest/utils';
@@ -33,6 +33,7 @@ import 'node:worker_threads';
33
33
  import 'node:os';
34
34
  import 'tinypool';
35
35
  import 'local-pkg';
36
+ import './vendor-reporters.f6975b8d.js';
36
37
  import 'node:perf_hooks';
37
38
  import './vendor-tasks.f9d75aed.js';
38
39
  import '@vitest/utils/source-map';
@@ -50,7 +51,7 @@ import 'acorn';
50
51
  import 'acorn-walk';
51
52
  import 'magic-string';
52
53
  import 'strip-literal';
53
- import './vendor-environments.37f266a9.js';
54
+ import './vendor-environments.c9c96bf7.js';
54
55
  import './vendor-index.0b5b3600.js';
55
56
  import 'node:assert';
56
57
  import 'node:console';
@@ -1,10 +1,10 @@
1
- import { SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
2
- import { ExpectStatic } from '@vitest/expect';
3
1
  import * as vite from 'vite';
4
- import { ViteDevServer, UserConfig as UserConfig$1, TransformResult as TransformResult$1, CommonServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
2
+ import { ViteDevServer, UserConfig as UserConfig$1, TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
5
3
  import * as _vitest_runner from '@vitest/runner';
6
4
  import { File, Test as Test$1, Suite, TaskResultPack, Task, CancelReason, TaskCustom, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
7
5
  import { RawSourceMap, FetchResult, ViteNodeResolveId, ModuleCacheMap, ViteNodeServerOptions } from 'vite-node';
6
+ import { SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
7
+ import { ExpectStatic } from '@vitest/expect';
8
8
  import { ChainableFunction } from '@vitest/runner/utils';
9
9
  import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, Arrayable as Arrayable$1 } from '@vitest/utils';
10
10
  import { TaskResult, Bench, Options } from 'tinybench';
@@ -447,10 +447,6 @@ declare class Typechecker {
447
447
  getTestPacks(): TaskResultPack[];
448
448
  }
449
449
 
450
- interface InitializeServerOptions {
451
- server?: ViteNodeServer;
452
- runner?: ViteNodeRunner;
453
- }
454
450
  declare class WorkspaceProject {
455
451
  path: string | number;
456
452
  ctx: Vitest;
@@ -478,8 +474,9 @@ declare class WorkspaceProject {
478
474
  isTargetFile(id: string, source?: string): Promise<boolean>;
479
475
  isInSourceTestFile(code: string): boolean;
480
476
  filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
481
- initBrowserServer(options: UserConfig): Promise<void>;
482
- setServer(options: UserConfig, server: ViteDevServer, params?: InitializeServerOptions): Promise<void>;
477
+ initBrowserServer(configFile: string | undefined): Promise<void>;
478
+ static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
479
+ setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
483
480
  report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
484
481
  typecheck(filters?: string[]): Promise<void>;
485
482
  isBrowserEnabled(): boolean | 0;
@@ -709,7 +706,7 @@ declare class VitestCache {
709
706
  getFileStats(key: string): {
710
707
  size: number;
711
708
  } | undefined;
712
- static resolveCacheDir(root: string, dir: string | undefined): string;
709
+ static resolveCacheDir(root: string, dir: string | undefined, projectName: string | undefined): string;
713
710
  static clearCache(options: CliOptions): Promise<{
714
711
  dir: string;
715
712
  cleared: boolean;
@@ -747,7 +744,7 @@ declare class Vitest {
747
744
  private _onSetServer;
748
745
  private _onCancelListeners;
749
746
  setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
750
- private createCoreWorkspace;
747
+ private createCoreProject;
751
748
  getCoreWorkspaceProject(): WorkspaceProject | null;
752
749
  getProjectByTaskId(taskId: string): WorkspaceProject;
753
750
  private resolveWorkspace;
@@ -1235,7 +1232,7 @@ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
1235
1232
  provider?: T;
1236
1233
  } & (CoverageV8Options));
1237
1234
  /** Fields that have default values. Internally these will always be defined. */
1238
- type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure';
1235
+ type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal';
1239
1236
  type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
1240
1237
  reporter: CoverageReporterWithOptions[];
1241
1238
  };
@@ -1351,6 +1348,12 @@ interface BaseCoverageOptions {
1351
1348
  * @default false
1352
1349
  */
1353
1350
  reportOnFailure?: boolean;
1351
+ /**
1352
+ * Collect coverage of files outside the project `root`.
1353
+ *
1354
+ * @default false
1355
+ */
1356
+ allowExternal?: boolean;
1354
1357
  }
1355
1358
  interface CoverageIstanbulOptions extends BaseCoverageOptions {
1356
1359
  /**
@@ -1527,7 +1530,7 @@ type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1527
1530
  type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1528
1531
  type VitestPool = 'browser' | 'threads' | 'child_process' | 'experimentalVmThreads';
1529
1532
  type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
1530
- type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
1533
+ type ApiConfig = Pick<ServerOptions, 'port' | 'strictPort' | 'host' | 'middlewareMode'>;
1531
1534
 
1532
1535
  interface EnvironmentOptions {
1533
1536
  /**
@@ -1975,7 +1978,7 @@ interface InlineConfig {
1975
1978
  */
1976
1979
  uiBase?: string;
1977
1980
  /**
1978
- * Determine the transform method for all modules inported inside a test that matches the glob pattern.
1981
+ * Determine the transform method for all modules imported inside a test that matches the glob pattern.
1979
1982
  */
1980
1983
  testTransformMode?: TransformModePatterns;
1981
1984
  /**
@@ -2284,4 +2287,4 @@ type Context = RootAndTarget & {
2284
2287
  lastActivePath?: string;
2285
2288
  };
2286
2289
 
2287
- export { ResolveIdFunction as $, AfterSuiteRunMeta as A, BaseCoverageOptions as B, CoverageOptions as C, VitestPool as D, Environment as E, FakeTimerInstallOpts as F, CSSModuleScopeStrategy as G, HappyDOMOptions as H, ApiConfig as I, JSDOMOptions as J, EnvironmentOptions as K, DepsOptimizationOptions as L, MockFactory as M, TransformModePatterns as N, InlineConfig as O, ProjectConfig as P, TypecheckConfig as Q, ResolvedConfig as R, RunnerRPC as S, TestSequencer as T, UserConfig as U, VitestRunMode as V, WorkspaceSpec as W, ContextTestEnvironment as X, ResolvedTestEnvironment as Y, ContextRPC as Z, WorkerContext as _, CoverageProvider as a, WorkerRPC as a0, Awaitable as a1, Nullable as a2, Arrayable as a3, ArgumentsType$1 as a4, MutableArray as a5, Constructable as a6, ModuleCache as a7, EnvironmentReturn as a8, VmEnvironmentReturn as a9, OnServerRestartHandler as aa, ReportContext as ab, CoverageReporter as ac, CoverageIstanbulOptions as ad, CustomProviderOptions as ae, BenchmarkUserOptions as af, Benchmark as ag, BenchmarkResult as ah, BenchFunction as ai, CoverageProviderModule as b, ResolvedCoverageOptions as c, CoverageV8Options as d, Vitest as e, WorkspaceProject as f, TestSequencerConstructor as g, PendingSuiteMock as h, WorkerGlobalState as i, MockMap as j, RuntimeRPC as k, BenchmarkAPI as l, MockFactoryWithHelper as m, RuntimeConfig as n, UserConsoleLog as o, ModuleGraphData as p, Reporter as q, RawErrsMap as r, startVitest as s, TscErrorInfo as t, CollectLineNumbers as u, CollectLines as v, RootAndTarget as w, Context as x, BuiltinEnvironment as y, VitestEnvironment as z };
2290
+ export { ResolveIdFunction as $, AfterSuiteRunMeta as A, BaseCoverageOptions as B, CoverageOptions as C, VitestPool as D, Environment as E, FakeTimerInstallOpts as F, CSSModuleScopeStrategy as G, HappyDOMOptions as H, ApiConfig as I, JSDOMOptions as J, EnvironmentOptions as K, DepsOptimizationOptions as L, MockFactory as M, TransformModePatterns as N, InlineConfig as O, ProjectConfig as P, TypecheckConfig as Q, ResolvedConfig as R, RunnerRPC as S, TestSequencer as T, UserConfig as U, VitestRunMode as V, WorkspaceSpec as W, ContextTestEnvironment as X, ResolvedTestEnvironment as Y, ContextRPC as Z, WorkerContext as _, CoverageProvider as a, WorkerRPC as a0, Awaitable as a1, Nullable as a2, Arrayable as a3, ArgumentsType$1 as a4, MutableArray as a5, Constructable as a6, ModuleCache as a7, EnvironmentReturn as a8, VmEnvironmentReturn as a9, OnServerRestartHandler as aa, ReportContext as ab, CoverageReporter as ac, CoverageIstanbulOptions as ad, CustomProviderOptions as ae, BenchmarkUserOptions as af, Benchmark as ag, BenchmarkResult as ah, BenchFunction as ai, DefaultReporter as aj, BasicReporter as ak, DotReporter as al, JsonReporter$1 as am, VerboseReporter as an, TapReporter as ao, JUnitReporter as ap, TapFlatReporter as aq, HangingProcessReporter as ar, BaseReporter as as, ReportersMap as at, BuiltinReporters as au, BenchmarkReportsMap as av, BenchmarkBuiltinReporters as aw, CoverageProviderModule as b, ResolvedCoverageOptions as c, CoverageV8Options as d, Vitest as e, WorkspaceProject as f, TestSequencerConstructor as g, PendingSuiteMock as h, WorkerGlobalState as i, MockMap as j, RuntimeRPC as k, BenchmarkAPI as l, MockFactoryWithHelper as m, RuntimeConfig as n, UserConsoleLog as o, ModuleGraphData as p, Reporter as q, RawErrsMap as r, startVitest as s, TscErrorInfo as t, CollectLineNumbers as u, CollectLines as v, RootAndTarget as w, Context as x, BuiltinEnvironment as y, VitestEnvironment as z };
@@ -0,0 +1,16 @@
1
+ export { as as BaseReporter, ak as BasicReporter, aw as BenchmarkBuiltinReporters, av as BenchmarkReportsMap, au as BuiltinReporters, aj as DefaultReporter, al as DotReporter, ar as HangingProcessReporter, ap as JUnitReporter, am as JsonReporter, q as Reporter, at as ReportersMap, aq as TapFlatReporter, ao as TapReporter, an as VerboseReporter } from './reporters-cb94c88b.js';
2
+ import 'vite';
3
+ import '@vitest/runner';
4
+ import 'vite-node';
5
+ import '@vitest/snapshot';
6
+ import '@vitest/expect';
7
+ import '@vitest/runner/utils';
8
+ import '@vitest/utils';
9
+ import 'tinybench';
10
+ import 'vite-node/client';
11
+ import '@vitest/snapshot/manager';
12
+ import 'vite-node/server';
13
+ import 'node:worker_threads';
14
+ import 'rollup';
15
+ import 'node:fs';
16
+ import 'chai';
@@ -0,0 +1,16 @@
1
+ export { f as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, g as DotReporter, H as HangingProcessReporter, h as JUnitReporter, J as JsonReporter, R as ReportersMap, i as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor-reporters.f6975b8d.js';
2
+ import 'node:perf_hooks';
3
+ import 'picocolors';
4
+ import './vendor-index.29282562.js';
5
+ import 'pathe';
6
+ import 'std-env';
7
+ import '@vitest/runner/utils';
8
+ import '@vitest/utils';
9
+ import './vendor-global.97e4527c.js';
10
+ import './vendor-base.9c08bbd0.js';
11
+ import './vendor-tasks.f9d75aed.js';
12
+ import './vendor-_commonjsHelpers.7d1333e8.js';
13
+ import 'node:fs';
14
+ import '@vitest/utils/source-map';
15
+ import 'node:os';
16
+ import 'node:module';
package/dist/runners.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, TestContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './types-63abf2e0.js';
3
- import '@vitest/snapshot';
4
- import '@vitest/expect';
2
+ import { R as ResolvedConfig } from './reporters-cb94c88b.js';
5
3
  import 'vite';
6
4
  import 'vite-node';
5
+ import '@vitest/snapshot';
6
+ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
package/dist/runners.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.f8055ff2.js';
3
- import './vendor-index.087d1af7.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.befc11a6.js';
3
+ import './vendor-index.29282562.js';
4
4
  import { a as rpc } from './vendor-rpc.cbd8e972.js';
5
5
  import { g as getFullName } from './vendor-tasks.f9d75aed.js';
6
6
  import { g as getWorkerState } from './vendor-global.97e4527c.js';