vitest 1.0.0-beta.5 → 1.0.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 +7 -7
  4. package/dist/chunks/{integrations-globals.-pds_Gug.js → integrations-globals.eip0xL77.js} +3 -3
  5. package/dist/chunks/{runtime-console.iCAG0Yz3.js → runtime-console.hf2msWA9.js} +1 -1
  6. package/dist/cli.js +7 -7
  7. package/dist/config.cjs +6 -3
  8. package/dist/config.d.ts +1 -1
  9. package/dist/config.js +6 -3
  10. package/dist/coverage.d.ts +1 -1
  11. package/dist/entry-vm.js +3 -3
  12. package/dist/entry.js +4 -4
  13. package/dist/environments.d.ts +1 -1
  14. package/dist/environments.js +1 -1
  15. package/dist/execute.d.ts +1 -1
  16. package/dist/execute.js +1 -1
  17. package/dist/index.d.ts +5 -4
  18. package/dist/index.js +4 -4
  19. package/dist/node.d.ts +2 -2
  20. package/dist/node.js +5 -5
  21. package/dist/{reporters-ANEBTnOh.d.ts → reporters-LLiOBu3g.d.ts} +18 -5
  22. package/dist/reporters.d.ts +1 -1
  23. package/dist/reporters.js +3 -3
  24. package/dist/runners.d.ts +1 -1
  25. package/dist/runners.js +2 -2
  26. package/dist/{suite-C1OmA61l.d.ts → suite-SvxfaIxW.d.ts} +1 -1
  27. package/dist/suite.d.ts +2 -2
  28. package/dist/vendor/{date.W90-E5kF.js → date.Ns1pGd_X.js} +1 -0
  29. package/dist/vendor/{environments.hpEVJZPC.js → environments.hTqxBFDN.js} +4 -3
  30. package/dist/vendor/{execute.aMjV5C9u.js → execute.ILey0jnF.js} +24 -5
  31. package/dist/vendor/{index.Npc-eff0.js → index.VL3WbvjT.js} +1 -1
  32. package/dist/vendor/{loader.CU0NY2Is.js → loader.w8KTtIkD.js} +1 -1
  33. package/dist/vendor/{node.c-kzGvOB.js → node.qmjq0bgY.js} +54 -18
  34. package/dist/vendor/{reporters.1xKxm8im.js → reporters.pr8MinP9.js} +7 -5
  35. package/dist/vendor/{vi.voNYQWB_.js → vi.JXuS6emb.js} +1 -1
  36. package/dist/vm.js +5 -5
  37. package/dist/worker.js +3 -3
  38. package/import-meta.d.ts +5 -0
  39. package/package.json +14 -11
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- import { R as ResolvedConfig, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule } from './reporters-ANEBTnOh.js';
2
+ import { R as ResolvedConfig, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule } from './reporters-LLiOBu3g.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('./chunks/integrations-globals.-pds_Gug.js')).registerApiGlobally();
16
+ (await import('./chunks/integrations-globals.eip0xL77.js')).registerApiGlobally();
17
17
  }
