vitest 2.2.0-beta.1 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/browser.d.ts +8 -8
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{RandomSequencer.CMRlh2v4.js → RandomSequencer.gisBJ77r.js} +11 -3
  4. package/dist/chunks/{base.BS0HhLXd.js → base.CkcgFVQd.js} +8 -3
  5. package/dist/chunks/{benchmark.geERunq4.d.ts → benchmark.CFFwLv-O.d.ts} +2 -2
  6. package/dist/chunks/{cac.Z91LBqmg.js → cac.CWCZimpS.js} +7 -7
  7. package/dist/chunks/{cli-api.DVJJMJHj.js → cli-api.BKUOv0Nc.js} +928 -661
  8. package/dist/chunks/{config.CPguQ7J1.d.ts → config.BTPBhmK5.d.ts} +1 -1
  9. package/dist/chunks/{creator.IIqd8RWT.js → creator.DcAcUhMD.js} +1 -4
  10. package/dist/chunks/{globals.BCGEw6ON.js → globals.DJTzb7B3.js} +2 -2
  11. package/dist/chunks/{index.DD5eTY2y.js → index.BqHViJW9.js} +1 -1
  12. package/dist/chunks/{index.BjjsHdBb.js → index.CkOJwybT.js} +1 -1
  13. package/dist/chunks/{index.DLRzErGF.js → index.DKe7vK-G.js} +708 -548
  14. package/dist/chunks/{index.CqYx2Nsr.js → index.DQboAxJm.js} +23 -14
  15. package/dist/chunks/{inspector.70d6emsh.js → inspector.DKLceBVD.js} +1 -1
  16. package/dist/chunks/{reporters.B_9uUTGW.d.ts → reporters.BZbwTvrM.d.ts} +1252 -1234
  17. package/dist/chunks/{resolveConfig.CQIc6fe7.js → resolveConfig.3rGGWga5.js} +88 -56
  18. package/dist/chunks/{runBaseTests.B7hcVT-s.js → runBaseTests.C6huCAng.js} +6 -6
  19. package/dist/chunks/{setup-common.BfGt8K-K.js → setup-common.B5ClyS48.js} +1 -1
  20. package/dist/chunks/{suite.B2jumIFP.d.ts → suite.BJU7kdY9.d.ts} +4 -4
  21. package/dist/chunks/{utils.DNoFbBUZ.js → utils.CMUTX-p8.js} +20 -23
  22. package/dist/chunks/{vi.BlPttogV.js → vi.CZKezqeD.js} +18 -13
  23. package/dist/chunks/{vite.Bvms8Xir.d.ts → vite.DIfmneq0.d.ts} +1 -1
  24. package/dist/chunks/{vm.Zr4qWzDJ.js → vm.DGhTouO3.js} +10 -1
  25. package/dist/chunks/{worker.9VY11NZs.d.ts → worker.CmzGeuVD.d.ts} +3 -3
  26. package/dist/chunks/{worker.Qz1UB4Fv.d.ts → worker.umPNbBNk.d.ts} +1 -1
  27. package/dist/cli.js +1 -1
  28. package/dist/config.cjs +1 -10
  29. package/dist/config.d.ts +11 -11
  30. package/dist/config.js +1 -10
  31. package/dist/coverage.d.ts +7 -7
  32. package/dist/coverage.js +4 -4
  33. package/dist/execute.d.ts +3 -3
  34. package/dist/index.d.ts +26 -17
  35. package/dist/index.js +2 -2
  36. package/dist/node.d.ts +16 -20
  37. package/dist/node.js +7 -7
  38. package/dist/reporters.d.ts +7 -7
  39. package/dist/reporters.js +3 -3
  40. package/dist/runners.d.ts +3 -4
  41. package/dist/runners.js +9 -14
  42. package/dist/suite.d.ts +2 -2
  43. package/dist/worker.js +1 -1
  44. package/dist/workers/forks.js +1 -1
  45. package/dist/workers/runVmTests.js +6 -6
  46. package/dist/workers/threads.js +1 -1
  47. package/dist/workers/vmForks.js +1 -1
  48. package/dist/workers/vmThreads.js +1 -1
  49. package/dist/workers.d.ts +3 -3
  50. package/dist/workers.js +3 -3
  51. package/package.json +22 -22
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as CoverageProvider, c as CoverageProviderModule } from './chunks/reporters.B_9uUTGW.js';
2
- import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.CPguQ7J1.js';
1
+ import { b as CoverageProvider, c as CoverageProviderModule } from './chunks/reporters.BZbwTvrM.js';
2
+ import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.BTPBhmK5.js';
3
3
  import * as spy$1 from '@vitest/spy';
