vitest 2.0.5 → 2.1.0-beta.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 (54) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/RandomSequencer.B4M2ux5b.js +952 -0
  4. package/dist/chunks/{base.DSsbfkDg.js → base.BH-FAiX7.js} +1 -1
  5. package/dist/chunks/{base.CC5R_kgU.js → base.BYvKfYzm.js} +2 -2
  6. package/dist/chunks/{benchmark.DDmpNjj-.js → benchmark.C8CRJYG4.js} +1 -1
  7. package/dist/chunks/{cac.DGgmCKmU.js → cac.B6BJeWgz.js} +9 -8
  8. package/dist/chunks/{cli-api.OKfd3qJ0.js → cli-api.de6RCgV0.js} +221 -4329
  9. package/dist/chunks/{config.DCnyCTbs.d.ts → config.CHuotKvS.d.ts} +3 -0
  10. package/dist/chunks/{console.Bgn7_A1x.js → console.DI3gHgtH.js} +1 -1
  11. package/dist/chunks/{creator.a3OfuIEW.js → creator.GreKbaUc.js} +2 -3
  12. package/dist/chunks/{env.BU041cs9.js → env.CmHVDJnw.js} +1 -1
  13. package/dist/chunks/{execute.Cjlr2CRw.js → execute.DT9BA6zp.js} +7 -7
  14. package/dist/chunks/{globals.BliuJFNR.js → globals.DRPLtPOv.js} +6 -6
  15. package/dist/chunks/{index.BfeNhc0N.js → index.CNZXZ9PJ.js} +2 -2
  16. package/dist/chunks/{index.DYufA6CZ.js → index.CxRxs566.js} +1 -1
  17. package/dist/chunks/{index.R1VjssW9.js → index.CxWPpGJz.js} +2 -2
  18. package/dist/chunks/{index.JbiJutJ_.js → index.YuPJueCg.js} +25 -965
  19. package/dist/chunks/{node.DS3zEPa7.js → node.Bx4JZjMG.js} +1 -1
  20. package/dist/chunks/{reporters.C_zwCd4j.d.ts → reporters.DRZ7ndzr.d.ts} +14 -1
  21. package/dist/chunks/resolveConfig.CGobt8AB.js +8120 -0
  22. package/dist/chunks/{runBaseTests.CyvqmuC9.js → runBaseTests.BAhL8UH_.js} +9 -9
  23. package/dist/chunks/{setup-common.CNzatKMx.js → setup-common.KBrCO5LJ.js} +1 -1
  24. package/dist/chunks/{utils.DpP_sDwr.js → utils.DO38lwfj.js} +1 -1
  25. package/dist/chunks/{vi.fiQ7lMRF.js → vi.B6QZ938s.js} +2 -2
  26. package/dist/chunks/{vm.DcSuuaHr.js → vm.kl9T_5ai.js} +3 -3
  27. package/dist/chunks/{worker.C5iHKIaJ.d.ts → worker.BANO5ak1.d.ts} +1 -1
  28. package/dist/chunks/{worker.DKkAC4Qw.d.ts → worker.Cx2xE71X.d.ts} +1 -1
  29. package/dist/cli.js +2 -2
  30. package/dist/config.d.ts +2 -2
  31. package/dist/coverage.d.ts +2 -2
  32. package/dist/coverage.js +34 -14
  33. package/dist/execute.d.ts +2 -2
  34. package/dist/execute.js +2 -2
  35. package/dist/index.d.ts +6 -6
  36. package/dist/index.js +7 -7
  37. package/dist/node.d.ts +5 -5
  38. package/dist/node.js +19 -18
  39. package/dist/reporters.d.ts +2 -2
  40. package/dist/reporters.js +10 -9
  41. package/dist/runners.d.ts +9 -2
  42. package/dist/runners.js +5 -5
  43. package/dist/snapshot.js +2 -2
  44. package/dist/suite.js +3 -3
  45. package/dist/worker.js +1 -1
  46. package/dist/workers/forks.js +3 -3
  47. package/dist/workers/runVmTests.js +8 -8
  48. package/dist/workers/threads.js +3 -3
  49. package/dist/workers/vmForks.js +5 -5
  50. package/dist/workers/vmThreads.js +5 -5
  51. package/dist/workers.d.ts +4 -4
  52. package/dist/workers.js +6 -6
  53. package/package.json +14 -15
  54. package/dist/chunks/index.BMmMjLIQ.js +0 -3975
@@ -177,6 +177,9 @@ interface SerializedConfig {
177
177
  width: number;
178
178
  height: number;
179
179
  };
180
+ locators: {
181
+ testIdAttribute: string;
182
+ };
180
183
  screenshotFailures: boolean;
181
184
  };
182
185
  standalone: boolean;
@@ -7,7 +7,7 @@ import { R as RealDate } from './date.W2xKR2qe.js';
7
7
  import 'pathe';
8
8
  import '@vitest/runner/utils';
9
9
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
10
- import './env.BU041cs9.js';
10
+ import './env.CmHVDJnw.js';
11
11
  import 'std-env';
12
12
 
13
13
  const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