18
18
  function setupDefines(defines) {
19
19
  for (const key in defines)
package/dist/child.js CHANGED
@@ -3,13 +3,13 @@ import v8 from 'node:v8';
3
3
  import { c as createBirpc } from './vendor/index.cAUulNDf.js';
4
4
  import { parseRegexp } from '@vitest/utils';
5
5
  import { workerId } from 'tinypool';
6
- import { l as loadEnvironment } from './vendor/loader.CU0NY2Is.js';
7
- import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.aMjV5C9u.js';
6
+ import { l as loadEnvironment } from './vendor/loader.w8KTtIkD.js';
7
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.ILey0jnF.js';
8
8
  import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
9
9
  import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
10
10
  import 'pathe';
11
11
  import 'vite-node/client';
12
- import './vendor/environments.hpEVJZPC.js';
12
+ import './vendor/environments.hTqxBFDN.js';
13
13
  import 'node:console';
14
14
  import 'local-pkg';
15
15
  import 'node:url';
@@ -24,14 +24,14 @@ import 'node:module';
24
24
  import 'vite-node/constants';
25
25
  import './vendor/global.L7JRz1qU.js';
26
26
 
27
+ try {
28
+ process.title = `node (vitest ${workerId})`;
29
+ } catch {
30
+ }
27
31
  async function init(ctx) {
28
32
  const { config, workerId: workerId$1, providedContext } = ctx;
29
33
  process.env.VITEST_WORKER_ID = String(workerId$1);
30
34
  process.env.VITEST_POOL_ID = String(workerId);
31
- try {
32
- process.title = `node (vitest ${workerId})`;
33
- } catch {
34
- }
35
35
  let setCancel = (_reason) => {
36
36
  };
37
37
  const onCancel = new Promise((resolve) => {
@@ -1,5 +1,5 @@
1
1
  import { g as globalApis } from '../vendor/constants.WSvnD_fn.js';
2
- import { i as index } from '../vendor/index.Npc-eff0.js';
2
+ import { i as index } from '../vendor/index.VL3WbvjT.js';
3
3
  import '@vitest/runner';
4
4
  import '../vendor/benchmark.WVm6DARl.js';
5
5
  import '@vitest/runner/utils';
@@ -9,7 +9,7 @@ import 'pathe';
9
9
  import 'std-env';
10
10
  import '../vendor/global.L7JRz1qU.js';
11
11
  import '../vendor/run-once.X3E7xx3F.js';
12
- import '../vendor/vi.voNYQWB_.js';
12
+ import '../vendor/vi.JXuS6emb.js';
13
13
  import 'chai';
14
14
  import '../vendor/_commonjsHelpers.jjO7Zipk.js';
15
15
  import '@vitest/expect';
@@ -17,7 +17,7 @@ import '@vitest/snapshot';
17
17
  import '@vitest/utils/error';
18
18
  import '../vendor/tasks.IknbGB2n.js';
19
19
  import '@vitest/utils/source-map';
20
- import '../vendor/date.W90-E5kF.js';
20
+ import '../vendor/date.Ns1pGd_X.js';
21
21
  import '@vitest/spy';
22
22
 
23
23
  function registerApiGlobally() {
@@ -2,7 +2,7 @@ import { Writable } from 'node:stream';
2
2
  import { Console } from 'node:console';
3
3
  import { relative } from 'node:path';
4
4
  import { getSafeTimers } from '@vitest/utils';
5
- import { R as RealDate } from '../vendor/date.W90-E5kF.js';
5
+ import { R as RealDate } from '../vendor/date.Ns1pGd_X.js';
6
6
 
7
7
  const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
8
8
  function getTaskIdByStack(root) {
package/dist/cli.js CHANGED
@@ -1,9 +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 } from './vendor/node.c-kzGvOB.js';
4
+ import { v as version, s as startVitest } from './vendor/node.qmjq0bgY.js';
5
5
  import './vendor/index.XU72Rmy8.js';
6
- import { d as divider } from './vendor/reporters.1xKxm8im.js';
6
+ import { d as divider } from './vendor/reporters.pr8MinP9.js';
7
7
  import { t as toArray } from './vendor/base._79unx2z.js';
8
8
  import 'vite';
9
9
  import 'node:path';
@@ -45,19 +45,19 @@ import 'node:crypto';
45
45
  import 'assert';
46
46
  import 'magic-string';
47
47
  import 'strip-literal';
48
- import './vendor/environments.hpEVJZPC.js';
48
+ import './vendor/environments.hTqxBFDN.js';
49
49
  import 'node:console';
50
50
  import 'node:readline';
51
51
  import 'readline';
52
52
  import './vendor/global.L7JRz1qU.js';
53
- import './chunks/runtime-console.iCAG0Yz3.js';
53
+ import './chunks/runtime-console.hf2msWA9.js';
54
54
  import 'node:stream';
55
- import './vendor/date.W90-E5kF.js';
55
+ import './vendor/date.Ns1pGd_X.js';
56
56
  import './vendor/tasks.IknbGB2n.js';
57
57
  import 'node:module';
58
58
 
59
59
  const cli = cac("vitest");
60
- 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").option("--expand-snapshot-diff", "Show full diff when snapshot fails").option("--typecheck [options]", "Custom options for typecheck pool").option("--typecheck.enabled", "Enable typechecking alongside tests (default: false)").option("--typecheck.only", "Run only typecheck tests. This automatically enables typecheck (default: false)").help();
60
+ 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").option("--expand-snapshot-diff", "Show full diff when snapshot fails").option("--typecheck [options]", "Custom options for typecheck pool").option("--typecheck.enabled", "Enable typechecking alongside tests (default: false)").option("--typecheck.only", "Run only typecheck tests. This automatically enables typecheck (default: false)").option("--project <name>", "The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2").help();
61
61
  cli.command("run [...filters]").action(run);
62
62
  cli.command("related [...filters]").action(runRelated);
63
63
  cli.command("watch [...filters]").action(watch);
@@ -98,7 +98,7 @@ async function run(cliFilters, options) {
98
98
  await start("test", cliFilters, options);
99
99
  }
100
100
  async function benchmark(cliFilters, options) {
101
- console.warn(c.yellow("Benchmarking is an experimental feature.\nBreaking changes might not follow semver, please pin Vitest's version when using it."));
101
+ console.warn(c.yellow("Benchmarking is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it."));
102
102
  await start("benchmark", cliFilters, options);
103
103
  }
104
104
  function normalizeCliOptions(argv) {
package/dist/config.cjs CHANGED
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ var os = require('node:os');
3
4
  var stdEnv = require('std-env');
4
5
  var vite = require('vite');
5
6
 
6
- var _a;
7
- typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
7
+ var _a$1;
8
+ typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
8
9
 
10
+ var _a, _b;
9
11
  const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
10
12
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*"];
11
13
  const defaultCoverageExcludes = [
@@ -37,7 +39,8 @@ const coverageConfigDefaults = {
37
39
  reportOnFailure: false,
38
40
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
39
41
  extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
40
- allowExternal: false
42
+ allowExternal: false,
43
+ processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
41
44
  };
42
45
  const fakeTimersDefaults = {
43
46
  loopLimit: 1e4,
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-ANEBTnOh.js';
3
+ import { a as ResolvedCoverageOptions, U as UserConfig, C as CoverageV8Options, P as ProjectConfig } from './reporters-LLiOBu3g.js';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
6
6
  import '@vitest/snapshot';
package/dist/config.js CHANGED
@@ -1,9 +1,11 @@
1
+ import os from 'node:os';
1
2
  import { isCI } from 'std-env';
2
3
  export { mergeConfig } from 'vite';
3
4
 
4
- var _a;
5
- typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
5
+ var _a$1;
6
+ typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
6
7
 
8
+ var _a, _b;
7
9
  const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
8
10
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*"];
9
11
  const defaultCoverageExcludes = [
@@ -35,7 +37,8 @@ const coverageConfigDefaults = {
35
37
  reportOnFailure: false,
36
38
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
37
39
  extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
38
- allowExternal: false
40
+ allowExternal: false,
41
+ processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
39
42
  };
40
43
  const fakeTimersDefaults = {
41
44
  loopLimit: 1e4,
@@ -1,4 +1,4 @@
1
- import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-ANEBTnOh.js';
1
+ import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-LLiOBu3g.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/entry-vm.js CHANGED
@@ -8,7 +8,7 @@ import { setupColors, createColors } from '@vitest/utils';
8
8
  import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor/index.h0j9y5vy.js';
9
9
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor/coverage.v6aD8iAh.js';
10
10
  import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
11
- import { i as index } from './vendor/index.Npc-eff0.js';
11
+ import { i as index } from './vendor/index.VL3WbvjT.js';
12
12
  import { setupCommonEnv } from './browser.js';
13
13
  import 'chai';
14
14
  import '@vitest/snapshot/environment';
@@ -21,14 +21,14 @@ import '@vitest/runner/utils';
21
21
  import './vendor/index.XU72Rmy8.js';
22
22
  import 'std-env';
23
23
  import './vendor/run-once.X3E7xx3F.js';
24
- import './vendor/vi.voNYQWB_.js';
24
+ import './vendor/vi.JXuS6emb.js';
25
25
  import './vendor/_commonjsHelpers.jjO7Zipk.js';
26
26
  import '@vitest/expect';
27
27
  import '@vitest/snapshot';
28
28
  import '@vitest/utils/error';
29
29
  import './vendor/tasks.IknbGB2n.js';
30
30
  import '@vitest/utils/source-map';
31
- import './vendor/date.W90-E5kF.js';
31
+ import './vendor/date.Ns1pGd_X.js';
32
32
  import '@vitest/spy';
33
33
 
34
34
  async function run(files, config, executor) {
package/dist/entry.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { startTests } from '@vitest/runner';
3
3
  import './vendor/index.XU72Rmy8.js';
4
- import { a as globalExpect, r as resetModules, v as vi } from './vendor/vi.voNYQWB_.js';
4
+ import { a as globalExpect, r as resetModules, v as vi } from './vendor/vi.JXuS6emb.js';
5
5
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor/coverage.v6aD8iAh.js';
6
6
  import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor/index.h0j9y5vy.js';
7
7
  import { createRequire } from 'node:module';
@@ -10,7 +10,7 @@ import timers from 'node:timers';
10
10
  import { isatty } from 'node:tty';
11
11
  import { installSourcemapsSupport } from 'vite-node/source-map';
12
12
  import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
13
- import { i as index } from './vendor/index.Npc-eff0.js';
13
+ import { i as index } from './vendor/index.VL3WbvjT.js';
14
14
  import { setupCommonEnv } from './browser.js';
15
15
  import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
16
16
  import 'pathe';
@@ -23,7 +23,7 @@ import '@vitest/snapshot';
23
23
  import '@vitest/utils/error';
24
24
  import './vendor/tasks.IknbGB2n.js';
25
25
  import '@vitest/utils/source-map';
26
- import './vendor/date.W90-E5kF.js';
26
+ import './vendor/date.Ns1pGd_X.js';
27
27
  import '@vitest/spy';
28
28
  import '@vitest/snapshot/environment';
29
29
  import './paths.js';
@@ -66,7 +66,7 @@ async function setupGlobalEnv(config, { environment }) {
66
66
  await setupConsoleLogSpy(state);
67
67
  }
68
68
  async function setupConsoleLogSpy(state) {
69
- const { createCustomConsole } = await import('./chunks/runtime-console.iCAG0Yz3.js');
69
+ const { createCustomConsole } = await import('./chunks/runtime-console.hf2msWA9.js');
70
70
  globalThis.console = createCustomConsole(state);
71
71
  }
72
72
  async function withEnv({ environment }, options, fn) {
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-ANEBTnOh.js';
1
+ import { E as Environment } from './reporters-LLiOBu3g.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -1,3 +1,3 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './vendor/environments.hpEVJZPC.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './vendor/environments.hTqxBFDN.js';
2
2
  import 'node:console';
3
3
  import 'local-pkg';
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 { am as PendingSuiteMock, an as MockFactory, ao as MockMap, a2 as WorkerGlobalState, g as RuntimeRPC } from './reporters-ANEBTnOh.js';
4
+ import { am as PendingSuiteMock, an as MockFactory, ao as MockMap, a2 as WorkerGlobalState, g as RuntimeRPC } from './reporters-LLiOBu3g.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './vendor/execute.aMjV5C9u.js';
1
+ export { V as VitestExecutor } from './vendor/execute.ILey0jnF.js';
2
2
  import 'node:url';
3
3
  import 'node:vm';
4
4
  import 'vite-node/client';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
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-C1OmA61l.js';
3
+ export { b as bench } from './suite-SvxfaIxW.js';
4
4
  import { ExpectStatic } from '@vitest/expect';
5
5
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
6
- import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, n as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-ANEBTnOh.js';
7
- export { K as ApiConfig, a6 as ArgumentsType, a5 as Arrayable, a3 as Awaitable, B as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, D as BuiltinEnvironment, I as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a8 as Constructable, x as Context, _ as ContextRPC, Y as ContextTestEnvironment, af as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ae as CoverageReporter, C as CoverageV8Options, ag as CustomProviderOptions, N as DepsOptimizationOptions, E as Environment, L as EnvironmentOptions, aa as EnvironmentReturn, H as HappyDOMOptions, Q as InlineConfig, J as JSDOMOptions, a9 as ModuleCache, a7 as MutableArray, a4 as Nullable, ac as OnServerRestartHandler, y as Pool, z as PoolOptions, P as ProjectConfig, r as RawErrsMap, ad as ReportContext, a0 as ResolveIdFunction, a as ResolvedCoverageOptions, Z as ResolvedTestEnvironment, w as RootAndTarget, X as RunnerRPC, g as RuntimeRPC, O as TransformModePatterns, t as TscErrorInfo, S as TypecheckConfig, U as UserConfig, e as Vitest, G as VitestEnvironment, V as VitestRunMode, ab as VmEnvironmentReturn, $ as WorkerContext, a2 as WorkerGlobalState, a1 as WorkerRPC } from './reporters-ANEBTnOh.js';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, n as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-LLiOBu3g.js';
7
+ export { K as ApiConfig, a6 as ArgumentsType, a5 as Arrayable, a3 as Awaitable, B as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, D as BuiltinEnvironment, I as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a8 as Constructable, x as Context, _ as ContextRPC, Y as ContextTestEnvironment, af as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ae as CoverageReporter, C as CoverageV8Options, ag as CustomProviderOptions, N as DepsOptimizationOptions, E as Environment, L as EnvironmentOptions, aa as EnvironmentReturn, H as HappyDOMOptions, Q as InlineConfig, J as JSDOMOptions, a9 as ModuleCache, a7 as MutableArray, a4 as Nullable, ac as OnServerRestartHandler, y as Pool, z as PoolOptions, P as ProjectConfig, r as RawErrsMap, ad as ReportContext, a0 as ResolveIdFunction, a as ResolvedCoverageOptions, Z as ResolvedTestEnvironment, w as RootAndTarget, X as RunnerRPC, g as RuntimeRPC, O as TransformModePatterns, t as TscErrorInfo, S as TypecheckConfig, U as UserConfig, e as Vitest, G as VitestEnvironment, V as VitestRunMode, ab as VmEnvironmentReturn, $ as WorkerContext, a2 as WorkerGlobalState, a1 as WorkerRPC } from './reporters-LLiOBu3g.js';
8
8
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
9
9
  export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
10
10
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
@@ -351,7 +351,8 @@ declare function waitFor<T>(callback: WaitForCallback<T>, options?: number | Wai
351
351
  type WaitUntilCallback<T> = () => T | Promise<T>;
352
352
  interface WaitUntilOptions extends Pick<WaitForOptions, 'interval' | 'timeout'> {
353
353
  }
354
- declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<T>;
354
+ type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
355
+ declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<Truthy<T>>;
355
356
 
356
357
  type ESModuleExports = Record<string, unknown>;
357
358
  interface VitestUtils {
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
2
  export { b as bench } from './vendor/benchmark.WVm6DARl.js';
3
3
  export { i as isFirstRun, r as runOnce } from './vendor/run-once.X3E7xx3F.js';
4
- export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.voNYQWB_.js';
5
- import { d as dist } from './vendor/index.Npc-eff0.js';
6
- export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor/index.Npc-eff0.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.JXuS6emb.js';
5
+ import { d as dist } from './vendor/index.VL3WbvjT.js';
6
+ export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor/index.VL3WbvjT.js';
7
7
  import * as chai from 'chai';
8
8
  export { chai };
9
9
  export { assert, should } from 'chai';
@@ -19,7 +19,7 @@ import '@vitest/snapshot';
19
19
  import '@vitest/utils/error';
20
20
  import './vendor/tasks.IknbGB2n.js';
21
21
  import '@vitest/utils/source-map';
22
- import './vendor/date.W90-E5kF.js';
22
+ import './vendor/date.Ns1pGd_X.js';
23
23
  import '@vitest/spy';
24
24
 
25
25
 
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VitestRunMode, U as UserConfig, e as Vitest, R as ResolvedConfig, f as ProvidedContext, W as WorkspaceProject, g as RuntimeRPC, T as TestSequencer, h as WorkspaceSpec } from './reporters-ANEBTnOh.js';
2
- export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-ANEBTnOh.js';
1
+ import { V as VitestRunMode, U as UserConfig, e as Vitest, R as ResolvedConfig, f as ProvidedContext, W as WorkspaceProject, g as RuntimeRPC, T as TestSequencer, h as WorkspaceSpec } from './reporters-LLiOBu3g.js';
2
+ export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-LLiOBu3g.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, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.c-kzGvOB.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.qmjq0bgY.js';
2
2
  import 'pathe';
3
3
  import 'vite';
4
4
  import 'node:path';
@@ -40,17 +40,17 @@ import '@vitest/utils/source-map';
40
40
  import 'local-pkg';
41
41
  import 'module';
42
42
  import 'acorn-walk';
43
- import './vendor/reporters.1xKxm8im.js';
44
- import './chunks/runtime-console.iCAG0Yz3.js';
43
+ import './vendor/reporters.pr8MinP9.js';
44
+ import './chunks/runtime-console.hf2msWA9.js';
45
45
  import 'node:stream';
46
46
  import 'node:console';
47
- import './vendor/date.W90-E5kF.js';
47
+ import './vendor/date.Ns1pGd_X.js';
48
48
  import './vendor/tasks.IknbGB2n.js';
49
49
  import 'node:module';
50
50
  import 'node:crypto';
51
51
  import 'assert';
52
52
  import 'magic-string';
53
53
  import 'strip-literal';
54
- import './vendor/environments.hpEVJZPC.js';
54
+ import './vendor/environments.hTqxBFDN.js';
55
55
  import 'node:readline';
56
56
  import 'readline';
@@ -848,6 +848,7 @@ declare class Vitest {
848
848
  restartsCount: number;
849
849
  runner: ViteNodeRunner;
850
850
  private coreWorkspaceProject;
851
+ private resolvedProjects;
851
852
  projects: WorkspaceProject[];
852
853
  private projectsTestFiles;
853
854
  projectFiles: {
@@ -860,6 +861,7 @@ declare class Vitest {
860
861
  private _onClose;
861
862
  private _onSetServer;
862
863
  private _onCancelListeners;
864
+ private _poolClosePromise?;
863
865
  setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
864
866
  private createCoreProject;
865
867
  getCoreWorkspaceProject(): WorkspaceProject;
@@ -875,6 +877,7 @@ declare class Vitest {
875
877
  runFiles(paths: WorkspaceSpec[]): Promise<void>;
876
878
  cancelCurrentRun(reason: CancelReason): Promise<void>;
877
879
  rerunFiles(files?: string[], trigger?: string): Promise<void>;
880
+ changeProjectName(pattern: string): Promise<void>;
878
881
  changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
879
882
  changeFilenamePattern(pattern: string): Promise<void>;
880
883
  rerunFailed(): Promise<void>;
@@ -1339,7 +1342,7 @@ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
1339
1342
  provider?: T;
1340
1343
  } & (CoverageV8Options));
1341
1344
  /** Fields that have default values. Internally these will always be defined. */
1342
- type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal';
1345
+ type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal' | 'processingConcurrency';
1343
1346
  type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
1344
1347
  reporter: CoverageReporterWithOptions[];
1345
1348
  };
@@ -1448,6 +1451,11 @@ interface BaseCoverageOptions {
1448
1451
  * @default false
1449
1452
  */
1450
1453
  allowExternal?: boolean;
1454
+ /**
1455
+ * Concurrency limit used when processing the coverage results.
1456
+ * Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
1457
+ */
1458
+ processingConcurrency?: number;
1451
1459
  }
1452
1460
  interface CoverageIstanbulOptions extends BaseCoverageOptions {
1453
1461
  /**
@@ -1628,13 +1636,14 @@ interface BenchmarkResult extends TaskResult {
1628
1636
  rank: number;
1629
1637
  }
1630
1638
  type BenchFunction = (this: Bench) => Promise<void> | void;
1631
- type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
1639
+ type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
1632
1640
  name: string | Function,
1633
1641
  fn?: BenchFunction,
1634
1642
  options?: Options
1635
- ], void> & {
1636
- skipIf(condition: any): BenchmarkAPI;
1637
- runIf(condition: any): BenchmarkAPI;
1643
+ ], void>;
1644
+ type BenchmarkAPI = ChainableBenchmarkAPI & {
1645
+ skipIf(condition: any): ChainableBenchmarkAPI;
1646
+ runIf(condition: any): ChainableBenchmarkAPI;
1638
1647
  };
1639
1648
 
1640
1649
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
@@ -2250,6 +2259,10 @@ interface UserConfig extends InlineConfig {
2250
2259
  * @example --shard=2/3
2251
2260
  */
2252
2261
  shard?: string;
2262
+ /**
2263
+ * Name of the project or projects to run.
2264
+ */
2265
+ project?: string | string[];
2253
2266
  }
2254
2267
  interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool'> {
2255
2268
  mode: VitestRunMode;
@@ -1,4 +1,4 @@
1
- export { ay as BaseReporter, aq as BasicReporter, aC as BenchmarkBuiltinReporters, aB as BenchmarkReportsMap, aA as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, ax as HangingProcessReporter, av as JUnitReporter, as as JsonReporter, q as Reporter, az as ReportersMap, aw as TapFlatReporter, au as TapReporter, at as VerboseReporter } from './reporters-ANEBTnOh.js';
1
+ export { ay as BaseReporter, aq as BasicReporter, aC as BenchmarkBuiltinReporters, aB as BenchmarkReportsMap, aA as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, ax as HangingProcessReporter, av as JUnitReporter, as as JsonReporter, q as Reporter, az as ReportersMap, aw as TapFlatReporter, au as TapReporter, at as VerboseReporter } from './reporters-LLiOBu3g.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/reporters.js CHANGED
@@ -1,4 +1,4 @@
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.1xKxm8im.js';
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.pr8MinP9.js';
2
2
  import 'node:perf_hooks';
3
3
  import 'picocolors';
4
4
  import './vendor/index.XU72Rmy8.js';
@@ -7,11 +7,11 @@ import 'std-env';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import './vendor/global.L7JRz1qU.js';
10
- import './chunks/runtime-console.iCAG0Yz3.js';
10
+ import './chunks/runtime-console.hf2msWA9.js';
11
11
  import 'node:stream';
12
12
  import 'node:console';
13
13
  import 'node:path';
14
- import './vendor/date.W90-E5kF.js';
14
+ import './vendor/date.Ns1pGd_X.js';
15
15
  import './vendor/base._79unx2z.js';
16
16
  import './vendor/tasks.IknbGB2n.js';
17
17
  import 'node:fs';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-ANEBTnOh.js';
2
+ import { R as ResolvedConfig } from './reporters-LLiOBu3g.js';
3
3
  import * as tinybench from 'tinybench';
4
4
  import 'vite';
5
5
  import 'vite-node';
package/dist/runners.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.voNYQWB_.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.JXuS6emb.js';
3
3
  import './vendor/index.XU72Rmy8.js';
4
4
  import { a as rpc } from './vendor/rpc.Bl-ysZIr.js';
5
5
  import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
@@ -13,7 +13,7 @@ import './vendor/_commonjsHelpers.jjO7Zipk.js';
13
13
  import '@vitest/snapshot';
14
14
  import '@vitest/utils/error';
15
15
  import '@vitest/utils/source-map';
16
- import './vendor/date.W90-E5kF.js';
16
+ import './vendor/date.Ns1pGd_X.js';
17
17
  import '@vitest/spy';
18
18
  import 'pathe';
19
19
  import 'std-env';
@@ -1,6 +1,6 @@
1
1
  import { Custom } from '@vitest/runner';
2
2
  import '@vitest/runner/utils';
3
- import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-ANEBTnOh.js';
3
+ import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-LLiOBu3g.js';
4
4
  import { Options } from 'tinybench';
5
5
 
6
6
  declare function getBenchOptions(key: Custom): Options;
package/dist/suite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-C1OmA61l.js';
4
- import './reporters-ANEBTnOh.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-SvxfaIxW.js';
4
+ import './reporters-LLiOBu3g.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
@@ -23,6 +23,7 @@ class MockDate extends RealDate {
23
23
  date = new RealDate(y, m, d, h, M, s, ms);
24
24
  break;
25
25
  }
26
+ Object.setPrototypeOf(date, MockDate.prototype);
26
27
  return date;
27
28
  }
28
29
  }
@@ -277,14 +277,15 @@ const LIVING_KEYS = [
277
277
  // not specified in docs, but is available
278
278
  "Image",
279
279
  "Audio",
280
- "Option"
280
+ "Option",
281
+ "CSS"
281
282
  ];
282
283
  const OTHER_KEYS = [
283
284
  "addEventListener",
284
285
  "alert",
285
- "atob",
286
+ // 'atob',
286
287
  "blur",
287
- "btoa",
288
+ // 'btoa',
288
289
  "cancelAnimationFrame",
289
290
  /* 'clearInterval', */
290
291
  /* 'clearTimeout', */
@@ -158,7 +158,7 @@ ${c.green(`vi.mock("${mockpath}", async () => {
158
158
  return {
159
159
  ...actual,
160
160
  // your mocked methods
161
- },
161
+ }
162
162
  })`)}
163
163
  `
164
164
  );
@@ -242,13 +242,32 @@ ${c.green(`vi.mock("${mockpath}", async () => {
242
242
  if (!define(newContainer, property, isFunction ? value : {}))
243
243
  continue;
244
244
  if (isFunction) {
245
- const spyModule = this.spyModule;
246
- if (!spyModule)
245
+ let mockFunction2 = function() {
246
+ if (this instanceof newContainer[property]) {
247
+ for (const { key } of getAllMockableProperties(this, false, primitives)) {
248
+ const value2 = this[key];
249
+ const type2 = getType(value2);
250
+ const isFunction2 = type2.includes("Function") && typeof value2 === "function";
251
+ if (isFunction2) {
252
+ const original = this[key];
253
+ const mock2 = spyModule.spyOn(this, key).mockImplementation(original);
254
+ mock2.mockRestore = () => {
255
+ mock2.mockReset();
256
+ mock2.mockImplementation(original);
257
+ return mock2;
258
+ };
259
+ }
260
+ }
261
+ }
262
+ };
263
+ if (!this.spyModule)
247
264
  throw this.createError("[vitest] `spyModule` is not defined. This is Vitest error. Please open a new issue with reproduction.");
248
- const mock = spyModule.spyOn(newContainer, property).mockImplementation(() => void 0);
265
+ const spyModule = this.spyModule;
266
+ const primitives = this.primitives;
267
+ const mock = spyModule.spyOn(newContainer, property).mockImplementation(mockFunction2);
249
268
  mock.mockRestore = () => {
250
269
  mock.mockReset();
251
- mock.mockImplementation(() => void 0);
270
+ mock.mockImplementation(mockFunction2);
252
271
  return mock;
253
272
  };
254
273
  Object.defineProperty(newContainer[property], "length", { value: 0 });
@@ -1,7 +1,7 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
2
  import { b as bench } from './benchmark.WVm6DARl.js';
3
3
  import { i as isFirstRun, r as runOnce } from './run-once.X3E7xx3F.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.voNYQWB_.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.JXuS6emb.js';
5
5
  import { g as getWorkerState } from './global.L7JRz1qU.js';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
@@ -1,6 +1,6 @@
1
1
  import { resolve, normalize } from 'pathe';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
- import { e as environments } from './environments.hpEVJZPC.js';
3
+ import { e as environments } from './environments.hTqxBFDN.js';
4
4
 
5
5
  function isBuiltinEnvironment(env) {
6
6
  return env in environments;
@@ -38,12 +38,12 @@ import { isCI, provider as provider$1 } from 'std-env';
38
38
  import ge from 'module';
39
39
  import { ancestor, simple, findNodeAround } from 'acorn-walk';
40
40
  import { generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks, hasFailed } from '@vitest/runner/utils';
41
- import { R as ReportersMap, B as BenchmarkReportsMap, s as stringWidth, a as ansiStyles, b as stripAnsi, e as eastAsianWidth, d as divider, F as F_POINTER, c as cliTruncate } from './reporters.1xKxm8im.js';
41
+ import { R as ReportersMap, B as BenchmarkReportsMap, s as stringWidth, a as ansiStyles, b as stripAnsi, e as eastAsianWidth, d as divider, F as F_POINTER, c as cliTruncate } from './reporters.pr8MinP9.js';
42
42
  import crypto, { createHash } from 'node:crypto';
43
43
  import require$$0$3 from 'assert';
44
44
  import MagicString from 'magic-string';
45
45
  import { stripLiteral } from 'strip-literal';
46
- import { g as getEnvPackageName } from './environments.hpEVJZPC.js';
46
+ import { g as getEnvPackageName } from './environments.hTqxBFDN.js';
47
47
  import readline from 'node:readline';
48
48
  import require$$0$4 from 'readline';
49
49
 
@@ -62,7 +62,7 @@ function _mergeNamespaces(n, m) {
62
62
  return Object.freeze(n);
63
63
  }
64
64
 
65
- var version$1 = "1.0.0-beta.5";
65
+ var version$1 = "1.0.0";
66
66
 
67
67
  const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
68
68
  async function ensurePackageInstalled(dependency, root) {
@@ -3741,8 +3741,6 @@ function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
3741
3741
  workerPort.close();
3742
3742
  }
3743
3743
  }
3744
- const Sequencer = ctx.config.sequence.sequencer;
3745
- const sequencer = new Sequencer(ctx);
3746
3744
  return async (specs, invalidates) => {
3747
3745
  const configs = /* @__PURE__ */ new Map();
3748
3746
  const getConfig = (project) => {
@@ -3752,10 +3750,6 @@ function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
3752
3750
  configs.set(project, config);
3753
3751
  return config;
3754
3752
  };
3755
- const { shard } = ctx.config;
3756
- if (shard)
3757
- specs = await sequencer.shard(specs);
3758
- specs = await sequencer.sort(specs);
3759
3753
  const filesByEnv = await groupFilesByEnv(specs);
3760
3754
  const promises = Object.values(filesByEnv).flat();
3761
3755
  const results = await Promise.allSettled(promises.map(({ file, environment, project }) => runFiles(project, getConfig(project), [file], environment, invalidates)));
@@ -4691,6 +4685,7 @@ class StateManager {
4691
4685
  }
4692
4686
  }
4693
4687
 
4688
+ var _a, _b;
4694
4689
  const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
4695
4690
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*"];
4696
4691
  const benchmarkConfigDefaults = {
@@ -4728,7 +4723,8 @@ const coverageConfigDefaults = {
4728
4723
  reportOnFailure: false,
4729
4724
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
4730
4725
  extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
4731
- allowExternal: false
4726
+ allowExternal: false,
4727
+ processingConcurrency: Math.min(20, ((_b = (_a = nodeos__default).availableParallelism) == null ? void 0 : _b.call(_a)) ?? nodeos__default.cpus().length)
4732
4728
  };
4733
4729
  const fakeTimersDefaults = {
4734
4730
  loopLimit: 1e4,
@@ -5253,7 +5249,7 @@ function resolveConfig(mode, options, viteConfig) {
5253
5249
  resolved.typecheck ?? (resolved.typecheck = {});
5254
5250
  (_D = resolved.typecheck).enabled ?? (_D.enabled = false);
5255
5251
  if (resolved.typecheck.enabled)
5256
- console.warn(c.yellow("Testing types with tsc and vue-tsc is an experimental feature.\nBreaking changes might not follow semver, please pin Vitest's version when using it."));
5252
+ console.warn(c.yellow("Testing types with tsc and vue-tsc is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it."));
5257
5253
  resolved.browser ?? (resolved.browser = {});
5258
5254
  (_E = resolved.browser).enabled ?? (_E.enabled = false);
5259
5255
  (_F = resolved.browser).headless ?? (_F.headless = isCI);
@@ -6287,7 +6283,7 @@ createLogUpdate(process$2.stdout);
6287
6283
 
6288
6284
  createLogUpdate(process$2.stderr);
6289
6285
 
6290
- var version = "1.0.0-beta.5";
6286
+ var version = "1.0.0";
6291
6287
 
6292
6288
  async function printError(error, project, options) {
6293
6289
  const { showCodeFrame = true, fullStack = false, type } = options;
@@ -6571,6 +6567,9 @@ class Logger {
6571
6567
  const comma = c.dim(", ");
6572
6568
  if (filters == null ? void 0 : filters.length)
6573
6569
  this.console.error(c.dim("filter: ") + c.yellow(filters.join(comma)));
6570
+ const projectsFilter = toArray(config.project);
6571
+ if (projectsFilter.length)
6572
+ this.console.error(c.dim("projects: ") + c.yellow(projectsFilter.join(comma)));
6574
6573
  this.ctx.projects.forEach((project) => {
6575
6574
  const config2 = project.config;
6576
6575
  const name = project.getName();
@@ -6915,7 +6914,10 @@ async function createBrowserServer(project, configFile) {
6915
6914
  port: defaultBrowserPort
6916
6915
  };
6917
6916
  server2.middlewareMode = false;
6918
- config.server = server2;
6917
+ config.server = {
6918
+ ...config.server,
6919
+ ...server2
6920
+ };
6919
6921
  (_b = config.server).fs ?? (_b.fs = {});
6920
6922
  config.server.fs.allow = config.server.fs.allow || [];
6921
6923
  config.server.fs.allow.push(
@@ -7449,7 +7451,8 @@ ${c.red(divider(c.bold(c.inverse(" Error during global setup "))))}`);
7449
7451
  return testFiles.filter((t) => {
7450
7452
  const testFile = relative(dir, t);
7451
7453
  return filters.some((f) => {
7452
- return testFile.includes(f) || testFile.includes(relative(dir, f));
7454
+ const relativePath = f.endsWith("/") ? join(relative(dir, f), "/") : relative(dir, f);
7455
+ return testFile.includes(f) || testFile.includes(relativePath);
7453
7456
  });
7454
7457
  });
7455
7458
  }
@@ -7478,7 +7481,7 @@ ${c.red(divider(c.bold(c.inverse(" Error during global setup "))))}`);
7478
7481
  async setServer(options, server) {
7479
7482
  this.config = resolveConfig(this.ctx.mode, options, server.config);
7480
7483
  this.server = server;
7481
- this.vitenode = new ViteNodeServer(server, this.config);
7484
+ this.vitenode = new ViteNodeServer(server, this.config.server);
7482
7485
  const node = this.vitenode;
7483
7486
  this.runner = new ViteNodeRunner({
7484
7487
  root: server.config.root,
@@ -7595,6 +7598,7 @@ class Vitest {
7595
7598
  restartsCount = 0;
7596
7599
  runner = void 0;
7597
7600
  coreWorkspaceProject;
7601
+ resolvedProjects = [];
7598
7602
  projects = [];
7599
7603
  projectsTestFiles = /* @__PURE__ */ new Map();
7600
7604
  projectFiles;
@@ -7602,6 +7606,7 @@ class Vitest {
7602
7606
  _onClose = [];
7603
7607
  _onSetServer = [];
7604
7608
  _onCancelListeners = [];
7609
+ _poolClosePromise;
7605
7610
  async setServer(options, server, cliOptions) {
7606
7611
  var _a, _b, _c, _d;
7607
7612
  (_a = this.unregisterWatcher) == null ? void 0 : _a.call(this);
@@ -7661,7 +7666,12 @@ class Vitest {
7661
7666
  } catch {
7662
7667
  }
7663
7668
  await Promise.all(this._onSetServer.map((fn) => fn()));
7664
- this.projects = await this.resolveWorkspace(cliOptions);
7669
+ const projects = await this.resolveWorkspace(cliOptions);
7670
+ this.projects = projects;
7671
+ this.resolvedProjects = projects;
7672
+ const filteredProjects = toArray(resolved.project);
7673
+ if (filteredProjects.length)
7674
+ this.projects = this.projects.filter((p) => filteredProjects.includes(p.getName()));
7665
7675
  if (!this.coreWorkspaceProject)
7666
7676
  this.coreWorkspaceProject = WorkspaceProject.createBasicProject(this);
7667
7677
  if (this.config.testNamePattern)
@@ -7787,7 +7797,7 @@ class Vitest {
7787
7797
  return Promise.all(this.projects.map((w) => w.initBrowserProvider()));
7788
7798
  }
7789
7799
  async start(filters) {
7790
- var _a, _b;
7800
+ var _a, _b, _c;
7791
7801
  this._onClose = [];
7792
7802
  try {
7793
7803
  await this.initCoverageProvider();
@@ -7813,6 +7823,8 @@ class Vitest {
7813
7823
  await this.cache.stats.populateStats(this.config.root, files);
7814
7824
  await this.runFiles(files);
7815
7825
  }
7826
+ if (!this.config.watch && ((_c = this.pool) == null ? void 0 : _c.close))
7827
+ this._poolClosePromise = this.pool.close();
7816
7828
  await this.reportCoverage(true);
7817
7829
  if (this.config.watch)
7818
7830
  await this.report("onWatcherStart");
@@ -7934,6 +7946,15 @@ class Vitest {
7934
7946
  await this.reportCoverage(!trigger);
7935
7947
  await this.report("onWatcherStart", this.state.getFiles(files));
7936
7948
  }
7949
+ async changeProjectName(pattern) {
7950
+ if (pattern === "")
7951
+ delete this.configOverride.project;
7952
+ else
7953
+ this.configOverride.project = pattern;
7954
+ this.projects = this.resolvedProjects.filter((p) => p.getName() === pattern);
7955
+ const files = (await this.globTestFiles()).map(([, file]) => file);
7956
+ await this.rerunFiles(files, "change project filter");
7957
+ }
7937
7958
  async changeNamePattern(pattern, files = this.state.getFilepaths(), trigger) {
7938
7959
  if (pattern === "")
7939
7960
  this.filenamePattern = void 0;
@@ -8124,7 +8145,8 @@ class Vitest {
8124
8145
  if (this.pool) {
8125
8146
  closePromises.push((async () => {
8126
8147
  var _a, _b;
8127
- await ((_b = (_a = this.pool) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a));
8148
+ await (this._poolClosePromise || ((_b = (_a = this.pool) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a)));
8149
+ this._poolClosePromise = void 0;
8128
8150
  this.pool = void 0;
8129
8151
  })());
8130
8152
  }
@@ -14634,6 +14656,7 @@ const keys = [
14634
14656
  ["u", "update snapshot"],
14635
14657
  ["p", "filter by a filename"],
14636
14658
  ["t", "filter by a test name regex pattern"],
14659
+ ["w", "filter by a project name"],
14637
14660
  ["q", "quit"]
14638
14661
  ];
14639
14662
  const cancelKeys = ["space", "c", "h", ...keys.map((key) => key[0]).flat()];
@@ -14681,6 +14704,8 @@ function registerConsoleShortcuts(ctx) {
14681
14704
  return ctx.rerunFiles();
14682
14705
  if (name === "f")
14683
14706
  return ctx.rerunFailed();
14707
+ if (name === "w")
14708
+ return inputProjectName();
14684
14709
  if (name === "t")
14685
14710
  return inputNamePattern();
14686
14711
  if (name === "p")
@@ -14701,6 +14726,17 @@ function registerConsoleShortcuts(ctx) {
14701
14726
  on();
14702
14727
  await ctx.changeNamePattern(filter.trim(), void 0, "change pattern");
14703
14728
  }
14729
+ async function inputProjectName() {
14730
+ off();
14731
+ const { filter = "" } = await prompt([{
14732
+ name: "filter",
14733
+ type: "text",
14734
+ message: "Input a single project name",
14735
+ initial: toArray(ctx.configOverride.project)[0] || ""
14736
+ }]);
14737
+ on();
14738
+ await ctx.changeProjectName(filter.trim());
14739
+ }
14704
14740
  async function inputFilePattern() {
14705
14741
  off();
14706
14742
  const { filter = "" } = await prompt([{
@@ -1,9 +1,9 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import c from 'picocolors';
3
3
  import { b as isNode, c as relativePath } from './index.XU72Rmy8.js';
4
- import { UNKNOWN_TEST_ID } from '../chunks/runtime-console.iCAG0Yz3.js';
4
+ import { UNKNOWN_TEST_ID } from '../chunks/runtime-console.hf2msWA9.js';
5
5
  import { isAbsolute, relative, dirname, basename, resolve } from 'pathe';
6
- import { s as slash } from './base._79unx2z.js';
6
+ import { s as slash, t as toArray } from './base._79unx2z.js';
7
7
  import { g as getFullName, h as hasFailedSnapshot } from './tasks.IknbGB2n.js';
8
8
  import { getSafeTimers, notNullish } from '@vitest/utils';
9
9
  import { isCI } from 'std-env';
@@ -354,17 +354,19 @@ class BaseReporter {
354
354
  ` : "";
355
355
  const TESTNAME_PATTERN = this.ctx.configOverride.testNamePattern ? `${BADGE_PADDING} ${c.dim("Test name pattern: ")}${c.blue(String(this.ctx.configOverride.testNamePattern))}
356
356
  ` : "";
357
- if (files.length > 1) {
357
+ const PROJECT_FILTER = this.ctx.configOverride.project ? `${BADGE_PADDING} ${c.dim("Project name: ")}${c.blue(toArray(this.ctx.configOverride.project).join(", "))}
358
+ ` : "";
359
+ if (files.length > 1 || !files.length) {
358
360
  this.ctx.logger.clearFullScreen(`
359
361
  ${BADGE}${TRIGGER}
360
- ${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
362
+ ${PROJECT_FILTER}${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
361
363
  this._lastRunCount = 0;
362
364
  } else if (files.length === 1) {
363
365
  const rerun = this._filesInWatchMode.get(files[0]) ?? 1;
364
366
  this._lastRunCount = rerun;
365
367
  this.ctx.logger.clearFullScreen(`
366
368
  ${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}
367
- ${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
369
+ ${PROJECT_FILTER}${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
368
370
  }
369
371
  this._timeStart = /* @__PURE__ */ new Date();
370
372
  this.start = performance.now();
@@ -9,7 +9,7 @@ import { g as getFullName } from './tasks.IknbGB2n.js';
9
9
  import { g as getWorkerState, a as getCurrentEnvironment } from './global.L7JRz1qU.js';
10
10
  import { getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils';
11
11
  import { parseSingleStack } from '@vitest/utils/source-map';
12
- import { R as RealDate, r as resetDate, m as mockDate } from './date.W90-E5kF.js';
12
+ import { R as RealDate, r as resetDate, m as mockDate } from './date.Ns1pGd_X.js';
13
13
  import { spyOn, fn, isMockFunction, mocks } from '@vitest/spy';
14
14
 
15
15
  function resetModules(modules, resetMocks = false) {
package/dist/vm.js CHANGED
@@ -7,11 +7,11 @@ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
7
7
  import { resolve } from 'pathe';
8
8
  import { installSourcemapsSupport } from 'vite-node/source-map';
9
9
  import { distDir } from './paths.js';
10
- import { l as loadEnvironment } from './vendor/loader.CU0NY2Is.js';
11
- import { b as startVitestExecutor } from './vendor/execute.aMjV5C9u.js';
12
- import { createCustomConsole } from './chunks/runtime-console.iCAG0Yz3.js';
10
+ import { l as loadEnvironment } from './vendor/loader.w8KTtIkD.js';
11
+ import { b as startVitestExecutor } from './vendor/execute.ILey0jnF.js';
12
+ import { createCustomConsole } from './chunks/runtime-console.hf2msWA9.js';
13
13
  import { c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
14
- import './vendor/environments.hpEVJZPC.js';
14
+ import './vendor/environments.hTqxBFDN.js';
15
15
  import 'node:console';
16
16
  import 'local-pkg';
17
17
  import 'vite-node/utils';
@@ -23,7 +23,7 @@ import 'node:path';
23
23
  import 'node:module';
24
24
  import 'vite-node/constants';
25
25
  import 'node:stream';
26
- import './vendor/date.W90-E5kF.js';
26
+ import './vendor/date.Ns1pGd_X.js';
27
27
  import './vendor/global.L7JRz1qU.js';
28
28
 
29
29
  const entryFile = pathToFileURL(resolve(distDir, "entry-vm.js")).href;
package/dist/worker.js CHANGED
@@ -2,13 +2,13 @@ import { performance } from 'node:perf_hooks';
2
2
  import { c as createBirpc } from './vendor/index.cAUulNDf.js';
3
3
  import { workerId } from 'tinypool';
4
4
  import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
5
- import { l as loadEnvironment } from './vendor/loader.CU0NY2Is.js';
6
- import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.aMjV5C9u.js';
5
+ import { l as loadEnvironment } from './vendor/loader.w8KTtIkD.js';
6
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.ILey0jnF.js';
7
7
  import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
8
8
  import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
9
9
  import 'pathe';
10
10
  import 'vite-node/client';
11
- import './vendor/environments.hpEVJZPC.js';
11
+ import './vendor/environments.hTqxBFDN.js';
12
12
  import 'node:console';
13
13
  import 'local-pkg';
14
14
  import 'node:url';
@@ -0,0 +1,5 @@
1
+ /// <reference path="./importMeta.d.ts" />
2
+
3
+ // https://github.com/microsoft/TypeScript/issues/45096
4
+ // TypeScript has a bug that makes <reference types="vite/types/importMeta" />
5
+ // not possible in userland. This file provides a workaround for now.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.5",
4
+ "version": "1.0.0",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -41,6 +41,9 @@
41
41
  "./importMeta": {
42
42
  "types": "./importMeta.d.ts"
43
43
  },
44
+ "./import-meta": {
45
+ "types": "./import-meta.d.ts"
46
+ },
44
47
  "./node": {
45
48
  "types": "./dist/node.d.ts",
46
49
  "default": "./dist/node.js"
@@ -138,18 +141,18 @@
138
141
  "magic-string": "^0.30.5",
139
142
  "pathe": "^1.1.1",
140
143
  "picocolors": "^1.0.0",
141
- "std-env": "^3.4.3",
144
+ "std-env": "^3.5.0",
142
145
  "strip-literal": "^1.3.0",
143
146
  "tinybench": "^2.5.1",
144
147
  "tinypool": "^0.8.1",
145
148
  "vite": "^5.0.0-beta.19 || ^5.0.0",
146
149
  "why-is-node-running": "^2.2.2",
147
- "@vitest/expect": "1.0.0-beta.5",
148
- "@vitest/snapshot": "1.0.0-beta.5",
149
- "@vitest/runner": "1.0.0-beta.5",
150
- "@vitest/utils": "1.0.0-beta.5",
151
- "@vitest/spy": "1.0.0-beta.5",
152
- "vite-node": "1.0.0-beta.5"
150
+ "@vitest/expect": "1.0.0",
151
+ "@vitest/runner": "1.0.0",
152
+ "@vitest/spy": "1.0.0",
153
+ "@vitest/snapshot": "1.0.0",
154
+ "@vitest/utils": "1.0.0",
155
+ "vite-node": "1.0.0"
153
156
  },
154
157
  "devDependencies": {
155
158
  "@ampproject/remapping": "^2.2.1",
@@ -159,8 +162,8 @@
159
162
  "@types/estree": "^1.0.5",
160
163
  "@types/istanbul-lib-coverage": "^2.0.6",
161
164
  "@types/istanbul-reports": "^3.0.4",
162
- "@types/jsdom": "^21.1.5",
163
- "@types/micromatch": "^4.0.5",
165
+ "@types/jsdom": "^21.1.6",
166
+ "@types/micromatch": "^4.0.6",
164
167
  "@types/prompts": "^2.4.8",
165
168
  "@types/sinonjs__fake-timers": "^8.1.5",
166
169
  "birpc": "0.2.14",
@@ -172,7 +175,7 @@
172
175
  "flatted": "^3.2.9",
173
176
  "get-tsconfig": "^4.7.2",
174
177
  "happy-dom": "^12.10.3",
175
- "jsdom": "^22.1.0",
178
+ "jsdom": "^23.0.1",
176
179
  "log-update": "^6.0.0",
177
180
  "micromatch": "^4.0.5",
178
181
  "p-limit": "^5.0.0",