vitest 1.6.0 → 2.0.0-beta.10
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/LICENSE.md +173 -1
- package/dist/browser.d.ts +22 -2
- package/dist/browser.js +6 -4
- package/dist/chunks/{environments-node.vcoXCoKs.js → environments-node.39w4gmlF.js} +2 -2
- package/dist/chunks/{install-pkg.LE8oaA1t.js → install-pkg.DNUmWFkO.js} +2 -2
- package/dist/chunks/integrations-globals.C6Ah-pUW.js +31 -0
- package/dist/chunks/{runtime-console.EO5ha7qv.js → runtime-console.DiVMr5d4.js} +62 -32
- package/dist/chunks/{runtime-runBaseTests.oAvMKtQC.js → runtime-runBaseTests.Cukyr5-I.js} +18 -18
- package/dist/cli.js +3 -3
- package/dist/config.cjs +4 -5
- package/dist/config.d.ts +2 -2
- package/dist/config.js +4 -5
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +34 -8
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +3 -2
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +777 -65
- package/dist/index.js +12 -12
- package/dist/node.d.ts +7 -7
- package/dist/node.js +24 -23
- package/dist/{reporters-yx5ZTtEV.d.ts → reporters-CYVC6LOl.d.ts} +439 -219
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +11 -12
- package/dist/runners.d.ts +4 -2
- package/dist/runners.js +25 -18
- package/dist/snapshot.js +3 -3
- package/dist/{suite-IbNSsUWN.d.ts → suite-Dpu9EC_k.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +4 -4
- package/dist/vendor/{base.Ybri3C14.js → base.Dln9yllP.js} +3 -3
- package/dist/vendor/{base.5NT-gWu5.js → base._gnK9Slw.js} +1 -2
- package/dist/vendor/{benchmark.yGkUTKnC.js → benchmark.BNLebNi5.js} +1 -1
- package/dist/vendor/{cac.EdDItJD-.js → cac.CtYFkoSJ.js} +66 -25
- package/dist/vendor/{cli-api.E07AF1Yq.js → cli-api.CUtJc4r3.js} +11851 -7276
- package/dist/vendor/{constants.5J7I254_.js → constants.TCjCaw2D.js} +4 -3
- package/dist/vendor/{execute.fL3szUAI.js → execute.BHj6OMh4.js} +4 -4
- package/dist/vendor/{index.DpVgvm2P.js → index.B5SKBLvV.js} +5 -5
- package/dist/vendor/{index.Q04MCqDO.js → index.BOMEjpjj.js} +680 -160
- package/dist/vendor/{index.8bPxjt7g.js → index.BpSiYbpB.js} +5 -1
- package/dist/vendor/{index.xL8XjTLv.js → index.CThipSqB.js} +2538 -2525
- package/dist/vendor/{index.dI9lHwVn.js → index.D3hs2WiI.js} +8 -6
- package/dist/vendor/{index.SMVOaj7F.js → index._7XLd8Kd.js} +2 -2
- package/dist/vendor/{index.GVFv9dZ0.js → index.kpsSqFiz.js} +2 -1
- package/dist/vendor/{rpc.joBhAkyK.js → rpc.DRDE9Pu1.js} +2 -2
- package/dist/vendor/{run-once.Olz_Zkd8.js → run-once.DLomgGUH.js} +1 -1
- package/dist/vendor/{setup-common.8nJLd4ay.js → setup-common.DAu7t7mY.js} +2 -2
- package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
- package/dist/vendor/{tasks.IknbGB2n.js → tasks.WC7M-K-v.js} +4 -1
- package/dist/vendor/{utils.dEtNIEgr.js → utils.YuQ3LT2a.js} +2 -2
- package/dist/vendor/{vi.YFlodzP_.js → vi.hATFzZbX.js} +124 -56
- package/dist/vendor/{vm.QEE48c0T.js → vm.Ow-X2mkS.js} +47 -59
- package/dist/worker.js +6 -6
- package/dist/workers/forks.js +5 -5
- package/dist/workers/runVmTests.js +17 -17
- package/dist/workers/threads.js +5 -5
- package/dist/workers/vmForks.js +8 -8
- package/dist/workers/vmThreads.js +8 -8
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +13 -13
- package/package.json +35 -35
- package/suppress-warnings.cjs +2 -1
- package/vitest.mjs +1 -1
- package/dist/chunks/integrations-globals.kw4co3rx.js +0 -31
- package/dist/cli-wrapper.js +0 -119
- /package/dist/chunks/{node-git.Hw101KjS.js → node-git.CCI8evVZ.js} +0 -0
- /package/dist/vendor/{_commonjsHelpers.jjO7Zipk.js → _commonjsHelpers.BFTU3MAI.js} +0 -0
- /package/dist/vendor/{coverage.E7sG1b3r.js → coverage.ChSqD-qS.js} +0 -0
- /package/dist/vendor/{date.Ns1pGd_X.js → date.BKM1wewY.js} +0 -0
- /package/dist/vendor/{env.AtSIuHFg.js → env.bmJgw1qP.js} +0 -0
- /package/dist/vendor/{global.CkGT_TMy.js → global.7bFbnyXl.js} +0 -0
- /package/dist/vendor/{inspector.IgLX3ur5.js → inspector.hPQncR7V.js} +0 -0
- /package/dist/vendor/{utils.0uYuCbzo.js → utils.CUjzkRH7.js} +0 -0
|
@@ -3,9 +3,10 @@ const defaultBrowserPort = 63315;
|
|
|
3
3
|
const defaultInspectPort = 9229;
|
|
4
4
|
const EXIT_CODE_RESTART = 43;
|
|
5
5
|
const API_PATH = "/__vitest_api__";
|
|
6
|
+
const BROWSER_API_PATH = "/__vitest_browser_api__";
|
|
6
7
|
const extraInlineDeps = [
|
|
7
|
-
/^(?!.*
|
|
8
|
-
/^(?!.*
|
|
8
|
+
/^(?!.*node_modules).*\.mjs$/,
|
|
9
|
+
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
9
10
|
// Vite client
|
|
10
11
|
/vite\w*\/dist\/client\/env.mjs/,
|
|
11
12
|
// Nuxt
|
|
@@ -62,4 +63,4 @@ const globalApis = [
|
|
|
62
63
|
"onTestFailed"
|
|
63
64
|
];
|
|
64
65
|
|
|
65
|
-
export { API_PATH as A, CONFIG_NAMES as C, EXIT_CODE_RESTART as E, defaultBrowserPort as a, defaultInspectPort as b, configFiles as c, defaultPort as d, extraInlineDeps as e, globalApis as g, workspacesFiles as w };
|
|
66
|
+
export { API_PATH as A, BROWSER_API_PATH as B, CONFIG_NAMES as C, EXIT_CODE_RESTART as E, defaultBrowserPort as a, defaultInspectPort as b, configFiles as c, defaultPort as d, extraInlineDeps as e, globalApis as g, workspacesFiles as w };
|
|
@@ -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.
|
|
10
|
+
import { g as getAllMockableProperties } from './base._gnK9Slw.js';
|
|
11
11
|
|
|
12
12
|
const spyModulePath = resolve(distDir, "spy.js");
|
|
13
13
|
class RefTracker {
|
|
@@ -68,7 +68,7 @@ class VitestMocker {
|
|
|
68
68
|
if (this.moduleCache.has(mockId))
|
|
69
69
|
this.moduleCache.delete(mockId);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
isModuleDirectory(path) {
|
|
72
72
|
return this.moduleDirectories.some((dir) => path.includes(dir));
|
|
73
73
|
}
|
|
74
74
|
getSuiteFilepath() {
|
|
@@ -103,7 +103,7 @@ class VitestMocker {
|
|
|
103
103
|
throw error;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
const external = !isAbsolute(fsPath) || this.
|
|
106
|
+
const external = !isAbsolute(fsPath) || this.isModuleDirectory(fsPath) ? rawId : null;
|
|
107
107
|
return {
|
|
108
108
|
id,
|
|
109
109
|
fsPath,
|
|
@@ -368,7 +368,7 @@ async function createVitestExecutor(options) {
|
|
|
368
368
|
return runner;
|
|
369
369
|
}
|
|
370
370
|
const externalizeMap = /* @__PURE__ */ new Map();
|
|
371
|
-
const bareVitestRegexp = /^@?vitest(
|
|
371
|
+
const bareVitestRegexp = /^@?vitest(?:\/|$)/;
|
|
372
372
|
const dispose = [];
|
|
373
373
|
function listenForErrors(state) {
|
|
374
374
|
dispose.forEach((fn) => fn());
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as chai from 'chai';
|
|
2
2
|
import { resolve } from 'pathe';
|
|
3
3
|
import { distDir } from '../path.js';
|
|
4
|
-
import { g as getWorkerState } from './global.
|
|
5
|
-
import { r as rpc } from './rpc.
|
|
6
|
-
import { t as takeCoverageInsideWorker } from './coverage.
|
|
7
|
-
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.
|
|
4
|
+
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
5
|
+
import { r as rpc } from './rpc.DRDE9Pu1.js';
|
|
6
|
+
import { t as takeCoverageInsideWorker } from './coverage.ChSqD-qS.js';
|
|
7
|
+
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.DAu7t7mY.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('../chunks/environments-node.
|
|
15
|
+
const { VitestNodeSnapshotEnvironment } = await import('../chunks/environments-node.39w4gmlF.js');
|
|
16
16
|
return new VitestNodeSnapshotEnvironment();
|
|
17
17
|
}
|
|
18
18
|
const mod = await executor.executeId(config.snapshotEnvironment);
|