vitest 2.1.0 → 2.1.2

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 (52) hide show
  1. package/dist/browser.d.ts +5 -5
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{base.BlXpj3e_.js → base.DwXGwWst.js} +1 -10
  4. package/dist/chunks/{base.CsQmmYBA.js → base.tiemDJX6.js} +1 -1
  5. package/dist/chunks/{benchmark.puBFxyfE.d.ts → benchmark.JVlTzojj.d.ts} +2 -0
  6. package/dist/chunks/{cac.Ce8UWvQp.js → cac.B9PaPYY1.js} +7 -7
  7. package/dist/chunks/cli-api.CHxC4-U8.js +11754 -0
  8. package/dist/chunks/{config.CHuotKvS.d.ts → config.Crbj2GAb.d.ts} +3 -0
  9. package/dist/chunks/{creator.zfBZSJzo.js → creator.Cf-MKt9i.js} +7 -10
  10. package/dist/chunks/{environment.C5eAp3K6.d.ts → environment.CzISCQ7o.d.ts} +1 -0
  11. package/dist/chunks/{globals.C03P0O1a.js → globals.HsM2o-0O.js} +3 -3
  12. package/dist/chunks/{index.Bn75ITYg.js → index.BpojBOif.js} +34 -25
  13. package/dist/chunks/{index.DkN6V87F.js → index.Ckn0Cw1h.js} +2 -1
  14. package/dist/chunks/{index.zPibhCkV.js → index.FcPVJkIQ.js} +633 -582
  15. package/dist/chunks/index.mAqbj9F9.js +140 -0
  16. package/dist/chunks/{reporters.WnPwkmgA.d.ts → reporters.DAfKSDh5.d.ts} +17 -12
  17. package/dist/chunks/{resolveConfig.-K5hHm0S.js → resolveConfig.D1DENLPF.js} +3490 -3338
  18. package/dist/chunks/{runBaseTests.9YDrdSI4.js → runBaseTests.D-Gcin7G.js} +5 -5
  19. package/dist/chunks/{setup-common.DV1PI68g.js → setup-common.DF96bIYE.js} +1 -1
  20. package/dist/chunks/{suite.CcK46U-P.d.ts → suite.BMWOKiTe.d.ts} +1 -1
  21. package/dist/chunks/{utils.Dbnmsfq1.js → utils.CY6Spixo.js} +26 -47
  22. package/dist/chunks/vi.DUs2eKik.js +3943 -0
  23. package/dist/chunks/{vite.D2yAwzwa.d.ts → vite.8fk186v-.d.ts} +1 -1
  24. package/dist/chunks/{worker.CmPmTxgH.d.ts → worker.Chrs-_NL.d.ts} +2 -2
  25. package/dist/chunks/{worker.Bws9Zuxu.d.ts → worker.Qtv8v5nL.d.ts} +1 -1
  26. package/dist/cli.js +2 -2
  27. package/dist/config.cjs +2 -1
  28. package/dist/config.d.ts +5 -5
  29. package/dist/config.js +2 -1
  30. package/dist/coverage.d.ts +4 -4
  31. package/dist/coverage.js +2 -2
  32. package/dist/environments.d.ts +2 -2
  33. package/dist/execute.d.ts +3 -3
  34. package/dist/index.d.ts +14 -14
  35. package/dist/index.js +5 -5
  36. package/dist/node.d.ts +8 -8
  37. package/dist/node.js +9 -9
  38. package/dist/reporters.d.ts +4 -4
  39. package/dist/reporters.js +4 -3
  40. package/dist/runners.d.ts +1 -1
  41. package/dist/runners.js +8 -2
  42. package/dist/suite.d.ts +2 -2
  43. package/dist/worker.js +11 -3
  44. package/dist/workers/forks.js +1 -1
  45. package/dist/workers/runVmTests.js +8 -5
  46. package/dist/workers/threads.js +1 -1
  47. package/dist/workers.d.ts +4 -4
  48. package/dist/workers.js +2 -2
  49. package/package.json +11 -12
  50. package/dist/chunks/cli-api.KmLFBnKP.js +0 -11397
  51. package/dist/chunks/index.iyKRMe3s.js +0 -131
  52. package/dist/chunks/vi.D6IHiKAI.js +0 -3746
@@ -185,6 +185,9 @@ interface SerializedConfig {
185
185
  standalone: boolean;
186
186
  logHeapUsage: boolean | undefined;
187
187
  coverage: SerializedCoverageConfig;
188
+ benchmark?: {
189
+ includeSamples: boolean;
190
+ };
188
191
  }