@@ -155,7 +155,6 @@ const vanillaExample = {
155
155
  js: `
156
156
  export default function HelloWorld({ name }) {
157
157
  const parent = document.createElement('div')
158
- document.body.appendChild(parent)
159
158
 
160
159
  const h1 = document.createElement('h1')
161
160
  h1.textContent = 'Hello ' + name + '!'
@@ -167,7 +166,6 @@ export default function HelloWorld({ name }) {
167
166
  ts: `
168
167
  export default function HelloWorld({ name }: { name: string }): HTMLDivElement {
169
168
  const parent = document.createElement('div')
170
- document.body.appendChild(parent)
171
169
 
172
170
  const h1 = document.createElement('h1')
173
171
  h1.textContent = 'Hello ' + name + '!'
@@ -179,10 +177,11 @@ export default function HelloWorld({ name }: { name: string }): HTMLDivElement {
179
177
  test: `
180
178
  import { expect, test } from 'vitest'
181
179
  import { getByText } from '@testing-library/dom'
182
- import HelloWorld from './HelloWorld'
180
+ import HelloWorld from './HelloWorld.js'
183
181
 
184
182
  test('renders name', () => {
185
183
  const parent = HelloWorld({ name: 'Vitest' })
184
+ document.body.appendChild(parent)
186
185
 
187
186
  const element = getByText(parent, 'Hello Vitest!')
188
187
  expect(element).toBeInTheDocument()
@@ -4,4 +4,4 @@ const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.v
4
4
  const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
5
5
  const isWindows = (isNode || isDeno) && process.platform === "win32";
6
6
 
7
- export { isDeno as a, isWindows as b, isNode as i };
7
+ export { isNode as a, isDeno as b, isWindows as i };
@@ -7,7 +7,7 @@ import { resolve, isAbsolute, dirname, join, basename, extname, normalize, relat
7
7
  import { processError } from '@vitest/utils/error';
8
8
  import { distDir } from '../path.js';
9
9
  import { highlight, getType } from '@vitest/utils';
10
- import { g as getAllMockableProperties } from './base.DSsbfkDg.js';
10
+ import { g as getAllMockableProperties } from './base.BH-FAiX7.js';
11
11
 
12
12
  const { existsSync, readdirSync } = fs;
13
13
  const spyModulePath = resolve(distDir, "spy.js");
@@ -228,15 +228,16 @@ If you need to partially mock a module, you can use "importOriginal" helper insi
228
228
  resolveMockPath(mockPath, external) {
229
229
  const path = external || mockPath;
230
230
  if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) {
231
- let findFile2 = function(files2, baseOriginal2) {
232
- for (const file of files2) {
231
+ let findFile2 = function(mockFolder2, baseOriginal2) {
232
+ const files = readdirSync(mockFolder2);
233
+ for (const file of files) {
233
234
  const baseFile = basename(file, extname(file));
234
235
  if (baseFile === baseOriginal2) {
235
- const path2 = resolve(mockFolder, file);
236
+ const path2 = resolve(mockFolder2, file);
236
237
  if (fs.statSync(path2).isFile()) {
237
238
  return path2;
238
239
  } else {
239
- const indexFile = findFile2(readdirSync(path2), "index");
240
+ const indexFile = findFile2(path2, "index");
240
241
  if (indexFile) {
241
242
  return indexFile;
242
243
  }
@@ -250,9 +251,8 @@ If you need to partially mock a module, you can use "importOriginal" helper insi
250
251
  if (!existsSync(mockFolder)) {
251
252
  return null;
252
253
  }
253
- const files = readdirSync(mockFolder);
254
254
  const baseOriginal = basename(path);
255
- return findFile2(files, baseOriginal);
255
+ return findFile2(mockFolder, baseOriginal);
256
256
  }
257
257
  const dir = dirname(path);
258
258
  const baseId = basename(path);
@@ -1,16 +1,16 @@
1
1
  import { g as globalApis } from './constants.CaAN7icJ.js';
2
- import { V as VitestIndex } from './index.BfeNhc0N.js';
2
+ import { V as VitestIndex } from './index.CNZXZ9PJ.js';
3
3
  import '@vitest/runner';
4
- import './benchmark.DDmpNjj-.js';
4
+ import './benchmark.C8CRJYG4.js';
5
5
  import '@vitest/runner/utils';
6
6
  import '@vitest/utils';
7
- import './index.DYufA6CZ.js';
7
+ import './index.CxRxs566.js';
8
8
  import 'pathe';
9
9
  import './utils.Ck2hJTRs.js';
10
- import './env.BU041cs9.js';
10
+ import './env.CmHVDJnw.js';
11
11
  import 'std-env';
12
12
  import './run-once.Sxe67Wng.js';
13
- import './vi.fiQ7lMRF.js';
13
+ import './vi.B6QZ938s.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.DSsbfkDg.js';
21
+ import './base.BH-FAiX7.js';
22
22
  import './date.W2xKR2qe.js';
23
23
  import '@vitest/spy';
24
24
 
@@ -1,7 +1,7 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
- import { b as bench } from './benchmark.DDmpNjj-.js';
2
+ import { b as bench } from './benchmark.C8CRJYG4.js';
3
3
  import { i as isFirstRun, a as runOnce } from './run-once.Sxe67Wng.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.fiQ7lMRF.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.B6QZ938s.js';
5
5
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
@@ -2,7 +2,7 @@ import { relative } from 'pathe';
2
2
  import '@vitest/runner/utils';
3
3
  import '@vitest/utils';
4
4
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
5
- import './env.BU041cs9.js';
5
+ import './env.CmHVDJnw.js';
6
6
 
7
7
  function getRunMode() {
8
8
  return getWorkerState().config.mode;
@@ -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.CqfT4xaf.js';
7
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.CNzatKMx.js';
7
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.KBrCO5LJ.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -12,7 +12,7 @@ function setupChaiConfig(config) {
12
12
 
13
13
  async function resolveSnapshotEnvironment(config, executor) {
14
14
  if (!config.snapshotEnvironment) {
15
- const { VitestNodeSnapshotEnvironment } = await import('./node.DS3zEPa7.js');
15
+ const { VitestNodeSnapshotEnvironment } = await import('./node.Bx4JZjMG.js');
16
16
  return new VitestNodeSnapshotEnvironment();
17
17
  }
18
18
  const mod = await executor.executeId(config.snapshotEnvironment);