4
4
  import * as _vitest_utils_diff from '@vitest/utils/diff';
5
5
  import { VitestExecutor } from './execute.js';
@@ -8,20 +8,20 @@ import './chunks/environment.CT0jpO-1.js';
8
8
  import 'node:stream';
9
9
  import 'vite';
10
10
  import '@vitest/utils';
11
+ import 'vite-node';
12
+ import '@vitest/utils/source-map';
11
13
  import '@vitest/pretty-format';
12
14
  import '@vitest/snapshot';
13
- import 'vite-node';
14
15
  import 'chai';
15
- import '@vitest/utils/source-map';
16
- import 'vite-node/client';
17
- import 'vite-node/server';
18
- import './chunks/benchmark.geERunq4.js';
16
+ import './chunks/benchmark.CFFwLv-O.js';
19
17
  import '@vitest/runner/utils';
20
18
  import 'tinybench';
19
+ import 'vite-node/client';
20
+ import 'vite-node/server';
21
21
  import '@vitest/snapshot/manager';
22
22
  import 'node:fs';
23
23
  import '@vitest/snapshot/environment';
24
- import './chunks/worker.9VY11NZs.js';
24
+ import './chunks/worker.CmzGeuVD.js';
25
25
  import 'node:vm';
26
26
  import '@vitest/mocker';
27
27
  import './chunks/mocker.cRtM890J.js';
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.BoMDb1ip.js';
2
2
  export { s as SpyModule } from './chunks/spy.Cf_4R5Oe.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.BfGt8K-K.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.B5ClyS48.js';
4
4
  export { collectTests, processError, startTests } from '@vitest/runner';
5
5
  import '@vitest/spy';
6
6
  import '@vitest/snapshot';
@@ -331,7 +331,7 @@ async function collectTests(ctx, filepath) {
331
331
  }
332
332
  const ast = await parseAstAsync(request.code);
333
333
  const testFilepath = relative(ctx.config.root, filepath);
334
- const projectName = ctx.getName();
334
+ const projectName = ctx.name;
335
335
  const typecheckSubprojectName = projectName ? `${projectName}:__typecheck__` : "__typecheck__";
