vitest 3.0.0-beta.1 → 3.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.
- package/dist/browser.d.ts +12 -9
- package/dist/browser.js +2 -2
- package/dist/chunks/{RandomSequencer.gisBJ77r.js → RandomSequencer.C6x84bNN.js} +4 -3
- package/dist/chunks/{base.CkcgFVQd.js → base.CQ2VEtuH.js} +1 -1
- package/dist/chunks/{cac.CWCZimpS.js → cac.e7qW4xLT.js} +34 -18
- package/dist/chunks/{cli-api.BKUOv0Nc.js → cli-api.CWDlED-m.js} +1126 -537
- package/dist/chunks/{coverage.BoMDb1ip.js → coverage.BWeNbfBa.js} +4 -4
- package/dist/chunks/{creator.DcAcUhMD.js → creator.Ot9GlSGw.js} +16 -14
- package/dist/chunks/{environment.CT0jpO-1.d.ts → environment.d8YfPkTm.d.ts} +1 -3
- package/dist/chunks/{globals.DJTzb7B3.js → globals.BFncSRNA.js} +2 -2
- package/dist/chunks/{index.CkOJwybT.js → index.BBoOXW-l.js} +7 -2
- package/dist/chunks/{index.BqHViJW9.js → index.CkWmZCXU.js} +1 -1
- package/dist/chunks/{index.DKe7vK-G.js → index.CzkCSFCy.js} +670 -628
- package/dist/chunks/{reporters.BZbwTvrM.d.ts → reporters.DCiyjXOg.d.ts} +634 -532
- package/dist/chunks/{resolveConfig.3rGGWga5.js → resolveConfig.C1d7TK-U.js} +5560 -5541
- package/dist/chunks/{runBaseTests.C6huCAng.js → runBaseTests.qNWRkgHj.js} +11 -10
- package/dist/chunks/{setup-common.B5ClyS48.js → setup-common.Cp_bu5q3.js} +1 -1
- package/dist/chunks/types.BOjykUpq.d.ts +27 -0
- package/dist/chunks/{utils.CMUTX-p8.js → utils.Coei4Wlj.js} +1 -1
- package/dist/chunks/{vi.CZKezqeD.js → vi.S4Fq8wSo.js} +2 -1
- package/dist/chunks/{vite.DIfmneq0.d.ts → vite.CRSMFy31.d.ts} +1 -1
- package/dist/chunks/{worker.umPNbBNk.d.ts → worker.R-PA7DpW.d.ts} +1 -1
- package/dist/chunks/{worker.CmzGeuVD.d.ts → worker.XbtCXEXv.d.ts} +4 -3
- package/dist/cli.js +1 -1
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +6 -8
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +4 -6
- package/dist/coverage.js +33 -8
- package/dist/environments.d.ts +2 -2
- package/dist/execute.d.ts +2 -2
- package/dist/index.d.ts +11 -14
- package/dist/index.js +2 -2
- package/dist/node.d.ts +22 -17
- package/dist/node.js +66 -32
- package/dist/reporters.d.ts +4 -6
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +2 -2
- package/dist/runners.js +3 -3
- package/dist/suite.d.ts +1 -1
- package/dist/workers/forks.js +1 -1
- package/dist/workers/runVmTests.js +7 -7
- package/dist/workers/threads.js +1 -1
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +1 -1
- package/package.json +15 -15
|
@@ -43,10 +43,10 @@ async function getCoverageProvider(options, loader) {
|
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
|
-
async function startCoverageInsideWorker(options, loader) {
|
|
46
|
+
async function startCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
47
47
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
48
48
|
if (coverageModule) {
|
|
49
|
-
return coverageModule.startCoverage?.();
|
|
49
|
+
return coverageModule.startCoverage?.(runtimeOptions);
|
|
50
50
|
}
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
@@ -57,10 +57,10 @@ async function takeCoverageInsideWorker(options, loader) {
|
|
|
57
57
|
}
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
|
-
async function stopCoverageInsideWorker(options, loader) {
|
|
60
|
+
async function stopCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
61
61
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
62
62
|
if (coverageModule) {
|
|
63
|
-
return coverageModule.stopCoverage?.();
|
|
63
|
+
return coverageModule.stopCoverage?.(runtimeOptions);
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
@@ -421,9 +421,9 @@ function getPossibleProvider(dependencies) {
|
|
|
421
421
|
function getProviderDocsLink(provider) {
|
|
422
422
|
switch (provider) {
|
|
423
423
|
case "playwright":
|
|
424
|
-
return "https://
|
|
424
|
+
return "https://vitest.dev/guide/browser/playwright";
|
|
425
425
|
case "webdriverio":
|
|
426
|
-
return "https://
|
|
426
|
+
return "https://vitest.dev/guide/browser/webdriverio";
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
function sort(choices, value) {
|
|
@@ -450,10 +450,11 @@ async function generateWorkspaceFile(options) {
|
|
|
450
450
|
` test: {`,
|
|
451
451
|
` browser: {`,
|
|
452
452
|
` enabled: true,`,
|
|
453
|
-
` name: '${options.browser}',`,
|
|
454
453
|
` provider: '${options.provider}',`,
|
|
455
454
|
options.provider !== "preview" && ` // ${getProviderDocsLink(options.provider)}`,
|
|
456
|
-
|
|
455
|
+
` configs: [`,
|
|
456
|
+
...options.browsers.map((browser) => ` { browser: '${browser}' },`),
|
|
457
|
+
` ],`,
|
|
457
458
|
` },`,
|
|
458
459
|
` },`,
|
|
459
460
|
` },`,
|
|
@@ -473,10 +474,11 @@ async function generateFrameworkConfigFile(options) {
|
|
|
473
474
|
` test: {`,
|
|
474
475
|
` browser: {`,
|
|
475
476
|
` enabled: true,`,
|
|
476
|
-
` name: '${options.browser}',`,
|
|
477
477
|
` provider: '${options.provider}',`,
|
|
478
478
|
options.provider !== "preview" && ` // ${getProviderDocsLink(options.provider)}`,
|
|
479
|
-
|
|
479
|
+
` configs: [`,
|
|
480
|
+
...options.browsers.map((browser) => ` { browser: '${browser}' },`),
|
|
481
|
+
` ],`,
|
|
480
482
|
` },`,
|
|
481
483
|
` },`,
|
|
482
484
|
`})`,
|
|
@@ -557,13 +559,13 @@ async function create() {
|
|
|
557
559
|
if (!provider) {
|
|
558
560
|
return fail();
|
|
559
561
|
}
|
|
560
|
-
const {
|
|
561
|
-
type: "
|
|
562
|
-
name: "
|
|
562
|
+
const { browsers } = await prompt({
|
|
563
|
+
type: "multiselect",
|
|
564
|
+
name: "browsers",
|
|
563
565
|
message: "Choose a browser",
|
|
564
|
-
choices: getBrowserNames(provider).map((
|
|
565
|
-
title:
|
|
566
|
-
value:
|
|
566
|
+
choices: getBrowserNames(provider).map((browser) => ({
|
|
567
|
+
title: browser,
|
|
568
|
+
value: browser
|
|
567
569
|
}))
|
|
568
570
|
});
|
|
569
571
|
if (!provider) {
|
|
@@ -626,7 +628,7 @@ async function create() {
|
|
|
626
628
|
configPath: browserWorkspaceFile,
|
|
627
629
|
rootConfig,
|
|
628
630
|
provider,
|
|
629
|
-
|
|
631
|
+
browsers
|
|
630
632
|
});
|
|
631
633
|
log(c.green("\u2714"), "Created a workspace file for browser tests:", c.bold(relative(process.cwd(), browserWorkspaceFile)));
|
|
632
634
|
} else {
|
|
@@ -636,7 +638,7 @@ async function create() {
|
|
|
636
638
|
framework,
|
|
637
639
|
frameworkPlugin,
|
|
638
640
|
provider,
|
|
639
|
-
|
|
641
|
+
browsers
|
|
640
642
|
});
|
|
641
643
|
log(c.green("\u2714"), "Created a config file for browser tests", c.bold(relative(process.cwd(), configPath)));
|
|
642
644
|
}
|
|
@@ -35,8 +35,6 @@ interface ModuleGraphData {
|
|
|
35
35
|
externalized: string[];
|
|
36
36
|
inlined: string[];
|
|
37
37
|
}
|
|
38
|
-
type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
|
|
39
|
-
type OnTestsRerunHandler = (testFiles: string[]) => Promise<void> | void;
|
|
40
38
|
interface ProvidedContext {
|
|
41
39
|
}
|
|
42
40
|
|
|
@@ -172,4 +170,4 @@ interface ResolvedTestEnvironment {
|
|
|
172
170
|
options: Record<string, any> | null;
|
|
173
171
|
}
|
|
174
172
|
|
|
175
|
-
export type { AfterSuiteRunMeta as A, Constructable as C, Environment as E, HappyDOMOptions as H, JSDOMOptions as J, ModuleGraphData as M, Nullable as N,
|
|
173
|
+
export type { AfterSuiteRunMeta as A, Constructable as C, Environment as E, HappyDOMOptions as H, JSDOMOptions as J, ModuleGraphData as M, Nullable as N, ProvidedContext as P, ResolvedTestEnvironment as R, TransformMode as T, UserConsoleLog as U, VmEnvironmentReturn as V, EnvironmentReturn as a, Awaitable as b, Arrayable as c, ArgumentsType as d, MutableArray as e, EnvironmentOptions as f, ModuleCache as g };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as globalApis } from './constants.fzPh7AOq.js';
|
|
2
|
-
import { V as VitestIndex } from './index.
|
|
3
|
-
import './vi.
|
|
2
|
+
import { V as VitestIndex } from './index.CkWmZCXU.js';
|
|
3
|
+
import './vi.S4Fq8wSo.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as chai from 'chai';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { t as takeCoverageInsideWorker } from './coverage.
|
|
3
|
+
import { t as takeCoverageInsideWorker } from './coverage.BWeNbfBa.js';
|
|
4
4
|
import { distDir } from '../path.js';
|
|
5
5
|
import { r as rpc } from './rpc.C3q9uwRX.js';
|
|
6
|
-
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.
|
|
6
|
+
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.Cp_bu5q3.js';
|
|
7
7
|
import { g as getWorkerState } from './utils.C8RiOc4B.js';
|
|
8
8
|
|
|
9
9
|
function setupChaiConfig(config) {
|
|
@@ -63,6 +63,11 @@ async function resolveTestRunner(config, executor) {
|
|
|
63
63
|
await originalOnTaskUpdate?.call(testRunner, task);
|
|
64
64
|
return p;
|
|
65
65
|
};
|
|
66
|
+
const originalOnCollectStart = testRunner.onCollectStart;
|
|
67
|
+
testRunner.onCollectStart = async (file) => {
|
|
68
|
+
await rpc().onQueued(file);
|
|
69
|
+
await originalOnCollectStart?.call(testRunner, file);
|
|
70
|
+
};
|
|
66
71
|
const originalOnCollected = testRunner.onCollected;
|
|
67
72
|
testRunner.onCollected = async (files) => {
|
|
68
73
|
const state = getWorkerState();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.
|
|
1
|
+
import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.S4Fq8wSo.js';
|
|
2
2
|
import { i as isFirstRun, a as runOnce } from './run-once.2ogXb3JV.js';
|
|
3
3
|
import { b as bench } from './benchmark.Cdu9hjj4.js';
|
|
4
4
|
import { expectTypeOf } from 'expect-type';
|