vitest 4.0.0-beta.9 → 4.0.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/LICENSE.md +86 -102
- package/browser/context.d.ts +7 -0
- package/browser/context.js +20 -0
- package/dist/browser.d.ts +24 -7
- package/dist/browser.js +15 -5
- package/dist/chunks/{base.CA5N8Af0.js → base.BYPMk0VN.js} +36 -36
- package/dist/chunks/{benchmark.CJUa-Hsa.js → benchmark.DHKMYAts.js} +2 -2
- package/dist/chunks/{browser.d.DtfyY9yS.d.ts → browser.d.B9iJzZyn.d.ts} +3 -3
- package/dist/chunks/{cac.Dt7e1TIu.js → cac.DrF4Gm0S.js} +47 -73
- package/dist/chunks/{cli-api.eAzsLIxz.js → cli-api.W2Q-JQoO.js} +1524 -296
- package/dist/chunks/{config.d.DacWrqWe.d.ts → config.d.u2CUDWwS.d.ts} +5 -19
- package/dist/chunks/{console.7h5kHUIf.js → console.CTJL2nuH.js} +4 -6
- package/dist/chunks/{coverage.CDRAMTt7.js → coverage.FU3w4IrQ.js} +125 -1108
- package/dist/chunks/{creator.KEg6n5IC.js → creator.DucAaYBz.js} +10 -37
- package/dist/chunks/{defaults.CXFFjsi8.js → defaults.BOqNVLsY.js} +0 -1
- package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
- package/dist/chunks/{global.d.K6uBQHzY.d.ts → global.d.BgJSTpgQ.d.ts} +2 -17
- package/dist/chunks/{globals.CJrTTbxC.js → globals.BGT_RUsD.js} +11 -7
- package/dist/chunks/{index.BjKEiSn0.js → index.BdSLhLDZ.js} +3 -3
- package/dist/chunks/{index.DfviD7lX.js → index.CbWINfS7.js} +49 -21
- package/dist/chunks/{index.BIP7prJq.js → index.CcRZ6fUh.js} +1493 -114
- package/dist/chunks/{index.X0nbfr6-.js → index.Dc3xnDvT.js} +48 -289
- package/dist/chunks/{index.C832ioot.js → index.RwjEGCQ0.js} +4 -4
- package/dist/chunks/init-forks.WglB-sfY.js +54 -0
- package/dist/chunks/init-threads.Czek6eA5.js +17 -0
- package/dist/chunks/init.94FWN9pW.js +213 -0
- package/dist/chunks/{inspector.CvQD-Nie.js → inspector.DLZxSeU3.js} +2 -6
- package/dist/chunks/{moduleRunner.d.DxTLreRD.d.ts → moduleRunner.d.YtNsMIoJ.d.ts} +9 -14
- package/dist/chunks/{node.CyipiPvJ.js → node.BwAWWjHZ.js} +3 -4
- package/dist/chunks/{plugin.d.CIk0YiKb.d.ts → plugin.d.DQU1R5px.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DmP-iHLr.d.ts → reporters.d.BMKt7f6I.d.ts} +1064 -1021
- package/dist/chunks/{resolveSnapshotEnvironment.Bvv2zr69.js → resolveSnapshotEnvironment.DJJKMKxb.js} +7 -8
- package/dist/chunks/{rpc.BKr6mtxz.js → rpc.cD77ENhU.js} +13 -14
- package/dist/chunks/{setup-common.B7I37Tji.js → setup-common.DR1sucx6.js} +6 -6
- package/dist/chunks/{startModuleRunner.BDRvKSdz.js → startModuleRunner.iF1E9Bt4.js} +126 -110
- package/dist/chunks/{test.BAlBebnP.js → test.C3RPt8JR.js} +7 -7
- package/dist/chunks/{utils.D2R2NiOH.js → utils.CG9h5ccR.js} +2 -5
- package/dist/chunks/{vi.BB37KeLx.js → vi.BZvkKVkM.js} +61 -164
- package/dist/chunks/{vm.CjLTDaST.js → vm.CuMWYx_F.js} +20 -29
- package/dist/chunks/{worker.d.B2r4Ln6p.d.ts → worker.d.BFk-vvBU.d.ts} +42 -6
- package/dist/cli.js +12 -11
- package/dist/config.cjs +0 -1
- package/dist/config.d.ts +11 -13
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +7 -6
- package/dist/coverage.js +3 -14
- package/dist/environments.d.ts +3 -6
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +20 -25
- package/dist/index.js +11 -7
- package/dist/module-evaluator.d.ts +5 -4
- package/dist/module-evaluator.js +11 -13
- package/dist/module-runner.js +5 -5
- package/dist/node.d.ts +82 -25
- package/dist/node.js +23 -20
- package/dist/reporters.d.ts +10 -9
- package/dist/reporters.js +12 -11
- 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/worker.d.ts +26 -0
- package/dist/worker.js +45 -165
- package/dist/workers/forks.js +26 -43
- package/dist/workers/runVmTests.js +16 -12
- package/dist/workers/threads.js +26 -31
- package/dist/workers/vmForks.js +26 -39
- package/dist/workers/vmThreads.js +26 -29
- package/package.json +48 -32
- package/worker.d.ts +1 -0
- package/browser.d.ts +0 -1
- package/dist/chunks/environment.d.2fYMoz3o.d.ts +0 -66
- package/dist/chunks/moduleTransport.I-bgQy0S.js +0 -19
- package/dist/chunks/resolver.Bx6lE0iq.js +0 -119
- package/dist/chunks/typechecker.DB-fIMaH.js +0 -805
- package/dist/chunks/utils.C2YI6McM.js +0 -52
- package/dist/chunks/worker.d.DJ6qxO2w.d.ts +0 -8
- package/dist/workers.d.ts +0 -38
- package/dist/workers.js +0 -49
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
|
@@ -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.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.B2r4Ln6p.js';
|
|
2
|
-
import { Awaitable } from '@vitest/utils';
|
|
3
|
-
import * as v8 from 'v8';
|
|
4
|
-
import { a as SerializedConfig } from './chunks/config.d.DacWrqWe.js';
|
|
5
|
-
import { W as WorkerContext } from './chunks/worker.d.DJ6qxO2w.js';
|
|
6
|
-
import '@vitest/runner';
|
|
7
|
-
import 'vite/module-runner';
|
|
8
|
-
import './chunks/environment.d.2fYMoz3o.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,49 +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.CA5N8Af0.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.CjLTDaST.js';
|
|
6
|
-
import '@vitest/utils';
|
|
7
|
-
import 'node:url';
|
|
8
|
-
import '@vitest/utils/source-map';
|
|
9
|
-
import 'tinypool';
|
|
10
|
-
import 'vite/module-runner';
|
|
11
|
-
import 'node:fs';
|
|
12
|
-
import 'node:module';
|
|
13
|
-
import 'pathe';
|
|
14
|
-
import './chunks/moduleTransport.I-bgQy0S.js';
|
|
15
|
-
import './chunks/index.DfviD7lX.js';
|
|
16
|
-
import 'node:console';
|
|
17
|
-
import './chunks/inspector.CvQD-Nie.js';
|
|
18
|
-
import './chunks/rpc.BKr6mtxz.js';
|
|
19
|
-
import './chunks/index.Bgo3tNWt.js';
|
|
20
|
-
import 'node:vm';
|
|
21
|
-
import '@vitest/spy';
|
|
22
|
-
import './chunks/startModuleRunner.BDRvKSdz.js';
|
|
23
|
-
import './path.js';
|
|
24
|
-
import 'node:path';
|
|
25
|
-
import '@vitest/utils/error';
|
|
26
|
-
import './module-evaluator.js';
|
|
27
|
-
import '@vitest/mocker';
|
|
28
|
-
import 'node:perf_hooks';
|
|
29
|
-
import '@vitest/runner';
|
|
30
|
-
import './chunks/resolveSnapshotEnvironment.Bvv2zr69.js';
|
|
31
|
-
import '@vitest/expect';
|
|
32
|
-
import './chunks/setup-common.B7I37Tji.js';
|
|
33
|
-
import './chunks/coverage.D_JHT54q.js';
|
|
34
|
-
import '@vitest/snapshot';
|
|
35
|
-
import './chunks/test.BAlBebnP.js';
|
|
36
|
-
import './chunks/benchmark.CJUa-Hsa.js';
|
|
37
|
-
import '@vitest/runner/utils';
|
|
38
|
-
import './chunks/vi.BB37KeLx.js';
|
|
39
|
-
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
40
|
-
import './chunks/date.-jtEtIeV.js';
|
|
41
|
-
import 'node:timers';
|
|
42
|
-
import 'node:timers/promises';
|
|
43
|
-
import 'node:util';
|
|
44
|
-
import './chunks/index.C832ioot.js';
|
|
45
|
-
import 'expect-type';
|
|
46
|
-
import './chunks/console.7h5kHUIf.js';
|
|
47
|
-
import 'node:stream';
|
|
48
|
-
import 'tinyrainbow';
|
|
49
|
-
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'
|