336
336
  const file = {
337
337
  filepath,
@@ -362,10 +362,17 @@ async function collectTests(ctx, filepath) {
362
362
  return getName(callee.tag);
363
363
  }
364
364
  if (callee.type === "MemberExpression") {
365
- if (callee.object?.name?.startsWith("__vite_ssr_")) {
365
+ const object = callee.object;
366
+ if (object?.name?.startsWith("__vite_ssr_")) {
366
367
  return getName(callee.property);
367
368
  }
368
- return getName(callee.object?.property);
369
+ return getName(object?.property);
370
+ }
371
+ if (callee.type === "SequenceExpression" && callee.expressions.length === 2) {
372
+ const [e0, e1] = callee.expressions;
373
+ if (e0.type === "Literal" && e0.value === 0) {
374
+ return getName(e1);
375
+ }
369
376
  }
370
377
  return null;
371
378
  };
@@ -466,6 +473,7 @@ async function collectTests(ctx, filepath) {
466
473
  interpretTaskModes(
467
474
  file,
468
475
  ctx.config.testNamePattern,
476
+ void 0,
469
477
  hasOnly,
470
478
  false,
471
479
  ctx.config.allowOnly
@@ -21,14 +21,19 @@ async function runBaseTests(method, state) {
21
21
  moduleCache.delete(`mock:${fsPath}`);
22
22
  });
23
23
  }
24
- ctx.files.forEach((i) => state.moduleCache.delete(i));
24
+ ctx.files.forEach((i) => state.moduleCache.delete(
25
+ typeof i === "string" ? i : i.filepath
26
+ ));
25
27
  const [executor, { run }] = await Promise.all([
26
28
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
27
- import('./runBaseTests.B7hcVT-s.js')
29
+ import('./runBaseTests.C6huCAng.js')
28
30
  ]);
31
+ const fileSpecs = ctx.files.map(
32
+ (f) => typeof f === "string" ? { filepath: f, testLocations: void 0 } : f
33
+ );
29
34
  await run(
30
35
  method,
31
- ctx.files,
36
+ fileSpecs,
32
37
  ctx.config,
33
38
  { environment: state.environment, options: ctx.environment.options },
34
39
  executor
@@ -1,8 +1,8 @@
1
- import { Custom } from '@vitest/runner';
1
+ import { Test } from '@vitest/runner';
2
2
  import { ChainableFunction } from '@vitest/runner/utils';
3
3
  import { TaskResult, Bench, Options } from 'tinybench';
4
4
 
5
- interface Benchmark extends Custom {
5
+ interface Benchmark extends Test {
6
6
  meta: {
7
7
  benchmark: true;
8
8
  result?: TaskResult;
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
618
618
 
619
619
  const cac = (name = "") => new CAC(name);
620
620
 
621
- var version = "2.2.0-beta.1";
621
+ var version = "3.0.0-beta.1";
622
622
 
623
623
  const apiConfig = (port) => ({
624
624
  port: {
@@ -1218,7 +1218,7 @@ const cliOptionsConfig = {
1218
1218
  }
1219
1219
  },
1220
1220
  project: {
1221
- description: "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`. You can also filter projects using wildcards like `--project=packages*`",
1221
+ description: "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`. You can also filter projects using wildcards like `--project=packages*`, and exclude projects with `--project=!pattern`.",
1222
1222
  argument: "<name>",
1223
1223
  array: true
1224
1224
  },
@@ -1551,13 +1551,13 @@ async function start(mode, cliFilters, options) {
1551
1551
  } catch {
1552
1552
  }
1553
1553
  try {
1554
- const { startVitest } = await import('./cli-api.DVJJMJHj.js').then(function (n) { return n.e; });
1554
+ const { startVitest } = await import('./cli-api.BKUOv0Nc.js').then(function (n) { return n.e; });
1555
1555
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
1556
1556
  if (!ctx?.shouldKeepServer()) {
1557
1557
  await ctx?.exit();
1558
1558
  }
1559
1559
  } catch (e) {
1560
- const { divider } = await import('./utils.DNoFbBUZ.js').then(function (n) { return n.u; });
1560
+ const { divider } = await import('./utils.CMUTX-p8.js').then(function (n) { return n.u; });
1561
1561
  console.error(`
1562
1562
  ${c.red(divider(c.bold(c.inverse(" Startup Error "))))}`);
1563
1563
  console.error(e);
@@ -1573,7 +1573,7 @@ async function init(project) {
1573
1573
  console.error(new Error('Only the "browser" project is supported. Use "vitest init browser" to create a new project.'));
1574
1574
  process.exit(1);
1575
1575
  }
1576
- const { create } = await import('./creator.IIqd8RWT.js');
1576
+ const { create } = await import('./creator.DcAcUhMD.js');
1577
1577
  await create();
1578
1578
  }
1579
1579
  async function collect(mode, cliFilters, options) {
@@ -1582,7 +1582,7 @@ async function collect(mode, cliFilters, options) {
1582
1582
  } catch {
1583
1583
  }
1584
1584
  try {
1585
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.DVJJMJHj.js').then(function (n) { return n.e; });
1585
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BKUOv0Nc.js').then(function (n) { return n.e; });
1586
1586
  const ctx = await prepareVitest(mode, {
1587
1587
  ...normalizeCliOptions(options),
1588
1588
  watch: false,
@@ -1604,7 +1604,7 @@ async function collect(mode, cliFilters, options) {
1604
1604
  }
1605
1605
  await ctx.close();
1606
1606
  } catch (e) {
1607
- const { divider } = await import('./utils.DNoFbBUZ.js').then(function (n) { return n.u; });
1607
+ const { divider } = await import('./utils.CMUTX-p8.js').then(function (n) { return n.u; });
1608
1608
  console.error(`
1609
1609
  ${c.red(divider(c.bold(c.inverse(" Collect Error "))))}`);
1610
1610
  console.error(e);