189
192
  interface SerializedCoverageConfig {
190
193
  provider: 'istanbul' | 'v8' | 'custom' | undefined;
@@ -1,7 +1,7 @@
1
1
  import { resolve, dirname, relative } from 'node:path';
2
2
  import { existsSync, writeFileSync, readFileSync } from 'node:fs';
3
3
  import { mkdir, writeFile } from 'node:fs/promises';
4
- import { p as prompt, f as findUp } from './index.Bn75ITYg.js';
4
+ import { p as prompt, f as findUp } from './index.BpojBOif.js';
5
5
  import c from 'tinyrainbow';
6
6
  import { detectPackageManager, installPackage } from './index.CPD77dLA.js';
7
7
  import { x } from 'tinyexec';
@@ -40,7 +40,7 @@ import { expect, test } from 'vitest'
40
40
  import { render } from '@testing-library/jsx'
41
41
  import HelloWorld from './HelloWorld.jsx'
42
42
 
43
- test('renders name', () => {
43
+ test('renders name', async () => {
44
44
  const { getByText } = render(<HelloWorld name="Vitest" />)
45
45
  await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
46
46
  })
@@ -79,7 +79,7 @@ import { expect, test } from 'vitest'
79
79
  import { render } from 'vitest-browser-vue'
80
80
  import HelloWorld from './HelloWorld.vue'
81
81
 
82
- test('renders name', () => {
82
+ test('renders name', async () => {
83
83
  const { getByText } = render(HelloWorld, {
84
84
  props: { name: 'Vitest' },
85
85
  })
@@ -108,7 +108,7 @@ import { expect, test } from 'vitest'
108
108
  import { render } from 'vitest-browser-svelte'
109
109
  import HelloWorld from './HelloWorld.svelte'
110
110
 
111
- test('renders name', () => {
111
+ test('renders name', async () => {
112
112
  const { getByText } = render(HelloWorld, { name: 'Vitest' })
113
113
  await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
114
114
  })
@@ -323,7 +323,7 @@ function getFrameworkTestPackage(framework) {
323
323
  case "preact":
324
324
  return "@testing-library/preact";
325
325
  case "solid":
326
- return "solid-testing-library";
326
+ return "@solidjs/testing-library";
327
327
  case "marko":
328
328
  return "@marko/testing-library";
329
329
  }
@@ -446,11 +446,8 @@ async function generateWorkspaceFile(options) {
446
446
  `import { defineWorkspace } from 'vitest/config'`,
447
447
  "",
448
448
  "export default defineWorkspace([",
449
- " // This will keep running your existing tests.",
450
- " // If you don't need to run those in Node.js anymore,",
451
- " // You can safely remove it from the workspace file",
452
- " // Or move the browser test configuration to the config file.",
453
- ` '${relativeRoot}',`,
449
+ " // If you want to keep running your existing tests in Node.js, uncomment the next line.",
450
+ ` // '${relativeRoot}',`,
454
451
  ` {`,
455
452
  ` extends: '${relativeRoot}',`,
456
453
  ` test: {`,
@@ -17,6 +17,7 @@ interface ModuleCache {
17
17
  }
18
18
  interface AfterSuiteRunMeta {
19
19
  coverage?: unknown;
20
+ testFiles: string[];
20
21
  transformMode: TransformMode | 'browser';
21
22
  projectName?: string;
22
23
  }
@@ -1,5 +1,5 @@
1
1
  import { g as globalApis } from './constants.fzPh7AOq.js';
2
- import { V as VitestIndex } from './index.iyKRMe3s.js';
2
+ import { V as VitestIndex } from './index.mAqbj9F9.js';
3
3
  import '@vitest/runner';
4
4
  import './benchmark.C8CRJYG4.js';
5
5
  import '@vitest/runner/utils';
@@ -10,7 +10,7 @@ import './utils.Ck2hJTRs.js';
10
10
  import './env.CmHVDJnw.js';
11
11
  import 'std-env';
12
12
  import './run-once.Sxe67Wng.js';
13
- import './vi.D6IHiKAI.js';
13
+ import './vi.DUs2eKik.js';
14
14
  import 'chai';
15
15
  import './_commonjsHelpers.BFTU3MAI.js';
16
16
  import '@vitest/expect';
@@ -18,7 +18,7 @@ import '@vitest/snapshot';
18
18
  import '@vitest/utils/error';
19
19
  import './tasks.BZnCS9aT.js';
20
20
  import '@vitest/utils/source-map';
21
- import './base.BlXpj3e_.js';
21
+ import './base.DwXGwWst.js';
22
22
  import './date.W2xKR2qe.js';
23
23
  import '@vitest/spy';
24
24
 
@@ -3261,11 +3261,11 @@ function requireElements$1 () {
3261
3261
  return elements$1;
3262
3262
  }
3263
3263
 
3264
- var hasRequiredPrompts$1;
3264
+ var hasRequiredPrompts$2;
3265
3265
 
3266
- function requirePrompts$1 () {
3267
- if (hasRequiredPrompts$1) return prompts$2;
3268
- hasRequiredPrompts$1 = 1;
3266
+ function requirePrompts$2 () {
3267
+ if (hasRequiredPrompts$2) return prompts$2;
3268
+ hasRequiredPrompts$2 = 1;
3269
3269
  (function (exports) {
3270
3270
 
3271
3271
  const $ = exports;
@@ -3515,7 +3515,7 @@ function requireDist () {
3515
3515
 
3516
3516
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3517
3517
 
3518
- const prompts = requirePrompts$1();
3518
+ const prompts = requirePrompts$2();
3519
3519
 
3520
3520
  const passOn = ['suggest', 'format', 'onState', 'validate', 'onRender', 'type'];
3521
3521
 
@@ -6229,11 +6229,11 @@ function requireElements () {
6229
6229
  return elements;
6230
6230
  }
6231
6231
 
6232
- var hasRequiredPrompts;
6232
+ var hasRequiredPrompts$1;
6233
6233
 
6234
- function requirePrompts () {
6235
- if (hasRequiredPrompts) return prompts$1;
6236
- hasRequiredPrompts = 1;
6234
+ function requirePrompts$1 () {
6235
+ if (hasRequiredPrompts$1) return prompts$1;
6236
+ hasRequiredPrompts$1 = 1;
6237
6237
  (function (exports) {
6238
6238
  const $ = exports;
6239
6239
  const el = requireElements();
@@ -6451,7 +6451,7 @@ function requireLib () {
6451
6451
  if (hasRequiredLib) return lib;
6452
6452
  hasRequiredLib = 1;
6453
6453
 
6454
- const prompts = requirePrompts();
6454
+ const prompts = requirePrompts$1();
6455
6455
 
6456
6456
  const passOn = ['suggest', 'format', 'onState', 'validate', 'onRender', 'type'];
6457
6457
  const noop = () => {};
@@ -6550,26 +6550,35 @@ function requireLib () {
6550
6550
  return lib;
6551
6551
  }
6552
6552
 
6553
- function isNodeLT(tar) {
6554
- tar = (Array.isArray(tar) ? tar : tar.split('.')).map(Number);
6555
- let i=0, src=process.versions.node.split('.').map(Number);
6556
- for (; i < tar.length; i++) {
6557
- if (src[i] > tar[i]) return false;
6558
- if (tar[i] > src[i]) return true;
6559
- }
6560
- return false;
6561
- }
6553
+ var prompts;
6554
+ var hasRequiredPrompts;
6555
+
6556
+ function requirePrompts () {
6557
+ if (hasRequiredPrompts) return prompts;
6558
+ hasRequiredPrompts = 1;
6559
+ function isNodeLT(tar) {
6560
+ tar = (Array.isArray(tar) ? tar : tar.split('.')).map(Number);
6561
+ let i=0, src=process.versions.node.split('.').map(Number);
6562
+ for (; i < tar.length; i++) {
6563
+ if (src[i] > tar[i]) return false;
6564
+ if (tar[i] > src[i]) return true;
6565
+ }
6566
+ return false;
6567
+ }
6562
6568
 
6563
- var prompts =
6564
- isNodeLT('8.6.0')
6565
- ? requireDist()
6566
- : requireLib();
6569
+ prompts =
6570
+ isNodeLT('8.6.0')
6571
+ ? requireDist()
6572
+ : requireLib();
6573
+ return prompts;
6574
+ }
6567
6575
 
6568
- var prompt = /*@__PURE__*/getDefaultExportFromCjs(prompts);
6576
+ var promptsExports = requirePrompts();
6577
+ var prompt = /*@__PURE__*/getDefaultExportFromCjs(promptsExports);
6569
6578
 
6570
6579
  var index = /*#__PURE__*/_mergeNamespaces({
6571
6580
  __proto__: null,
6572
6581
  default: prompt
6573
- }, [prompts]);
6582
+ }, [promptsExports]);
6574
6583
 
6575
6584
  export { findUp as f, index as i, prompt as p };
@@ -4,7 +4,7 @@ import { distDir } from '../path.js';
4
4
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
5
5
  import { r as rpc } from './rpc.B7Mfb-Yf.js';
6
6
  import { t as takeCoverageInsideWorker } from './coverage.zlNdAMHK.js';
7
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.DV1PI68g.js';
7
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.DF96bIYE.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -82,6 +82,7 @@ async function resolveTestRunner(config, executor) {
82
82
  if (coverage) {
83
83
  rpc().onAfterSuiteRun({
84
84
  coverage,
85
+ testFiles: files.map((file) => file.name).sort(),
85
86
  transformMode: state.environment.transformMode,
86
87
  projectName: state.ctx.projectName
87
88
  });