vitest 2.0.0-beta.2 → 2.0.0-beta.3

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 (42) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.D0I8wu4f.js} +3 -3
  4. package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.CsxVA4nP.js} +4 -4
  5. package/dist/cli.js +2 -2
  6. package/dist/config.cjs +2 -2
  7. package/dist/config.d.ts +2 -2
  8. package/dist/config.js +2 -2
  9. package/dist/coverage.d.ts +1 -1
  10. package/dist/environments.d.ts +1 -1
  11. package/dist/execute.d.ts +1 -1
  12. package/dist/execute.js +1 -1
  13. package/dist/index.d.ts +9 -6
  14. package/dist/index.js +3 -3
  15. package/dist/node.d.ts +3 -2
  16. package/dist/node.js +5 -5
  17. package/dist/{reporters-DFgqsvtL.d.ts → reporters-C-3dxOaA.d.ts} +165 -108
  18. package/dist/reporters.d.ts +1 -1
  19. package/dist/reporters.js +1 -1
  20. package/dist/runners.d.ts +3 -2
  21. package/dist/runners.js +4 -1
  22. package/dist/{suite-C_sqQjdz.d.ts → suite-V5kCKZme.d.ts} +1 -1
  23. package/dist/suite.d.ts +2 -2
  24. package/dist/vendor/{base.VFkIJ66g.js → base.CfOCwoIE.js} +2 -2
  25. package/dist/vendor/{cac.CtP0aXu-.js → cac.f5m2SesE.js} +15 -8
  26. package/dist/vendor/{cli-api.B2QW76dQ.js → cli-api.pZNNj7LX.js} +139 -181
  27. package/dist/vendor/{constants.5SOfHUj0.js → constants.XmjJgDXx.js} +2 -2
  28. package/dist/vendor/{execute.CLLNVNnK.js → execute.Bwzklsfj.js} +1 -1
  29. package/dist/vendor/{index.BfoZyXD1.js → index.BHPXakMe.js} +1 -1
  30. package/dist/vendor/{index.CmILuxzC.js → index.BkeKAX-R.js} +1 -1
  31. package/dist/vendor/{index.CRxYS9H3.js → index.DOAUPIJU.js} +237 -40
  32. package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.6St9QHh1.js} +1 -1
  33. package/dist/vendor/{vi.ClD3hi7L.js → vi.B31D70yH.js} +75 -36
  34. package/dist/vendor/{vm.Bi3bljci.js → vm.rKHnSoLJ.js} +1 -1
  35. package/dist/workers/forks.js +2 -2
  36. package/dist/workers/runVmTests.js +4 -4
  37. package/dist/workers/threads.js +2 -2
  38. package/dist/workers/vmForks.js +2 -2
  39. package/dist/workers/vmThreads.js +2 -2
  40. package/dist/workers.d.ts +1 -1
  41. package/dist/workers.js +3 -3
  42. package/package.json +10 -10
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-DFgqsvtL.js';
1
+ import { VitestRunner, VitestRunnerImportSource, File, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
+ import { R as ResolvedConfig } from './reporters-C-3dxOaA.js';
3
3
  import * as tinybench from 'tinybench';
4
4
  import 'vite';
5
5
  import 'vite-node';
@@ -23,6 +23,7 @@ declare class VitestTestRunner implements VitestRunner {
23
23
  private cancelRun;
24
24
  constructor(config: ResolvedConfig);
25
25
  importFile(filepath: string, source: VitestRunnerImportSource): unknown;
26
+ onCollectStart(file: File): void;
26
27
  onBeforeRunFiles(): void;
27
28
  onAfterRunFiles(): void;
28
29
  onAfterRunSuite(suite: Suite): Promise<void>;
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.ClD3hi7L.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.B31D70yH.js';
3
3
  import 'pathe';
4
4
  import { g as getTestName } from './vendor/tasks.WC7M-K-v.js';
5
5
  import { createDefer, getSafeTimers } from '@vitest/utils';
@@ -34,6 +34,9 @@ class VitestTestRunner {
34
34
  this.workerState.moduleCache.delete(filepath);
35
35
  return this.__vitest_executor.executeId(filepath);
36
36
  }
37
+ onCollectStart(file) {
38
+ this.workerState.current = file;
39
+ }
37
40
  onBeforeRunFiles() {
38
41
  this.snapshotClient.clear();
39
42
  }
@@ -1,6 +1,6 @@
1
1
  import { Custom } from '@vitest/runner';
2
2
  import '@vitest/runner/utils';
3
- import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-DFgqsvtL.js';
3
+ import { au as BenchFunction, av as BenchmarkAPI } from './reporters-C-3dxOaA.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, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-C_sqQjdz.js';
4
- import './reporters-DFgqsvtL.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-V5kCKZme.js';
4
+ import './reporters-C-3dxOaA.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
@@ -1,6 +1,6 @@
1
1
  import { ModuleCacheMap } from 'vite-node/client';
2
2
  import { p as provideWorkerState } from './global.7bFbnyXl.js';
3
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.CLLNVNnK.js';
3
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.Bwzklsfj.js';
4
4
 
5
5
  let _viteNode;
6
6
  const moduleCache = new ModuleCacheMap();
@@ -25,7 +25,7 @@ async function runBaseTests(state) {
25
25
  ctx.files.forEach((i) => state.moduleCache.delete(i));
26
26
  const [executor, { run }] = await Promise.all([
27
27
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
28
- import('../chunks/runtime-runBaseTests._dXkRAZc.js')
28
+ import('../chunks/runtime-runBaseTests.CsxVA4nP.js')
29
29
  ]);
30
30
  await run(
31
31
  ctx.files,
@@ -2,7 +2,7 @@ import { normalize } from 'pathe';
2
2
  import { EventEmitter } from 'events';
3
3
  import c from 'picocolors';
4
4
  import { t as toArray } from './base._gnK9Slw.js';
5
- import { d as defaultPort, a as defaultBrowserPort } from './constants.5SOfHUj0.js';
5
+ import { d as defaultPort, a as defaultBrowserPort } from './constants.XmjJgDXx.js';
6
6
 
7
7
  function toArr(any) {
8
8
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
618
618
 
619
619
  const cac = (name = "") => new CAC(name);
620
620
 
621
- var version = "2.0.0-beta.2";
621
+ var version = "2.0.0-beta.3";
622
622
 
623
623
  const apiConfig = (port) => ({
624
624
  port: {
@@ -946,7 +946,8 @@ const cliOptionsConfig = {
946
946
  description: "Should all test files run in parallel. Use `--browser.file-parallelism=false` to disable (default: same as `--file-parallelism`)"
947
947
  },
948
948
  indexScripts: null,
949
- testerScripts: null
949
+ testerScripts: null,
950
+ commands: null
950
951
  }
951
952
  },
952
953
  pool: {
@@ -1204,6 +1205,15 @@ const cliOptionsConfig = {
1204
1205
  standalone: {
1205
1206
  description: "Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`)"
1206
1207
  },
1208
+ mergeReports: {
1209
+ description: "Paths to blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests",
1210
+ argument: "[path]",
1211
+ transform(value) {
1212
+ if (!value || typeof value === "boolean")
1213
+ return ".vitest-reports";
1214
+ return value;
1215
+ }
1216
+ },
1207
1217
  // disable CLI options
1208
1218
  cliExclude: null,
1209
1219
  server: null,
@@ -1317,7 +1327,7 @@ function createCLI(options = {}) {
1317
1327
  if (subcommands.length === 1 && (subcommands[0] === "--expand-help" || subcommands[0] === "--expandHelp"))
1318
1328
  return info;
1319
1329
  const subcommandMarker = "$SUB_COMMAND_MARKER$";
1320
- const banner = info.find((current) => /^vitest\/[0-9]+\.[0-9]+\.[0-9]+$/.test(current.body));
1330
+ const banner = info.find((current) => /^vitest\/\d+\.\d+\.\d+$/.test(current.body));
1321
1331
  function addBannerWarning(warning) {
1322
1332
  if (typeof (banner == null ? void 0 : banner.body) === "string") {
1323
1333
  if (banner == null ? void 0 : banner.body.includes(warning))
@@ -1351,9 +1361,6 @@ function createCLI(options = {}) {
1351
1361
  cli.command("bench [...filters]", void 0, options).action(benchmark),
1352
1362
  benchCliOptionsConfig
1353
1363
  );
1354
- cli.command("typecheck [...filters]").action(() => {
1355
- throw new Error(`Running typecheck via "typecheck" command is removed. Please use "--typecheck" to run your regular tests alongside typechecking, or "--typecheck.only" to run only typecheck tests.`);
1356
- });
1357
1364
  cli.command("[...filters]", void 0, options).action((filters, options2) => start("test", filters, options2));
1358
1365
  return cli;
1359
1366
  }
@@ -1410,7 +1417,7 @@ async function start(mode, cliFilters, options) {
1410
1417
  } catch {
1411
1418
  }
1412
1419
  try {
1413
- const { startVitest } = await import('./cli-api.B2QW76dQ.js').then(function (n) { return n.d; });
1420
+ const { startVitest } = await import('./cli-api.pZNNj7LX.js').then(function (n) { return n.d; });
1414
1421
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
1415
1422
  if (!(ctx == null ? void 0 : ctx.shouldKeepServer()))
1416
1423
  await (ctx == null ? void 0 : ctx.exit());