vitest 4.0.0-beta.10 → 4.0.0-beta.12
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 +85 -101
- package/dist/browser.d.ts +10 -6
- package/dist/browser.js +8 -5
- package/dist/chunks/{benchmark.CJUa-Hsa.js → benchmark.DHKMYAts.js} +2 -2
- package/dist/chunks/{browser.d.yFAklsD1.d.ts → browser.d.D9YV3JvA.d.ts} +1 -1
- package/dist/chunks/{cac.DCxo_nSu.js → cac.r1gel_VZ.js} +18 -11
- package/dist/chunks/{cli-api.BJJXh9BV.js → cli-api.CpywZzJV.js} +153 -176
- package/dist/chunks/{config.d.B_LthbQq.d.ts → config.d.DGazh2r6.d.ts} +3 -1
- package/dist/chunks/{console.7h5kHUIf.js → console.CTJL2nuH.js} +4 -6
- package/dist/chunks/{coverage.BCU-r2QL.js → coverage.CiB0fs_7.js} +57 -79
- package/dist/chunks/{creator.08Gi-vCA.js → creator.DfXDsUyL.js} +6 -8
- package/dist/chunks/{global.d.BK3X7FW1.d.ts → global.d.BcFPD2LN.d.ts} +0 -13
- package/dist/chunks/{globals.DG-S3xFe.js → globals.DC4ntO86.js} +8 -6
- package/dist/chunks/{index.DIWhzsUh.js → index.Bt-upxGS.js} +6 -12
- package/dist/chunks/{index.BIP7prJq.js → index.CHrBLuEH.js} +94 -103
- package/dist/chunks/{index.X0nbfr6-.js → index.Dc3xnDvT.js} +48 -289
- package/dist/chunks/{index.CMfqw92x.js → index.Dnl38iQ_.js} +2 -2
- package/dist/chunks/{index.BjKEiSn0.js → index.uLUz1RDt.js} +3 -3
- package/dist/chunks/{inspector.CvQD-Nie.js → inspector.Br76Q2Mb.js} +1 -4
- package/dist/chunks/{moduleRunner.d.D9nBoC4p.d.ts → moduleRunner.d.CeYc7nZ0.d.ts} +1 -1
- package/dist/chunks/{node.CyipiPvJ.js → node.BwAWWjHZ.js} +3 -4
- package/dist/chunks/{plugin.d.BMVSnsGV.d.ts → plugin.d.XreRXLXS.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BUWjmRYq.d.ts → reporters.d.CJVTaaWb.d.ts} +54 -13
- package/dist/chunks/{resolveSnapshotEnvironment.Bkht6Yor.js → resolveSnapshotEnvironment.BsJpmVZR.js} +7 -8
- package/dist/chunks/{rpc.BKr6mtxz.js → rpc.cD77ENhU.js} +13 -14
- package/dist/chunks/{setup-common.uiMcU3cv.js → setup-common.BewgbkTd.js} +6 -6
- package/dist/chunks/{startModuleRunner.p67gbNo9.js → startModuleRunner.DPBo3mme.js} +65 -56
- package/dist/chunks/{test.BiqSKISg.js → test.CTuWuHYH.js} +7 -7
- package/dist/chunks/{typechecker.DB-fIMaH.js → typechecker.BfOQ86_a.js} +624 -14
- package/dist/chunks/{utils.D2R2NiOH.js → utils.CG9h5ccR.js} +2 -5
- package/dist/chunks/{vi.ZPgvtBao.js → vi.B2--mG9U.js} +38 -145
- package/dist/{worker.js → chunks/worker.DVTUM2IW.js} +71 -42
- package/dist/chunks/{worker.d.BDsXGkwh.d.ts → worker.d.buwuBpBt.d.ts} +2 -77
- package/dist/cli.js +7 -5
- package/dist/config.d.ts +6 -6
- package/dist/coverage.d.ts +5 -5
- package/dist/coverage.js +4 -5
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +8 -6
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/module-evaluator.js +11 -13
- package/dist/module-runner.js +5 -5
- package/dist/node.d.ts +14 -11
- package/dist/node.js +18 -14
- package/dist/reporters.d.ts +5 -5
- package/dist/reporters.js +7 -5
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +9 -7
- package/dist/snapshot.js +3 -3
- package/dist/suite.js +4 -3
- package/dist/{chunks/base.Cjha6usc.js → worker-base.js} +104 -32
- package/dist/{chunks/vm.Ca0Y0W5f.js → worker-vm.js} +81 -31
- package/dist/workers/runVmTests.js +14 -11
- package/package.json +26 -26
- package/browser.d.ts +0 -1
- package/dist/chunks/moduleTransport.I-bgQy0S.js +0 -19
- package/dist/chunks/resolver.Bx6lE0iq.js +0 -119
- package/dist/chunks/utils.C2YI6McM.js +0 -52
- package/dist/chunks/worker.d.BNcX_2mH.d.ts +0 -8
- package/dist/workers/forks.js +0 -67
- package/dist/workers/threads.js +0 -55
- package/dist/workers/vmForks.js +0 -48
- package/dist/workers/vmThreads.js +0 -38
- package/dist/workers.d.ts +0 -38
- package/dist/workers.js +0 -48
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
|
|
3
|
-
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
4
|
-
function normalizeWindowsPath(input = "") {
|
|
5
|
-
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
6
|
-
}
|
|
7
|
-
const _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, normalize = function(path) {
|
|
8
|
-
if (path.length === 0) return ".";
|
|
9
|
-
path = normalizeWindowsPath(path);
|
|
10
|
-
const isUNCPath = path.match(_UNC_REGEX), isPathAbsolute = isAbsolute(path), trailingSeparator = path[path.length - 1] === "/";
|
|
11
|
-
if (path = normalizeString(path, !isPathAbsolute), path.length === 0) return isPathAbsolute ? "/" : trailingSeparator ? "./" : ".";
|
|
12
|
-
if (trailingSeparator) path += "/";
|
|
13
|
-
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
14
|
-
return isUNCPath ? isPathAbsolute ? `//${path}` : `//./${path}` : isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
15
|
-
}, join = function(...segments) {
|
|
16
|
-
let path = "";
|
|
17
|
-
for (const seg of segments) {
|
|
18
|
-
if (!seg) continue;
|
|
19
|
-
if (path.length > 0) {
|
|
20
|
-
const pathTrailing = path[path.length - 1] === "/", segLeading = seg[0] === "/", both = pathTrailing && segLeading;
|
|
21
|
-
if (both) path += seg.slice(1);
|
|
22
|
-
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
23
|
-
} else path += seg;
|
|
24
|
-
}
|
|
25
|
-
return normalize(path);
|
|
26
|
-
};
|
|
27
|
-
function normalizeString(path, allowAboveRoot) {
|
|
28
|
-
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
29
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
30
|
-
if (index < path.length) char = path[index];
|
|
31
|
-
else if (char === "/") break;
|
|
32
|
-
else char = "/";
|
|
33
|
-
if (char === "/") {
|
|
34
|
-
if (lastSlash === index - 1 || dots === 1);
|
|
35
|
-
else if (dots === 2) {
|
|
36
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
37
|
-
if (res.length > 2) {
|
|
38
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
39
|
-
if (lastSlashIndex === -1) res = "", lastSegmentLength = 0;
|
|
40
|
-
else res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
41
|
-
lastSlash = index, dots = 0;
|
|
42
|
-
continue;
|
|
43
|
-
} else if (res.length > 0) {
|
|
44
|
-
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (allowAboveRoot) res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2;
|
|
49
|
-
} else {
|
|
50
|
-
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
51
|
-
else res = path.slice(lastSlash + 1, index);
|
|
52
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
53
|
-
}
|
|
54
|
-
lastSlash = index, dots = 0;
|
|
55
|
-
} else if (char === "." && dots !== -1) ++dots;
|
|
56
|
-
else dots = -1;
|
|
57
|
-
}
|
|
58
|
-
return res;
|
|
59
|
-
}
|
|
60
|
-
const isAbsolute = function(p) {
|
|
61
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
62
|
-
}, dirname = function(p) {
|
|
63
|
-
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
64
|
-
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
65
|
-
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const packageCache = /* @__PURE__ */ new Map();
|
|
69
|
-
function findNearestPackageData(basedir) {
|
|
70
|
-
const originalBasedir = basedir;
|
|
71
|
-
while (basedir) {
|
|
72
|
-
var _tryStatSync;
|
|
73
|
-
const cached = getCachedData(packageCache, basedir, originalBasedir);
|
|
74
|
-
if (cached) return cached;
|
|
75
|
-
const pkgPath = join(basedir, "package.json");
|
|
76
|
-
if ((_tryStatSync = tryStatSync(pkgPath)) === null || _tryStatSync === void 0 ? void 0 : _tryStatSync.isFile()) {
|
|
77
|
-
const pkgData = JSON.parse(stripBomTag(fs.readFileSync(pkgPath, "utf8")));
|
|
78
|
-
if (packageCache) setCacheData(packageCache, pkgData, basedir, originalBasedir);
|
|
79
|
-
return pkgData;
|
|
80
|
-
}
|
|
81
|
-
const nextBasedir = dirname(basedir);
|
|
82
|
-
if (nextBasedir === basedir) break;
|
|
83
|
-
basedir = nextBasedir;
|
|
84
|
-
}
|
|
85
|
-
return {};
|
|
86
|
-
}
|
|
87
|
-
function stripBomTag(content) {
|
|
88
|
-
return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
89
|
-
}
|
|
90
|
-
function tryStatSync(file) {
|
|
91
|
-
try {
|
|
92
|
-
// The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
|
|
93
|
-
return fs.statSync(file, { throwIfNoEntry: false });
|
|
94
|
-
} catch {}
|
|
95
|
-
}
|
|
96
|
-
function getCachedData(cache, basedir, originalBasedir) {
|
|
97
|
-
const pkgData = cache.get(getFnpdCacheKey(basedir));
|
|
98
|
-
if (pkgData) return traverseBetweenDirs(originalBasedir, basedir, (dir) => {
|
|
99
|
-
cache.set(getFnpdCacheKey(dir), pkgData);
|
|
100
|
-
}), pkgData;
|
|
101
|
-
}
|
|
102
|
-
function setCacheData(cache, data, basedir, originalBasedir) {
|
|
103
|
-
cache.set(getFnpdCacheKey(basedir), data), traverseBetweenDirs(originalBasedir, basedir, (dir) => {
|
|
104
|
-
cache.set(getFnpdCacheKey(dir), data);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function getFnpdCacheKey(basedir) {
|
|
108
|
-
return `fnpd_${basedir}`;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Traverse between `longerDir` (inclusive) and `shorterDir` (exclusive) and call `cb` for each dir.
|
|
112
|
-
* @param longerDir Longer dir path, e.g. `/User/foo/bar/baz`
|
|
113
|
-
* @param shorterDir Shorter dir path, e.g. `/User/foo`
|
|
114
|
-
*/
|
|
115
|
-
function traverseBetweenDirs(longerDir, shorterDir, cb) {
|
|
116
|
-
while (longerDir !== shorterDir) cb(longerDir), longerDir = dirname(longerDir);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export { findNearestPackageData as f };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { parseRegexp } from '@vitest/utils';
|
|
2
|
-
|
|
3
|
-
const REGEXP_WRAP_PREFIX = "$$vitest:", processSend = process.send?.bind(process), processOn = process.on?.bind(process), processOff = process.off?.bind(process), dispose = [];
|
|
4
|
-
function createThreadsRpcOptions({ port }) {
|
|
5
|
-
return {
|
|
6
|
-
post: (v) => {
|
|
7
|
-
port.postMessage(v);
|
|
8
|
-
},
|
|
9
|
-
on: (fn) => {
|
|
10
|
-
port.addListener("message", fn);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function disposeInternalListeners() {
|
|
15
|
-
for (const fn of dispose) try {
|
|
16
|
-
fn();
|
|
17
|
-
} catch {}
|
|
18
|
-
dispose.length = 0;
|
|
19
|
-
}
|
|
20
|
-
function createForksRpcOptions(nodeV8) {
|
|
21
|
-
return {
|
|
22
|
-
serialize: nodeV8.serialize,
|
|
23
|
-
deserialize: (v) => nodeV8.deserialize(Buffer.from(v)),
|
|
24
|
-
post(v) {
|
|
25
|
-
processSend(v);
|
|
26
|
-
},
|
|
27
|
-
on(fn) {
|
|
28
|
-
const handler = (message, ...extras) => {
|
|
29
|
-
if (!message?.__tinypool_worker_message__) return fn(message, ...extras);
|
|
30
|
-
};
|
|
31
|
-
processOn("message", handler), dispose.push(() => processOff("message", handler));
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Reverts the wrapping done by `utils/config-helpers.ts`'s `wrapSerializableConfig`
|
|
37
|
-
*/
|
|
38
|
-
function unwrapSerializableConfig(config) {
|
|
39
|
-
if (config.testNamePattern && typeof config.testNamePattern === "string") {
|
|
40
|
-
const testNamePattern = config.testNamePattern;
|
|
41
|
-
if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX)) config.testNamePattern = parseRegexp(testNamePattern.slice(9));
|
|
42
|
-
}
|
|
43
|
-
if (config.defines && Array.isArray(config.defines.keys) && config.defines.original) {
|
|
44
|
-
const { keys, original } = config.defines, defines = {};
|
|
45
|
-
// Apply all keys from the original. Entries which had undefined value are missing from original now
|
|
46
|
-
for (const key of keys) defines[key] = original[key];
|
|
47
|
-
config.defines = defines;
|
|
48
|
-
}
|
|
49
|
-
return config;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { createThreadsRpcOptions as a, createForksRpcOptions as c, disposeInternalListeners as d, unwrapSerializableConfig as u };
|
package/dist/workers/forks.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import v8 from 'node:v8';
|
|
2
|
-
import { r as runBaseTests } from '../chunks/base.Cjha6usc.js';
|
|
3
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.C2YI6McM.js';
|
|
4
|
-
import 'node:vm';
|
|
5
|
-
import '@vitest/spy';
|
|
6
|
-
import 'vite/module-runner';
|
|
7
|
-
import '../chunks/startModuleRunner.p67gbNo9.js';
|
|
8
|
-
import 'node:fs';
|
|
9
|
-
import 'node:module';
|
|
10
|
-
import '@vitest/utils';
|
|
11
|
-
import 'node:url';
|
|
12
|
-
import 'pathe';
|
|
13
|
-
import '../path.js';
|
|
14
|
-
import 'node:path';
|
|
15
|
-
import '@vitest/utils/error';
|
|
16
|
-
import '../module-evaluator.js';
|
|
17
|
-
import '@vitest/mocker';
|
|
18
|
-
import '../chunks/moduleTransport.I-bgQy0S.js';
|
|
19
|
-
import 'node:perf_hooks';
|
|
20
|
-
import '@vitest/runner';
|
|
21
|
-
import '../chunks/resolveSnapshotEnvironment.Bkht6Yor.js';
|
|
22
|
-
import '@vitest/expect';
|
|
23
|
-
import '../chunks/setup-common.uiMcU3cv.js';
|
|
24
|
-
import '../chunks/coverage.D_JHT54q.js';
|
|
25
|
-
import '@vitest/snapshot';
|
|
26
|
-
import '../chunks/utils.D2R2NiOH.js';
|
|
27
|
-
import '../chunks/rpc.BKr6mtxz.js';
|
|
28
|
-
import '../chunks/index.Bgo3tNWt.js';
|
|
29
|
-
import '../chunks/test.BiqSKISg.js';
|
|
30
|
-
import '../chunks/benchmark.CJUa-Hsa.js';
|
|
31
|
-
import '@vitest/runner/utils';
|
|
32
|
-
import '../chunks/vi.ZPgvtBao.js';
|
|
33
|
-
import '../chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
34
|
-
import '@vitest/utils/source-map';
|
|
35
|
-
import '../chunks/date.-jtEtIeV.js';
|
|
36
|
-
import '../chunks/inspector.CvQD-Nie.js';
|
|
37
|
-
import 'node:timers';
|
|
38
|
-
import 'node:timers/promises';
|
|
39
|
-
import 'node:util';
|
|
40
|
-
import '../chunks/index.CMfqw92x.js';
|
|
41
|
-
import 'expect-type';
|
|
42
|
-
|
|
43
|
-
class ForksBaseWorker {
|
|
44
|
-
getRpcOptions() {
|
|
45
|
-
return createForksRpcOptions(v8);
|
|
46
|
-
}
|
|
47
|
-
async executeTests(method, state) {
|
|
48
|
-
// TODO: don't rely on reassigning process.exit
|
|
49
|
-
// https://github.com/vitest-dev/vitest/pull/4441#discussion_r1443771486
|
|
50
|
-
const exit = process.exit;
|
|
51
|
-
state.ctx.config = unwrapSerializableConfig(state.ctx.config);
|
|
52
|
-
try {
|
|
53
|
-
await runBaseTests(method, state);
|
|
54
|
-
} finally {
|
|
55
|
-
process.exit = exit;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
runTests(state) {
|
|
59
|
-
return this.executeTests("run", state);
|
|
60
|
-
}
|
|
61
|
-
collectTests(state) {
|
|
62
|
-
return this.executeTests("collect", state);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const worker = new ForksBaseWorker();
|
|
66
|
-
|
|
67
|
-
export { worker as default };
|
package/dist/workers/threads.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../chunks/base.Cjha6usc.js';
|
|
2
|
-
import { a as createThreadsRpcOptions } from '../chunks/utils.C2YI6McM.js';
|
|
3
|
-
import 'node:vm';
|
|
4
|
-
import '@vitest/spy';
|
|
5
|
-
import 'vite/module-runner';
|
|
6
|
-
import '../chunks/startModuleRunner.p67gbNo9.js';
|
|
7
|
-
import 'node:fs';
|
|
8
|
-
import 'node:module';
|
|
9
|
-
import '@vitest/utils';
|
|
10
|
-
import 'node:url';
|
|
11
|
-
import 'pathe';
|
|
12
|
-
import '../path.js';
|
|
13
|
-
import 'node:path';
|
|
14
|
-
import '@vitest/utils/error';
|
|
15
|
-
import '../module-evaluator.js';
|
|
16
|
-
import '@vitest/mocker';
|
|
17
|
-
import '../chunks/moduleTransport.I-bgQy0S.js';
|
|
18
|
-
import 'node:perf_hooks';
|
|
19
|
-
import '@vitest/runner';
|
|
20
|
-
import '../chunks/resolveSnapshotEnvironment.Bkht6Yor.js';
|
|
21
|
-
import '@vitest/expect';
|
|
22
|
-
import '../chunks/setup-common.uiMcU3cv.js';
|
|
23
|
-
import '../chunks/coverage.D_JHT54q.js';
|
|
24
|
-
import '@vitest/snapshot';
|
|
25
|
-
import '../chunks/utils.D2R2NiOH.js';
|
|
26
|
-
import '../chunks/rpc.BKr6mtxz.js';
|
|
27
|
-
import '../chunks/index.Bgo3tNWt.js';
|
|
28
|
-
import '../chunks/test.BiqSKISg.js';
|
|
29
|
-
import '../chunks/benchmark.CJUa-Hsa.js';
|
|
30
|
-
import '@vitest/runner/utils';
|
|
31
|
-
import '../chunks/vi.ZPgvtBao.js';
|
|
32
|
-
import '../chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
33
|
-
import '@vitest/utils/source-map';
|
|
34
|
-
import '../chunks/date.-jtEtIeV.js';
|
|
35
|
-
import '../chunks/inspector.CvQD-Nie.js';
|
|
36
|
-
import 'node:timers';
|
|
37
|
-
import 'node:timers/promises';
|
|
38
|
-
import 'node:util';
|
|
39
|
-
import '../chunks/index.CMfqw92x.js';
|
|
40
|
-
import 'expect-type';
|
|
41
|
-
|
|
42
|
-
class ThreadsBaseWorker {
|
|
43
|
-
getRpcOptions(ctx) {
|
|
44
|
-
return createThreadsRpcOptions(ctx);
|
|
45
|
-
}
|
|
46
|
-
runTests(state) {
|
|
47
|
-
return runBaseTests("run", state);
|
|
48
|
-
}
|
|
49
|
-
collectTests(state) {
|
|
50
|
-
return runBaseTests("collect", state);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const worker = new ThreadsBaseWorker();
|
|
54
|
-
|
|
55
|
-
export { worker as default };
|
package/dist/workers/vmForks.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import v8 from 'node:v8';
|
|
2
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.C2YI6McM.js';
|
|
3
|
-
import { r as runVmTests } from '../chunks/vm.Ca0Y0W5f.js';
|
|
4
|
-
import '@vitest/utils';
|
|
5
|
-
import 'node:url';
|
|
6
|
-
import 'node:vm';
|
|
7
|
-
import 'pathe';
|
|
8
|
-
import '../path.js';
|
|
9
|
-
import 'node:path';
|
|
10
|
-
import '../chunks/console.7h5kHUIf.js';
|
|
11
|
-
import 'node:console';
|
|
12
|
-
import 'node:stream';
|
|
13
|
-
import 'tinyrainbow';
|
|
14
|
-
import '../chunks/date.-jtEtIeV.js';
|
|
15
|
-
import '../chunks/utils.D2R2NiOH.js';
|
|
16
|
-
import 'node:fs';
|
|
17
|
-
import 'node:module';
|
|
18
|
-
import '../chunks/resolver.Bx6lE0iq.js';
|
|
19
|
-
import '../module-evaluator.js';
|
|
20
|
-
import 'vite/module-runner';
|
|
21
|
-
import '../chunks/startModuleRunner.p67gbNo9.js';
|
|
22
|
-
import '@vitest/utils/error';
|
|
23
|
-
import '@vitest/mocker';
|
|
24
|
-
import '../chunks/moduleTransport.I-bgQy0S.js';
|
|
25
|
-
|
|
26
|
-
class ForksVmWorker {
|
|
27
|
-
getRpcOptions() {
|
|
28
|
-
return createForksRpcOptions(v8);
|
|
29
|
-
}
|
|
30
|
-
async executeTests(method, state) {
|
|
31
|
-
const exit = process.exit;
|
|
32
|
-
state.ctx.config = unwrapSerializableConfig(state.ctx.config);
|
|
33
|
-
try {
|
|
34
|
-
await runVmTests(method, state);
|
|
35
|
-
} finally {
|
|
36
|
-
process.exit = exit;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
runTests(state) {
|
|
40
|
-
return this.executeTests("run", state);
|
|
41
|
-
}
|
|
42
|
-
collectTests(state) {
|
|
43
|
-
return this.executeTests("collect", state);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const worker = new ForksVmWorker();
|
|
47
|
-
|
|
48
|
-
export { worker as default };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { a as createThreadsRpcOptions } from '../chunks/utils.C2YI6McM.js';
|
|
2
|
-
import { r as runVmTests } from '../chunks/vm.Ca0Y0W5f.js';
|
|
3
|
-
import '@vitest/utils';
|
|
4
|
-
import 'node:url';
|
|
5
|
-
import 'node:vm';
|
|
6
|
-
import 'pathe';
|
|
7
|
-
import '../path.js';
|
|
8
|
-
import 'node:path';
|
|
9
|
-
import '../chunks/console.7h5kHUIf.js';
|
|
10
|
-
import 'node:console';
|
|
11
|
-
import 'node:stream';
|
|
12
|
-
import 'tinyrainbow';
|
|
13
|
-
import '../chunks/date.-jtEtIeV.js';
|
|
14
|
-
import '../chunks/utils.D2R2NiOH.js';
|
|
15
|
-
import 'node:fs';
|
|
16
|
-
import 'node:module';
|
|
17
|
-
import '../chunks/resolver.Bx6lE0iq.js';
|
|
18
|
-
import '../module-evaluator.js';
|
|
19
|
-
import 'vite/module-runner';
|
|
20
|
-
import '../chunks/startModuleRunner.p67gbNo9.js';
|
|
21
|
-
import '@vitest/utils/error';
|
|
22
|
-
import '@vitest/mocker';
|
|
23
|
-
import '../chunks/moduleTransport.I-bgQy0S.js';
|
|
24
|
-
|
|
25
|
-
class ThreadsVmWorker {
|
|
26
|
-
getRpcOptions(ctx) {
|
|
27
|
-
return createThreadsRpcOptions(ctx);
|
|
28
|
-
}
|
|
29
|
-
runTests(state) {
|
|
30
|
-
return runVmTests("run", state);
|
|
31
|
-
}
|
|
32
|
-
collectTests(state) {
|
|
33
|
-
return runVmTests("collect", state);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const worker = new ThreadsVmWorker();
|
|
37
|
-
|
|
38
|
-
export { worker as default };
|
package/dist/workers.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { W as WorkerGlobalState, C as ContextRPC, B as BirpcOptions, R as RuntimeRPC } from './chunks/worker.d.BDsXGkwh.js';
|
|
2
|
-
import { Awaitable } from '@vitest/utils';
|
|
3
|
-
import * as v8 from 'v8';
|
|
4
|
-
import { a as SerializedConfig } from './chunks/config.d.B_LthbQq.js';
|
|
5
|
-
import { W as WorkerContext } from './chunks/worker.d.BNcX_2mH.js';
|
|
6
|
-
import '@vitest/runner';
|
|
7
|
-
import 'vite/module-runner';
|
|
8
|
-
import './chunks/environment.d.BsToaxti.js';
|
|
9
|
-
import '@vitest/snapshot';
|
|
10
|
-
import '@vitest/pretty-format';
|
|
11
|
-
import '@vitest/utils/diff';
|
|
12
|
-
import 'node:worker_threads';
|
|
13
|
-
|
|
14
|
-
declare function provideWorkerState(context: any, state: WorkerGlobalState): WorkerGlobalState;
|
|
15
|
-
|
|
16
|
-
declare function run(ctx: ContextRPC): Promise<void>;
|
|
17
|
-
declare function collect(ctx: ContextRPC): Promise<void>;
|
|
18
|
-
|
|
19
|
-
declare function runBaseTests(method: "run" | "collect", state: WorkerGlobalState): Promise<void>;
|
|
20
|
-
|
|
21
|
-
type WorkerRpcOptions = Pick<BirpcOptions<RuntimeRPC>, "on" | "post" | "serialize" | "deserialize">;
|
|
22
|
-
interface VitestWorker {
|
|
23
|
-
getRpcOptions: (ctx: ContextRPC) => WorkerRpcOptions;
|
|
24
|
-
runTests: (state: WorkerGlobalState) => Awaitable<unknown>;
|
|
25
|
-
collectTests: (state: WorkerGlobalState) => Awaitable<unknown>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare function createThreadsRpcOptions({ port }: WorkerContext): WorkerRpcOptions;
|
|
29
|
-
declare function createForksRpcOptions(nodeV8: typeof v8): WorkerRpcOptions;
|
|
30
|
-
/**
|
|
31
|
-
* Reverts the wrapping done by `utils/config-helpers.ts`'s `wrapSerializableConfig`
|
|
32
|
-
*/
|
|
33
|
-
declare function unwrapSerializableConfig(config: SerializedConfig): SerializedConfig;
|
|
34
|
-
|
|
35
|
-
declare function runVmTests(method: "run" | "collect", state: WorkerGlobalState): Promise<void>;
|
|
36
|
-
|
|
37
|
-
export { collect as collectVitestWorkerTests, createForksRpcOptions, createThreadsRpcOptions, provideWorkerState, runBaseTests, run as runVitestWorker, runVmTests, unwrapSerializableConfig };
|
|
38
|
-
export type { VitestWorker, WorkerRpcOptions };
|
package/dist/workers.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export { p as provideWorkerState } from './chunks/utils.D2R2NiOH.js';
|
|
2
|
-
export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
|
|
3
|
-
export { r as runBaseTests } from './chunks/base.Cjha6usc.js';
|
|
4
|
-
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './chunks/utils.C2YI6McM.js';
|
|
5
|
-
export { r as runVmTests } from './chunks/vm.Ca0Y0W5f.js';
|
|
6
|
-
import '@vitest/utils';
|
|
7
|
-
import 'node:url';
|
|
8
|
-
import '@vitest/utils/source-map';
|
|
9
|
-
import 'vite/module-runner';
|
|
10
|
-
import 'node:fs';
|
|
11
|
-
import 'node:module';
|
|
12
|
-
import 'pathe';
|
|
13
|
-
import './chunks/moduleTransport.I-bgQy0S.js';
|
|
14
|
-
import './chunks/index.DIWhzsUh.js';
|
|
15
|
-
import 'node:console';
|
|
16
|
-
import './chunks/inspector.CvQD-Nie.js';
|
|
17
|
-
import './chunks/rpc.BKr6mtxz.js';
|
|
18
|
-
import './chunks/index.Bgo3tNWt.js';
|
|
19
|
-
import 'node:vm';
|
|
20
|
-
import '@vitest/spy';
|
|
21
|
-
import './chunks/startModuleRunner.p67gbNo9.js';
|
|
22
|
-
import './path.js';
|
|
23
|
-
import 'node:path';
|
|
24
|
-
import '@vitest/utils/error';
|
|
25
|
-
import './module-evaluator.js';
|
|
26
|
-
import '@vitest/mocker';
|
|
27
|
-
import 'node:perf_hooks';
|
|
28
|
-
import '@vitest/runner';
|
|
29
|
-
import './chunks/resolveSnapshotEnvironment.Bkht6Yor.js';
|
|
30
|
-
import '@vitest/expect';
|
|
31
|
-
import './chunks/setup-common.uiMcU3cv.js';
|
|
32
|
-
import './chunks/coverage.D_JHT54q.js';
|
|
33
|
-
import '@vitest/snapshot';
|
|
34
|
-
import './chunks/test.BiqSKISg.js';
|
|
35
|
-
import './chunks/benchmark.CJUa-Hsa.js';
|
|
36
|
-
import '@vitest/runner/utils';
|
|
37
|
-
import './chunks/vi.ZPgvtBao.js';
|
|
38
|
-
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
39
|
-
import './chunks/date.-jtEtIeV.js';
|
|
40
|
-
import 'node:timers';
|
|
41
|
-
import 'node:timers/promises';
|
|
42
|
-
import 'node:util';
|
|
43
|
-
import './chunks/index.CMfqw92x.js';
|
|
44
|
-
import 'expect-type';
|
|
45
|
-
import './chunks/console.7h5kHUIf.js';
|
|
46
|
-
import 'node:stream';
|
|
47
|
-
import 'tinyrainbow';
|
|
48
|
-
import './chunks/resolver.Bx6lE0iq.js';
|
package/execute.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/execute.js'
|
package/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/utils.js'
|
package/workers.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/workers.js'
|