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.
- package/dist/browser.d.ts +8 -8
- package/dist/browser.js +1 -1
- package/dist/chunks/{RandomSequencer.CMRlh2v4.js → RandomSequencer.gisBJ77r.js} +11 -3
- package/dist/chunks/{base.BS0HhLXd.js → base.CkcgFVQd.js} +8 -3
- package/dist/chunks/{benchmark.geERunq4.d.ts → benchmark.CFFwLv-O.d.ts} +2 -2
- package/dist/chunks/{cac.Z91LBqmg.js → cac.CWCZimpS.js} +7 -7
- package/dist/chunks/{cli-api.DVJJMJHj.js → cli-api.BKUOv0Nc.js} +928 -661
- package/dist/chunks/{config.CPguQ7J1.d.ts → config.BTPBhmK5.d.ts} +1 -1
- package/dist/chunks/{creator.IIqd8RWT.js → creator.DcAcUhMD.js} +1 -4
- package/dist/chunks/{globals.BCGEw6ON.js → globals.DJTzb7B3.js} +2 -2
- package/dist/chunks/{index.DD5eTY2y.js → index.BqHViJW9.js} +1 -1
- package/dist/chunks/{index.BjjsHdBb.js → index.CkOJwybT.js} +1 -1
- package/dist/chunks/{index.DLRzErGF.js → index.DKe7vK-G.js} +708 -548
- package/dist/chunks/{index.CqYx2Nsr.js → index.DQboAxJm.js} +23 -14
- package/dist/chunks/{inspector.70d6emsh.js → inspector.DKLceBVD.js} +1 -1
- package/dist/chunks/{reporters.B_9uUTGW.d.ts → reporters.BZbwTvrM.d.ts} +1252 -1234
- package/dist/chunks/{resolveConfig.CQIc6fe7.js → resolveConfig.3rGGWga5.js} +88 -56
- package/dist/chunks/{runBaseTests.B7hcVT-s.js → runBaseTests.C6huCAng.js} +6 -6
- package/dist/chunks/{setup-common.BfGt8K-K.js → setup-common.B5ClyS48.js} +1 -1
- package/dist/chunks/{suite.B2jumIFP.d.ts → suite.BJU7kdY9.d.ts} +4 -4
- package/dist/chunks/{utils.DNoFbBUZ.js → utils.CMUTX-p8.js} +20 -23
- package/dist/chunks/{vi.BlPttogV.js → vi.CZKezqeD.js} +18 -13
- package/dist/chunks/{vite.Bvms8Xir.d.ts → vite.DIfmneq0.d.ts} +1 -1
- package/dist/chunks/{vm.Zr4qWzDJ.js → vm.DGhTouO3.js} +10 -1
- package/dist/chunks/{worker.9VY11NZs.d.ts → worker.CmzGeuVD.d.ts} +3 -3
- package/dist/chunks/{worker.Qz1UB4Fv.d.ts → worker.umPNbBNk.d.ts} +1 -1
- package/dist/cli.js +1 -1
- package/dist/config.cjs +1 -10
- package/dist/config.d.ts +11 -11
- package/dist/config.js +1 -10
- package/dist/coverage.d.ts +7 -7
- package/dist/coverage.js +4 -4
- package/dist/execute.d.ts +3 -3
- package/dist/index.d.ts +26 -17
- package/dist/index.js +2 -2
- package/dist/node.d.ts +16 -20
- package/dist/node.js +7 -7
- package/dist/reporters.d.ts +7 -7
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +3 -4
- package/dist/runners.js +9 -14
- package/dist/suite.d.ts +2 -2
- package/dist/worker.js +1 -1
- package/dist/workers/forks.js +1 -1
- package/dist/workers/runVmTests.js +6 -6
- package/dist/workers/threads.js +1 -1
- package/dist/workers/vmForks.js +1 -1
- package/dist/workers/vmThreads.js +1 -1
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +3 -3
- package/package.json +22 -22
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import process$1 from 'process';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import fsp from 'node:fs/promises';
|
|
4
|
-
import a from 'node:path';
|
|
5
1
|
import process from 'node:process';
|
|
6
|
-
import { existsSync } from 'fs';
|
|
7
|
-
import
|
|
2
|
+
import fs, { existsSync } from 'node:fs';
|
|
3
|
+
import fsp from 'node:fs/promises';
|
|
4
|
+
import a, { resolve } from 'node:path';
|
|
8
5
|
import { x } from 'tinyexec';
|
|
9
6
|
|
|
10
7
|
const AGENTS = [
|
|
@@ -13,17 +10,20 @@ const AGENTS = [
|
|
|
13
10
|
"yarn@berry",
|
|
14
11
|
"pnpm",
|
|
15
12
|
"pnpm@6",
|
|
16
|
-
"bun"
|
|
13
|
+
"bun",
|
|
14
|
+
"deno"
|
|
17
15
|
];
|
|
18
16
|
const LOCKS = {
|
|
19
17
|
"bun.lockb": "bun",
|
|
18
|
+
"deno.lock": "deno",
|
|
20
19
|
"pnpm-lock.yaml": "pnpm",
|
|
21
20
|
"yarn.lock": "yarn",
|
|
22
21
|
"package-lock.json": "npm",
|
|
23
22
|
"npm-shrinkwrap.json": "npm"
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
async function detect(
|
|
25
|
+
async function detect(options = {}) {
|
|
26
|
+
const { cwd, onUnknown } = options;
|
|
27
27
|
for (const directory of lookup(cwd)) {
|
|
28
28
|
for (const lock of Object.keys(LOCKS)) {
|
|
29
29
|
if (await fileExists(a.join(directory, lock))) {
|
|
@@ -50,8 +50,9 @@ function* lookup(cwd = process.cwd()) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
async function parsePackageJson(filepath, onUnknown) {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
return !filepath || !await fileExists(filepath) ? null : handlePackageManager(filepath, onUnknown);
|
|
54
|
+
}
|
|
55
|
+
function handlePackageManager(filepath, onUnknown) {
|
|
55
56
|
try {
|
|
56
57
|
const pkg = JSON.parse(fs.readFileSync(filepath, "utf8"));
|
|
57
58
|
let agent;
|
|
@@ -88,7 +89,7 @@ async function fileExists(filePath) {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
// src/detect.ts
|
|
91
|
-
async function detectPackageManager(cwd = process
|
|
92
|
+
async function detectPackageManager(cwd = process.cwd()) {
|
|
92
93
|
const result = await detect({
|
|
93
94
|
cwd,
|
|
94
95
|
onUnknown(packageManager) {
|
|
@@ -103,15 +104,23 @@ async function installPackage(names, options = {}) {
|
|
|
103
104
|
const [agent] = detectedAgent.split("@");
|
|
104
105
|
if (!Array.isArray(names))
|
|
105
106
|
names = [names];
|
|
106
|
-
const args = options.additionalArgs || [];
|
|
107
|
+
const args = (typeof options.additionalArgs === "function" ? options.additionalArgs(agent, detectedAgent) : options.additionalArgs) || [];
|
|
107
108
|
if (options.preferOffline) {
|
|
108
109
|
if (detectedAgent === "yarn@berry")
|
|
109
110
|
args.unshift("--cached");
|
|
110
111
|
else
|
|
111
112
|
args.unshift("--prefer-offline");
|
|
112
113
|
}
|
|
113
|
-
if (agent === "pnpm" && existsSync(resolve(options.cwd ?? process
|
|
114
|
-
args.unshift(
|
|
114
|
+
if (agent === "pnpm" && existsSync(resolve(options.cwd ?? process.cwd(), "pnpm-workspace.yaml"))) {
|
|
115
|
+
args.unshift(
|
|
116
|
+
"-w",
|
|
117
|
+
/**
|
|
118
|
+
* Prevent pnpm from removing installed devDeps while `NODE_ENV` is `production`
|
|
119
|
+
* @see https://pnpm.io/cli/install#--prod--p
|
|
120
|
+
*/
|
|
121
|
+
"--prod=false"
|
|
122
|
+
);
|
|
123
|
+
}
|
|
115
124
|
return x(
|
|
116
125
|
agent,
|
|
117
126
|
[
|
|
@@ -17,7 +17,7 @@ function setupInspect(ctx) {
|
|
|
17
17
|
config.inspector.waitForDebugger
|
|
18
18
|
);
|
|
19
19
|
if (config.inspectBrk) {
|
|
20
|
-
const firstTestFile = ctx.files[0];
|
|
20
|
+
const firstTestFile = typeof ctx.files[0] === "string" ? ctx.files[0] : ctx.files[0].filepath;
|
|
21
21
|
if (firstTestFile) {
|
|
22
22
|
session = new inspector.Session();
|
|
23
23
|
session.connect();
|