vitest 4.0.7 → 4.0.9
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 +1 -1
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +2 -2
- package/dist/chunks/{base.D3GxgUMI.js → base.CiIV2DDC.js} +71 -36
- package/dist/chunks/{benchmark.DHKMYAts.js → benchmark.B3N2zMcH.js} +9 -4
- package/dist/chunks/{browser.d.-LKfRopd.d.ts → browser.d.DnU_kh8a.d.ts} +1 -1
- package/dist/chunks/{cac.G9DAn-c7.js → cac.B_NTJoIH.js} +115 -42
- package/dist/chunks/{cli-api.Csks4as1.js → cli-api.D48wY175.js} +1863 -845
- package/dist/chunks/console.Cf-YriPC.js +146 -0
- package/dist/chunks/{coverage.C2LA1DSL.js → coverage.BUlIqJrL.js} +284 -114
- package/dist/chunks/{creator.cqqifzG7.js → creator.BzqvXeRE.js} +75 -31
- package/dist/chunks/{date.-jtEtIeV.js → date.Bq6ZW5rf.js} +17 -6
- package/dist/chunks/{git.BFNcloKD.js → git.Bm2pzPAa.js} +3 -3
- package/dist/chunks/{global.d.DxtanrNO.d.ts → global.d.BQDgW9Pr.d.ts} +1 -1
- package/dist/chunks/{globals.BGT_RUsD.js → globals.DBrtKPdh.js} +5 -5
- package/dist/chunks/index.0kCJoeWi.js +220 -0
- package/dist/chunks/{index.CWIFvlX5.js → index.BfmpdV5p.js} +165 -54
- package/dist/chunks/{index.RwjEGCQ0.js → index.CGezRSGU.js} +2 -2
- package/dist/chunks/{index.DEPqWSIZ.js → index.CPA8jGhR.js} +33 -16
- package/dist/chunks/{index.CVpyv-Zg.js → index.kotH7DY7.js} +832 -373
- package/dist/chunks/{index.jMQYiEWE.js → index.op2Re5rn.js} +22 -12
- package/dist/chunks/{index.Dc3xnDvT.js → index.z7NPOg2E.js} +4 -4
- package/dist/chunks/{init-forks.IU-xQ2_X.js → init-forks.aqTzCSR2.js} +14 -4
- package/dist/chunks/{init-threads.C_NWvZkU.js → init-threads.C7T0-YMD.js} +1 -1
- package/dist/chunks/{init.fmH9J833.js → init.BQhNfT0h.js} +53 -30
- package/dist/chunks/{inspector.DLZxSeU3.js → inspector.CvyFGlXm.js} +25 -10
- package/dist/chunks/{moduleRunner.d.DEkTotCv.d.ts → moduleRunner.d.BxT-OjLR.d.ts} +1 -1
- package/dist/chunks/{node.BwAWWjHZ.js → node.Ce0vMQM7.js} +1 -1
- package/dist/chunks/{plugin.d.Cpes8Bt6.d.ts → plugin.d.DevON6kQ.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CSNcMDxF.d.ts → reporters.d.BQ0wpUaj.d.ts} +6 -5
- package/dist/chunks/{rpc.D38ahn14.js → rpc.BytlcPfC.js} +20 -7
- package/dist/chunks/{setup-common.DR1sucx6.js → setup-common.Dw1XgX0v.js} +20 -8
- package/dist/chunks/{startModuleRunner.Cn7hCL7D.js → startModuleRunner.DLjmA_wU.js} +209 -86
- package/dist/chunks/{test.B6aJd6T3.js → test.w5HLbjmU.js} +48 -22
- package/dist/chunks/{utils.CG9h5ccR.js → utils.DvEY5TfP.js} +14 -5
- package/dist/chunks/{vi.BZvkKVkM.js → vi.CyIUVSoU.js} +267 -117
- package/dist/chunks/{vm.BL7_zzOr.js → vm.DXN8eCh2.js} +181 -75
- package/dist/chunks/{worker.d.D25zYZ7N.d.ts → worker.d.ZGohxCEd.d.ts} +74 -7
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +5 -5
- package/dist/coverage.d.ts +3 -3
- package/dist/coverage.js +1 -1
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/module-evaluator.d.ts +2 -2
- package/dist/module-evaluator.js +88 -38
- package/dist/module-runner.js +2 -2
- package/dist/node.d.ts +7 -7
- package/dist/node.js +17 -13
- package/dist/reporters.d.ts +3 -3
- package/dist/reporters.js +2 -2
- package/dist/runners.js +7 -7
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +15 -15
- package/dist/workers/forks.js +16 -16
- package/dist/workers/runVmTests.js +41 -22
- package/dist/workers/threads.js +16 -16
- package/dist/workers/vmForks.js +11 -11
- package/dist/workers/vmThreads.js +11 -11
- package/package.json +20 -20
- package/dist/chunks/console.CTJL2nuH.js +0 -115
- package/dist/chunks/index.Bgo3tNWt.js +0 -176
|
@@ -43,7 +43,8 @@ type LabelColor = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "c
|
|
|
43
43
|
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
44
44
|
type ReturnType<T> = T extends (...args: any) => infer R ? R : never;
|
|
45
45
|
type PromisifyFn<T> = ReturnType<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
46
|
-
type
|
|
46
|
+
type Thenable<T> = T | PromiseLike<T>;
|
|
47
|
+
type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => Thenable<((...args: unknown[]) => unknown) | undefined>;
|
|
47
48
|
interface ChannelOptions {
|
|
48
49
|
/**
|
|
49
50
|
* Function to post raw message
|
|
@@ -91,6 +92,14 @@ interface EventOptions<Remote> {
|
|
|
91
92
|
* For advanced use cases only
|
|
92
93
|
*/
|
|
93
94
|
resolver?: BirpcResolver;
|
|
95
|
+
/**
|
|
96
|
+
* Hook triggered before an event is sent to the remote
|
|
97
|
+
*
|
|
98
|
+
* @param req - Request parameters
|
|
99
|
+
* @param next - Function to continue the request
|
|
100
|
+
* @param resolve - Function to resolve the response directly
|
|
101
|
+
*/
|
|
102
|
+
onRequest?: (req: Request, next: (req?: Request) => Promise<any>, resolve: (res: any) => void) => void | Promise<void>;
|
|
94
103
|
/**
|
|
95
104
|
* Custom error handler
|
|
96
105
|
*
|
|
@@ -121,16 +130,51 @@ type BirpcFn<T> = PromisifyFn<T> & {
|
|
|
121
130
|
/**
|
|
122
131
|
* Send event without asking for response
|
|
123
132
|
*/
|
|
124
|
-
asEvent: (...args: ArgumentsType<T>) => void
|
|
133
|
+
asEvent: (...args: ArgumentsType<T>) => Promise<void>;
|
|
125
134
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
interface BirpcReturnBuiltin<RemoteFunctions, LocalFunctions = Record<string, never>> {
|
|
136
|
+
/**
|
|
137
|
+
* Raw functions object
|
|
138
|
+
*/
|
|
129
139
|
$functions: LocalFunctions;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the RPC is closed
|
|
142
|
+
*/
|
|
143
|
+
readonly $closed: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Close the RPC connection
|
|
146
|
+
*/
|
|
130
147
|
$close: (error?: Error) => void;
|
|
131
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Reject pending calls
|
|
150
|
+
*/
|
|
132
151
|
$rejectPendingCalls: (handler?: PendingCallHandler) => Promise<void>[];
|
|
133
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Call the remote function and wait for the result.
|
|
154
|
+
* An alternative to directly calling the function
|
|
155
|
+
*/
|
|
156
|
+
$call: <K extends keyof RemoteFunctions>(method: K, ...args: ArgumentsType<RemoteFunctions[K]>) => Promise<Awaited<ReturnType<RemoteFunctions[K]>>>;
|
|
157
|
+
/**
|
|
158
|
+
* Same as `$call`, but returns `undefined` if the function is not defined on the remote side.
|
|
159
|
+
*/
|
|
160
|
+
$callOptional: <K extends keyof RemoteFunctions>(method: K, ...args: ArgumentsType<RemoteFunctions[K]>) => Promise<Awaited<ReturnType<RemoteFunctions[K]> | undefined>>;
|
|
161
|
+
/**
|
|
162
|
+
* Send event without asking for response
|
|
163
|
+
*/
|
|
164
|
+
$callEvent: <K extends keyof RemoteFunctions>(method: K, ...args: ArgumentsType<RemoteFunctions[K]>) => Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Call the remote function with the raw options.
|
|
167
|
+
*/
|
|
168
|
+
$callRaw: (options: {
|
|
169
|
+
method: string;
|
|
170
|
+
args: unknown[];
|
|
171
|
+
event?: boolean;
|
|
172
|
+
optional?: boolean;
|
|
173
|
+
}) => Promise<Awaited<ReturnType<any>>[]>;
|
|
174
|
+
}
|
|
175
|
+
type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
176
|
+
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
177
|
+
} & BirpcReturnBuiltin<RemoteFunctions, LocalFunctions>;
|
|
134
178
|
type PendingCallHandler = (options: Pick<PromiseEntry, 'method' | 'reject'>) => void | Promise<void>;
|
|
135
179
|
interface PromiseEntry {
|
|
136
180
|
resolve: (arg: any) => void;
|
|
@@ -138,6 +182,29 @@ interface PromiseEntry {
|
|
|
138
182
|
method: string;
|
|
139
183
|
timeoutId?: ReturnType<typeof setTimeout>;
|
|
140
184
|
}
|
|
185
|
+
declare const TYPE_REQUEST: "q";
|
|
186
|
+
interface Request {
|
|
187
|
+
/**
|
|
188
|
+
* Type
|
|
189
|
+
*/
|
|
190
|
+
t: typeof TYPE_REQUEST;
|
|
191
|
+
/**
|
|
192
|
+
* ID
|
|
193
|
+
*/
|
|
194
|
+
i?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Method
|
|
197
|
+
*/
|
|
198
|
+
m: string;
|
|
199
|
+
/**
|
|
200
|
+
* Arguments
|
|
201
|
+
*/
|
|
202
|
+
a: any[];
|
|
203
|
+
/**
|
|
204
|
+
* Optional
|
|
205
|
+
*/
|
|
206
|
+
o?: boolean;
|
|
207
|
+
}
|
|
141
208
|
declare const setTimeout: typeof globalThis.setTimeout;
|
|
142
209
|
|
|
143
210
|
interface RuntimeRPC {
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as createCLI } from './chunks/cac.
|
|
1
|
+
import { c as createCLI } from './chunks/cac.B_NTJoIH.js';
|
|
2
2
|
import '@vitest/utils/helpers';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'pathe';
|
|
5
5
|
import 'tinyrainbow';
|
|
6
6
|
import './chunks/constants.D_Q9UYh-.js';
|
|
7
|
-
import './chunks/index.
|
|
7
|
+
import './chunks/index.kotH7DY7.js';
|
|
8
8
|
import 'node:fs';
|
|
9
9
|
import 'node:fs/promises';
|
|
10
10
|
import 'node:perf_hooks';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { HookHandler, ConfigEnv, UserConfig } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.
|
|
4
|
-
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.
|
|
5
|
-
import { V as VitestPluginContext } from './chunks/plugin.d.
|
|
3
|
+
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.BQ0wpUaj.js';
|
|
4
|
+
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.BQ0wpUaj.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.DevON6kQ.js';
|
|
6
6
|
import { F as FakeTimerInstallOpts } from './chunks/config.d.BTfZNUu9.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
8
|
import '@vitest/utils';
|
|
9
|
-
import './chunks/worker.d.
|
|
9
|
+
import './chunks/worker.d.ZGohxCEd.js';
|
|
10
10
|
import 'vite/module-runner';
|
|
11
11
|
import './chunks/environment.d.CrsxCzP1.js';
|
|
12
12
|
import '@vitest/snapshot';
|
|
@@ -14,7 +14,7 @@ import 'node:stream';
|
|
|
14
14
|
import '@vitest/mocker';
|
|
15
15
|
import '@vitest/utils/source-map';
|
|
16
16
|
import 'vitest/browser';
|
|
17
|
-
import './chunks/browser.d
|
|
17
|
+
import './chunks/browser.d.DnU_kh8a.js';
|
|
18
18
|
import '@vitest/pretty-format';
|
|
19
19
|
import '@vitest/utils/diff';
|
|
20
20
|
import '@vitest/expect';
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.BQ0wpUaj.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
|
-
import { A as AfterSuiteRunMeta } from './chunks/worker.d.
|
|
3
|
+
import { A as AfterSuiteRunMeta } from './chunks/worker.d.ZGohxCEd.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import 'node:stream';
|
|
@@ -11,7 +11,7 @@ import './chunks/config.d.BTfZNUu9.js';
|
|
|
11
11
|
import '@vitest/pretty-format';
|
|
12
12
|
import '@vitest/snapshot';
|
|
13
13
|
import '@vitest/utils/diff';
|
|
14
|
-
import './chunks/browser.d
|
|
14
|
+
import './chunks/browser.d.DnU_kh8a.js';
|
|
15
15
|
import '@vitest/expect';
|
|
16
16
|
import 'vitest/optional-types.js';
|
|
17
17
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
package/dist/coverage.js
CHANGED
package/dist/environments.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { S as SerializedTestSpecification } from './chunks/browser.d
|
|
2
|
-
export { B as BrowserTesterOptions } from './chunks/browser.d
|
|
3
|
-
import './chunks/global.d.
|
|
1
|
+
import { S as SerializedTestSpecification } from './chunks/browser.d.DnU_kh8a.js';
|
|
2
|
+
export { B as BrowserTesterOptions } from './chunks/browser.d.DnU_kh8a.js';
|
|
3
|
+
import './chunks/global.d.BQDgW9Pr.js';
|
|
4
4
|
import { File, TestAnnotation, TaskResultPack, TaskEventPack, TaskPopulated } from '@vitest/runner';
|
|
5
5
|
export { CancelReason, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
6
6
|
import { Awaitable } from '@vitest/utils';
|
|
7
7
|
export { ParsedStack, SerializedError, TestError } from '@vitest/utils';
|
|
8
|
-
import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, b as BirpcReturn, P as ProvidedContext } from './chunks/worker.d.
|
|
9
|
-
export { A as AfterSuiteRunMeta, C as ContextRPC, d as ContextTestEnvironment, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.
|
|
8
|
+
import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, b as BirpcReturn, P as ProvidedContext } from './chunks/worker.d.ZGohxCEd.js';
|
|
9
|
+
export { A as AfterSuiteRunMeta, C as ContextRPC, d as ContextTestEnvironment, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.ZGohxCEd.js';
|
|
10
10
|
import { S as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.BTfZNUu9.js';
|
|
11
11
|
export { b as RuntimeConfig, a as SerializedCoverageConfig } from './chunks/config.d.BTfZNUu9.js';
|
|
12
12
|
import { ExpectStatic } from '@vitest/expect';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { b as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, d as vitest } from './chunks/vi.
|
|
2
|
-
export { b as bench } from './chunks/benchmark.
|
|
1
|
+
export { b as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, d as vitest } from './chunks/vi.CyIUVSoU.js';
|
|
2
|
+
export { b as bench } from './chunks/benchmark.B3N2zMcH.js';
|
|
3
3
|
export { V as EvaluatedModules } from './chunks/evaluatedModules.Dg1zASAC.js';
|
|
4
|
-
export { a as assertType } from './chunks/index.
|
|
4
|
+
export { a as assertType } from './chunks/index.CGezRSGU.js';
|
|
5
5
|
export { expectTypeOf } from 'expect-type';
|
|
6
6
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
7
7
|
export { chai } from '@vitest/expect';
|
|
8
8
|
import '@vitest/runner/utils';
|
|
9
|
-
import './chunks/utils.
|
|
9
|
+
import './chunks/utils.DvEY5TfP.js';
|
|
10
10
|
import '@vitest/utils/timers';
|
|
11
11
|
import '@vitest/snapshot';
|
|
12
12
|
import '@vitest/utils/error';
|
|
@@ -15,6 +15,6 @@ import '@vitest/spy';
|
|
|
15
15
|
import '@vitest/utils/offset';
|
|
16
16
|
import '@vitest/utils/source-map';
|
|
17
17
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
18
|
-
import './chunks/date
|
|
18
|
+
import './chunks/date.Bq6ZW5rf.js';
|
|
19
19
|
import 'pathe';
|
|
20
20
|
import 'vite/module-runner';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'vite/module-runner';
|
|
2
|
-
export { b as VitestModuleEvaluator, a as VitestModuleEvaluatorOptions, c as createImportMetaEnvProxy, g as getDefaultRequestStubs, i as isPrimitive, u as unwrapId, w as wrapId } from './chunks/moduleRunner.d.
|
|
2
|
+
export { b as VitestModuleEvaluator, a as VitestModuleEvaluatorOptions, c as createImportMetaEnvProxy, g as getDefaultRequestStubs, i as isPrimitive, u as unwrapId, w as wrapId } from './chunks/moduleRunner.d.BxT-OjLR.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
|
-
import './chunks/worker.d.
|
|
5
|
+
import './chunks/worker.d.ZGohxCEd.js';
|
|
6
6
|
import '@vitest/runner';
|
|
7
7
|
import './chunks/config.d.BTfZNUu9.js';
|
|
8
8
|
import '@vitest/pretty-format';
|
package/dist/module-evaluator.js
CHANGED
|
@@ -9,12 +9,14 @@ class ModuleDebug {
|
|
|
9
9
|
executionStack = [];
|
|
10
10
|
startCalculateModuleExecutionInfo(filename, startOffset) {
|
|
11
11
|
const startTime = performanceNow();
|
|
12
|
-
|
|
12
|
+
this.executionStack.push({
|
|
13
13
|
filename,
|
|
14
14
|
startTime,
|
|
15
15
|
subImportTime: 0
|
|
16
|
-
})
|
|
17
|
-
|
|
16
|
+
});
|
|
17
|
+
return () => {
|
|
18
|
+
const duration = performanceNow() - startTime;
|
|
19
|
+
const currentExecution = this.executionStack.pop();
|
|
18
20
|
if (currentExecution == null) throw new Error("Execution stack is empty, this should never happen");
|
|
19
21
|
const selfTime = duration - currentExecution.subImportTime;
|
|
20
22
|
if (this.executionStack.length > 0) this.executionStack.at(-1).subImportTime += duration;
|
|
@@ -37,7 +39,10 @@ class VitestModuleEvaluator {
|
|
|
37
39
|
primitives;
|
|
38
40
|
debug = new ModuleDebug();
|
|
39
41
|
constructor(vmOptions, options = {}) {
|
|
40
|
-
|
|
42
|
+
this.options = options;
|
|
43
|
+
this.vm = vmOptions;
|
|
44
|
+
this.stubs = getDefaultRequestStubs(vmOptions?.context);
|
|
45
|
+
if (options.compiledFunctionArgumentsNames) this.compiledFunctionArgumentsNames = options.compiledFunctionArgumentsNames;
|
|
41
46
|
if (options.compiledFunctionArgumentsValues) this.compiledFunctionArgumentsValues = options.compiledFunctionArgumentsValues;
|
|
42
47
|
if (vmOptions) this.primitives = vm.runInContext("({ Object, Proxy, Reflect })", vmOptions.context);
|
|
43
48
|
else this.primitives = {
|
|
@@ -52,19 +57,24 @@ class VitestModuleEvaluator {
|
|
|
52
57
|
// https://github.com/vitejs/vite/pull/20449
|
|
53
58
|
if (!isWindows || isBuiltin(id) || /^(?:node:|data:|http:|https:|file:)/.test(id)) return id;
|
|
54
59
|
const [filepath, query] = id.split("?");
|
|
55
|
-
|
|
60
|
+
if (query) return `${pathToFileURL(filepath).toString()}?${query}`;
|
|
61
|
+
return pathToFileURL(filepath).toString();
|
|
56
62
|
}
|
|
57
63
|
async runExternalModule(id) {
|
|
58
64
|
if (id in this.stubs) return this.stubs[id];
|
|
59
|
-
const file = this.convertIdToImportUrl(id)
|
|
65
|
+
const file = this.convertIdToImportUrl(id);
|
|
66
|
+
const namespace = this.vm ? await this.vm.externalModulesExecutor.import(file) : await import(file);
|
|
60
67
|
if (!this.shouldInterop(file, namespace)) return namespace;
|
|
61
|
-
const { mod, defaultExport } = interopModule(namespace)
|
|
68
|
+
const { mod, defaultExport } = interopModule(namespace);
|
|
69
|
+
const { Proxy, Reflect } = this.primitives;
|
|
62
70
|
return new Proxy(mod, {
|
|
63
71
|
get(mod, prop) {
|
|
64
|
-
|
|
72
|
+
if (prop === "default") return defaultExport;
|
|
73
|
+
return mod[prop] ?? defaultExport?.[prop];
|
|
65
74
|
},
|
|
66
75
|
has(mod, prop) {
|
|
67
|
-
|
|
76
|
+
if (prop === "default") return defaultExport !== void 0;
|
|
77
|
+
return prop in mod || defaultExport && prop in defaultExport;
|
|
68
78
|
},
|
|
69
79
|
getOwnPropertyDescriptor(mod, prop) {
|
|
70
80
|
const descriptor = Reflect.getOwnPropertyDescriptor(mod, prop);
|
|
@@ -79,40 +89,57 @@ class VitestModuleEvaluator {
|
|
|
79
89
|
}
|
|
80
90
|
async runInlinedModule(context, code, module) {
|
|
81
91
|
context.__vite_ssr_import_meta__.env = this.env;
|
|
82
|
-
const { Reflect, Proxy, Object } = this.primitives
|
|
92
|
+
const { Reflect, Proxy, Object } = this.primitives;
|
|
93
|
+
const exportsObject = context[ssrModuleExportsKey];
|
|
94
|
+
const SYMBOL_NOT_DEFINED = Symbol("not defined");
|
|
83
95
|
let moduleExports = SYMBOL_NOT_DEFINED;
|
|
84
96
|
// this proxy is triggered only on exports.{name} and module.exports access
|
|
85
97
|
// inside the module itself. imported module is always "exports"
|
|
86
98
|
const cjsExports = new Proxy(exportsObject, {
|
|
87
99
|
get: (target, p, receiver) => {
|
|
88
|
-
|
|
100
|
+
if (Reflect.has(target, p)) return Reflect.get(target, p, receiver);
|
|
101
|
+
return Reflect.get(Object.prototype, p, receiver);
|
|
89
102
|
},
|
|
90
103
|
getPrototypeOf: () => Object.prototype,
|
|
91
104
|
set: (_, p, value) => {
|
|
92
105
|
// treat "module.exports =" the same as "exports.default =" to not have nested "default.default",
|
|
93
106
|
// so "exports.default" becomes the actual module
|
|
94
|
-
if (p === "default" && this.shouldInterop(module.file, { default: value }) && cjsExports !== value)
|
|
107
|
+
if (p === "default" && this.shouldInterop(module.file, { default: value }) && cjsExports !== value) {
|
|
108
|
+
exportAll(cjsExports, value);
|
|
109
|
+
exportsObject.default = value;
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
95
112
|
if (!Reflect.has(exportsObject, "default")) exportsObject.default = {};
|
|
96
113
|
// returns undefined, when accessing named exports, if default is not an object
|
|
97
114
|
// but is still present inside hasOwnKeys, this is Node behaviour for CJS
|
|
98
|
-
if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports))
|
|
115
|
+
if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) {
|
|
116
|
+
defineExport(exportsObject, p, () => void 0);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
99
119
|
if (!isPrimitive(exportsObject.default)) exportsObject.default[p] = value;
|
|
100
120
|
if (p !== "default") defineExport(exportsObject, p, () => value);
|
|
101
121
|
return true;
|
|
102
122
|
}
|
|
103
|
-
})
|
|
123
|
+
});
|
|
124
|
+
const moduleProxy = {
|
|
104
125
|
set exports(value) {
|
|
105
|
-
exportAll(cjsExports, value)
|
|
126
|
+
exportAll(cjsExports, value);
|
|
127
|
+
exportsObject.default = value;
|
|
128
|
+
moduleExports = value;
|
|
106
129
|
},
|
|
107
130
|
get exports() {
|
|
108
131
|
return cjsExports;
|
|
109
132
|
}
|
|
110
|
-
}
|
|
133
|
+
};
|
|
134
|
+
const meta = context[ssrImportMetaKey];
|
|
111
135
|
if (this.options.getCurrentTestFilepath?.() === module.file) {
|
|
112
136
|
const globalNamespace = this.vm?.context || globalThis;
|
|
113
137
|
Object.defineProperty(meta, "vitest", { get: () => globalNamespace.__vitest_index__ });
|
|
114
138
|
}
|
|
115
|
-
const filename = meta.filename
|
|
139
|
+
const filename = meta.filename;
|
|
140
|
+
const dirname = meta.dirname;
|
|
141
|
+
const require = this.createRequire(filename);
|
|
142
|
+
const argumentsList = [
|
|
116
143
|
ssrModuleExportsKey,
|
|
117
144
|
ssrImportMetaKey,
|
|
118
145
|
ssrImportKey,
|
|
@@ -127,19 +154,28 @@ class VitestModuleEvaluator {
|
|
|
127
154
|
];
|
|
128
155
|
if (this.compiledFunctionArgumentsNames) argumentsList.push(...this.compiledFunctionArgumentsNames);
|
|
129
156
|
// add 'use strict' since ESM enables it by default
|
|
130
|
-
const codeDefinition = `'use strict';async (${argumentsList.join(",")})=>{{
|
|
157
|
+
const codeDefinition = `'use strict';async (${argumentsList.join(",")})=>{{`;
|
|
158
|
+
const wrappedCode = `${codeDefinition}${code}\n}}`;
|
|
159
|
+
const options = {
|
|
131
160
|
filename: module.id,
|
|
132
161
|
lineOffset: 0,
|
|
133
162
|
columnOffset: -codeDefinition.length
|
|
134
|
-
}
|
|
163
|
+
};
|
|
164
|
+
const finishModuleExecutionInfo = this.debug.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
|
|
135
165
|
try {
|
|
136
|
-
|
|
166
|
+
const initModule = this.vm ? vm.runInContext(wrappedCode, this.vm.context, options) : vm.runInThisContext(wrappedCode, options);
|
|
167
|
+
const dynamicRequest = async (dep, options) => {
|
|
168
|
+
dep = String(dep);
|
|
169
|
+
// TODO: support more edge cases?
|
|
170
|
+
// vite doesn't support dynamic modules by design, but we have to
|
|
171
|
+
if (dep[0] === "#") return context[ssrDynamicImportKey](wrapId(dep), options);
|
|
172
|
+
return context[ssrDynamicImportKey](dep, options);
|
|
173
|
+
};
|
|
174
|
+
await initModule(
|
|
137
175
|
context[ssrModuleExportsKey],
|
|
138
176
|
context[ssrImportMetaKey],
|
|
139
177
|
context[ssrImportKey],
|
|
140
|
-
|
|
141
|
-
return dep = String(dep), dep[0] === "#" ? context[ssrDynamicImportKey](wrapId(dep), options) : context[ssrDynamicImportKey](dep, options);
|
|
142
|
-
},
|
|
178
|
+
dynamicRequest,
|
|
143
179
|
context[ssrExportAllKey],
|
|
144
180
|
// vite 7 support, remove when vite 7+ is supported
|
|
145
181
|
context.__vite_ssr_exportName__ || ((name, getter) => Object.defineProperty(exportsObject, name, {
|
|
@@ -161,12 +197,16 @@ class VitestModuleEvaluator {
|
|
|
161
197
|
}
|
|
162
198
|
}
|
|
163
199
|
createRequire(filename) {
|
|
164
|
-
|
|
200
|
+
// \x00 is a rollup convention for virtual files,
|
|
201
|
+
// it is not allowed in actual file names
|
|
202
|
+
if (filename[0] === "\0" || !isAbsolute(filename)) return () => ({});
|
|
203
|
+
return this.vm ? this.vm.externalModulesExecutor.createRequire(filename) : createRequire(filename);
|
|
165
204
|
}
|
|
166
205
|
shouldInterop(path, mod) {
|
|
206
|
+
if (this.options.interopDefault === false) return false;
|
|
167
207
|
// never interop ESM modules
|
|
168
208
|
// TODO: should also skip for `.js` with `type="module"`
|
|
169
|
-
return
|
|
209
|
+
return !path.endsWith(".mjs") && "default" in mod;
|
|
170
210
|
}
|
|
171
211
|
}
|
|
172
212
|
function createImportMetaEnvProxy() {
|
|
@@ -178,7 +218,9 @@ function createImportMetaEnvProxy() {
|
|
|
178
218
|
];
|
|
179
219
|
return new Proxy(process.env, {
|
|
180
220
|
get(_, key) {
|
|
181
|
-
if (typeof key
|
|
221
|
+
if (typeof key !== "string") return;
|
|
222
|
+
if (booleanKeys.includes(key)) return !!process.env[key];
|
|
223
|
+
return process.env[key];
|
|
182
224
|
},
|
|
183
225
|
set(_, key, value) {
|
|
184
226
|
if (typeof key !== "string") return true;
|
|
@@ -195,8 +237,12 @@ function updateStyle(id, css) {
|
|
|
195
237
|
element.textContent = css;
|
|
196
238
|
return;
|
|
197
239
|
}
|
|
198
|
-
const head = document.querySelector("head")
|
|
199
|
-
style
|
|
240
|
+
const head = document.querySelector("head");
|
|
241
|
+
const style = document.createElement("style");
|
|
242
|
+
style.setAttribute("type", "text/css");
|
|
243
|
+
style.setAttribute("data-vite-dev-id", id);
|
|
244
|
+
style.textContent = css;
|
|
245
|
+
head?.appendChild(style);
|
|
200
246
|
}
|
|
201
247
|
function removeStyle(id) {
|
|
202
248
|
if (typeof document === "undefined") return;
|
|
@@ -231,16 +277,18 @@ function getDefaultRequestStubs(context) {
|
|
|
231
277
|
const clientStub = vm.runInContext(`(defaultClient) => ({ ...defaultClient, updateStyle: ${updateStyle.toString()}, removeStyle: ${removeStyle.toString()} })`, context)(defaultClientStub);
|
|
232
278
|
return { "/@vite/client": clientStub };
|
|
233
279
|
}
|
|
234
|
-
function exportAll(exports, sourceModule) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
280
|
+
function exportAll(exports$1, sourceModule) {
|
|
281
|
+
// #1120 when a module exports itself it causes
|
|
282
|
+
// call stack error
|
|
283
|
+
if (exports$1 === sourceModule) return;
|
|
284
|
+
if (isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise) return;
|
|
285
|
+
for (const key in sourceModule) if (key !== "default" && !(key in exports$1)) try {
|
|
286
|
+
defineExport(exports$1, key, () => sourceModule[key]);
|
|
287
|
+
} catch {}
|
|
240
288
|
}
|
|
241
289
|
// keep consistency with Vite on how exports are defined
|
|
242
|
-
function defineExport(exports, key, value) {
|
|
243
|
-
Object.defineProperty(exports, key, {
|
|
290
|
+
function defineExport(exports$1, key, value) {
|
|
291
|
+
Object.defineProperty(exports$1, key, {
|
|
244
292
|
enumerable: true,
|
|
245
293
|
configurable: true,
|
|
246
294
|
get: value
|
|
@@ -256,14 +304,16 @@ function interopModule(mod) {
|
|
|
256
304
|
};
|
|
257
305
|
let defaultExport = "default" in mod ? mod.default : mod;
|
|
258
306
|
if (!isPrimitive(defaultExport) && "__esModule" in defaultExport) {
|
|
259
|
-
|
|
307
|
+
mod = defaultExport;
|
|
308
|
+
if ("default" in defaultExport) defaultExport = defaultExport.default;
|
|
260
309
|
}
|
|
261
310
|
return {
|
|
262
311
|
mod,
|
|
263
312
|
defaultExport
|
|
264
313
|
};
|
|
265
314
|
}
|
|
266
|
-
const VALID_ID_PREFIX = `/@id
|
|
315
|
+
const VALID_ID_PREFIX = `/@id/`;
|
|
316
|
+
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
267
317
|
function wrapId(id) {
|
|
268
318
|
return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
|
|
269
319
|
}
|
package/dist/module-runner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { VitestModuleEvaluator } from './module-evaluator.js';
|
|
2
|
-
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.
|
|
3
|
-
export { g as getWorkerState } from './chunks/utils.
|
|
2
|
+
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.DLjmA_wU.js';
|
|
3
|
+
export { g as getWorkerState } from './chunks/utils.DvEY5TfP.js';
|
|
4
4
|
import 'node:module';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'node:vm';
|
package/dist/node.d.ts
CHANGED
|
@@ -3,23 +3,23 @@ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as Res
|
|
|
3
3
|
export { vite as Vite };
|
|
4
4
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
5
5
|
import { IncomingMessage } from 'node:http';
|
|
6
|
-
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as PoolWorker, l as PoolOptions, m as WorkerRequest, n as TestSequencer, L as Logger } from './chunks/reporters.d.
|
|
7
|
-
export { at as BaseCoverageOptions, Y as BenchmarkUserOptions, Z as BrowserBuiltinProvider, $ as BrowserCommand, a0 as BrowserCommandContext, a1 as BrowserConfigOptions, a2 as BrowserInstanceOption, a3 as BrowserModuleMocker, a4 as BrowserOrchestrator, a5 as BrowserProvider, a6 as BrowserProviderOption, a7 as BrowserScript, a8 as BrowserServerFactory, a9 as BrowserServerOptions, aa as BrowserServerState, ab as BrowserServerStateSession, ai as BuiltinEnvironment, ac as CDPSession, aj as CSSModuleScopeStrategy, au as CoverageIstanbulOptions, av as CoverageOptions, aw as CoverageProvider, ax as CoverageProviderModule, ay as CoverageReporter, c as CoverageV8Options, az as CustomProviderOptions, ak as DepsOptimizationOptions, al as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, t as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, o as OnTestsRerunHandler, ad as ParentProjectBrowser, am as Pool, q as PoolRunnerInitializer, r as PoolTask, ae as ProjectBrowser, an as ProjectConfig, b as ReportContext, aB as ReportedHookContext, aC as Reporter, ap as ResolveSnapshotPathHandler, aq as ResolveSnapshotPathHandlerContext, af as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ao as ResolvedProjectConfig, S as SerializedTestProject, u as TaskOptions, v as TestCase, w as TestCollection, x as TestDiagnostic, y as TestModule, z as TestModuleState, B as TestResult, D as TestResultFailed, E as TestResultPassed, F as TestResultSkipped, aD as TestRunEndReason, aA as TestRunResult, X as TestSequencerConstructor, G as TestState, K as TestSuite, N as TestSuiteState, ag as ToMatchScreenshotComparators, ah as ToMatchScreenshotOptions, ar as TypecheckConfig, U as UserWorkspaceConfig, as as VitestEnvironment, p as VitestPackageInstaller, W as WatcherTriggerPattern, s as WorkerResponse, _ as _BrowserNames, Q as experimental_getRunnerTask } from './chunks/reporters.d.
|
|
6
|
+
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as PoolWorker, l as PoolOptions, m as WorkerRequest, n as TestSequencer, L as Logger } from './chunks/reporters.d.BQ0wpUaj.js';
|
|
7
|
+
export { at as BaseCoverageOptions, Y as BenchmarkUserOptions, Z as BrowserBuiltinProvider, $ as BrowserCommand, a0 as BrowserCommandContext, a1 as BrowserConfigOptions, a2 as BrowserInstanceOption, a3 as BrowserModuleMocker, a4 as BrowserOrchestrator, a5 as BrowserProvider, a6 as BrowserProviderOption, a7 as BrowserScript, a8 as BrowserServerFactory, a9 as BrowserServerOptions, aa as BrowserServerState, ab as BrowserServerStateSession, ai as BuiltinEnvironment, ac as CDPSession, aj as CSSModuleScopeStrategy, au as CoverageIstanbulOptions, av as CoverageOptions, aw as CoverageProvider, ax as CoverageProviderModule, ay as CoverageReporter, c as CoverageV8Options, az as CustomProviderOptions, ak as DepsOptimizationOptions, al as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, t as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, o as OnTestsRerunHandler, ad as ParentProjectBrowser, am as Pool, q as PoolRunnerInitializer, r as PoolTask, ae as ProjectBrowser, an as ProjectConfig, b as ReportContext, aB as ReportedHookContext, aC as Reporter, ap as ResolveSnapshotPathHandler, aq as ResolveSnapshotPathHandlerContext, af as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ao as ResolvedProjectConfig, S as SerializedTestProject, u as TaskOptions, v as TestCase, w as TestCollection, x as TestDiagnostic, y as TestModule, z as TestModuleState, B as TestResult, D as TestResultFailed, E as TestResultPassed, F as TestResultSkipped, aD as TestRunEndReason, aA as TestRunResult, X as TestSequencerConstructor, G as TestState, K as TestSuite, N as TestSuiteState, ag as ToMatchScreenshotComparators, ah as ToMatchScreenshotOptions, ar as TypecheckConfig, U as UserWorkspaceConfig, as as VitestEnvironment, p as VitestPackageInstaller, W as WatcherTriggerPattern, s as WorkerResponse, _ as _BrowserNames, Q as experimental_getRunnerTask } from './chunks/reporters.d.BQ0wpUaj.js';
|
|
8
8
|
import { Awaitable } from '@vitest/utils';
|
|
9
9
|
export { SerializedError } from '@vitest/utils';
|
|
10
|
-
import { R as RuntimeRPC, C as ContextRPC } from './chunks/worker.d.
|
|
11
|
-
export { T as TestExecutionType } from './chunks/worker.d.
|
|
10
|
+
import { R as RuntimeRPC, C as ContextRPC } from './chunks/worker.d.ZGohxCEd.js';
|
|
11
|
+
export { T as TestExecutionType } from './chunks/worker.d.ZGohxCEd.js';
|
|
12
12
|
import { Writable } from 'node:stream';
|
|
13
|
-
export { V as VitestPluginContext } from './chunks/plugin.d.
|
|
13
|
+
export { V as VitestPluginContext } from './chunks/plugin.d.DevON6kQ.js';
|
|
14
14
|
import { Debugger } from 'debug';
|
|
15
|
-
import './chunks/global.d.
|
|
15
|
+
import './chunks/global.d.BQDgW9Pr.js';
|
|
16
16
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
17
17
|
export { b as RuntimeConfig } from './chunks/config.d.BTfZNUu9.js';
|
|
18
18
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
19
19
|
import '@vitest/mocker';
|
|
20
20
|
import '@vitest/utils/source-map';
|
|
21
21
|
import 'vitest/browser';
|
|
22
|
-
import './chunks/browser.d
|
|
22
|
+
import './chunks/browser.d.DnU_kh8a.js';
|
|
23
23
|
import '@vitest/pretty-format';
|
|
24
24
|
import '@vitest/snapshot';
|
|
25
25
|
import '@vitest/utils/diff';
|
package/dist/node.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
|
|
3
3
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
4
|
-
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.
|
|
5
|
-
export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
7
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
8
|
-
export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.
|
|
4
|
+
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.D48wY175.js';
|
|
5
|
+
export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.D48wY175.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.B_NTJoIH.js';
|
|
7
|
+
import { r as resolveConfig$2 } from './chunks/coverage.BUlIqJrL.js';
|
|
8
|
+
export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.BUlIqJrL.js';
|
|
9
9
|
import { slash, deepClone } from '@vitest/utils/helpers';
|
|
10
|
-
import { a as any } from './chunks/index.
|
|
10
|
+
import { a as any } from './chunks/index.z7NPOg2E.js';
|
|
11
11
|
import { resolve } from 'pathe';
|
|
12
12
|
import { c as configFiles } from './chunks/constants.D_Q9UYh-.js';
|
|
13
13
|
export { distDir, rootDir } from './path.js';
|
|
@@ -17,8 +17,8 @@ import './chunks/coverage.D_JHT54q.js';
|
|
|
17
17
|
import 'node:path';
|
|
18
18
|
import 'node:os';
|
|
19
19
|
import '@vitest/snapshot/manager';
|
|
20
|
-
import './chunks/index.
|
|
21
|
-
import './chunks/index.
|
|
20
|
+
import './chunks/index.0kCJoeWi.js';
|
|
21
|
+
import './chunks/index.kotH7DY7.js';
|
|
22
22
|
import 'node:fs/promises';
|
|
23
23
|
import 'node:perf_hooks';
|
|
24
24
|
import '@vitest/utils/source-map';
|
|
@@ -62,7 +62,7 @@ import './chunks/defaults.BOqNVLsY.js';
|
|
|
62
62
|
import '@vitest/utils/constants';
|
|
63
63
|
import '@vitest/utils/resolver';
|
|
64
64
|
import 'es-module-lexer';
|
|
65
|
-
import './chunks/index.
|
|
65
|
+
import './chunks/index.op2Re5rn.js';
|
|
66
66
|
import 'node:assert';
|
|
67
67
|
import '@vitest/utils/serialize';
|
|
68
68
|
import 'node:readline';
|
|
@@ -71,14 +71,18 @@ import 'readline';
|
|
|
71
71
|
|
|
72
72
|
// this is only exported as a public function and not used inside vitest
|
|
73
73
|
async function resolveConfig(options = {}, viteOverrides = {}) {
|
|
74
|
-
const root = slash(resolve(options.root || process.cwd()))
|
|
74
|
+
const root = slash(resolve(options.root || process.cwd()));
|
|
75
|
+
const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : any(configFiles, { cwd: root });
|
|
75
76
|
options.config = configPath;
|
|
76
|
-
const vitest = new Vitest("test", deepClone(options))
|
|
77
|
+
const vitest = new Vitest("test", deepClone(options));
|
|
78
|
+
const config = await resolveConfig$1(mergeConfig({
|
|
77
79
|
configFile: configPath,
|
|
78
80
|
mode: options.mode || "test",
|
|
79
81
|
plugins: [await VitestPlugin(options, vitest)]
|
|
80
|
-
}, mergeConfig(viteOverrides, { root: options.root })), "serve")
|
|
81
|
-
|
|
82
|
+
}, mergeConfig(viteOverrides, { root: options.root })), "serve");
|
|
83
|
+
const vitestConfig = resolveConfig$2(vitest, Reflect.get(config, "_vitest"), config);
|
|
84
|
+
await vitest.close();
|
|
85
|
+
return {
|
|
82
86
|
viteConfig: config,
|
|
83
87
|
vitestConfig
|
|
84
88
|
};
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { aR as BaseReporter, aS as BenchmarkBuiltinReporters, aE as BenchmarkReporter, aF as BenchmarkReportsMap, aT as BuiltinReporterOptions, aU as BuiltinReporters, aG as DefaultReporter, aH as DotReporter, aI as GithubActionsReporter, aJ as HangingProcessReporter, aL as JUnitReporter, aV as JsonAssertionResult, aK as JsonReporter, aW as JsonTestResult, aX as JsonTestResults, aB as ReportedHookContext, aC as Reporter, aM as ReportersMap, aN as TapFlatReporter, aO as TapReporter, aD as TestRunEndReason, aP as VerboseBenchmarkReporter, aQ as VerboseReporter } from './chunks/reporters.d.
|
|
1
|
+
export { aR as BaseReporter, aS as BenchmarkBuiltinReporters, aE as BenchmarkReporter, aF as BenchmarkReportsMap, aT as BuiltinReporterOptions, aU as BuiltinReporters, aG as DefaultReporter, aH as DotReporter, aI as GithubActionsReporter, aJ as HangingProcessReporter, aL as JUnitReporter, aV as JsonAssertionResult, aK as JsonReporter, aW as JsonTestResult, aX as JsonTestResults, aB as ReportedHookContext, aC as Reporter, aM as ReportersMap, aN as TapFlatReporter, aO as TapReporter, aD as TestRunEndReason, aP as VerboseBenchmarkReporter, aQ as VerboseReporter } from './chunks/reporters.d.BQ0wpUaj.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import '@vitest/utils';
|
|
4
|
-
import './chunks/worker.d.
|
|
4
|
+
import './chunks/worker.d.ZGohxCEd.js';
|
|
5
5
|
import 'vite/module-runner';
|
|
6
6
|
import './chunks/config.d.BTfZNUu9.js';
|
|
7
7
|
import '@vitest/pretty-format';
|
|
@@ -13,7 +13,7 @@ import 'vite';
|
|
|
13
13
|
import '@vitest/mocker';
|
|
14
14
|
import '@vitest/utils/source-map';
|
|
15
15
|
import 'vitest/browser';
|
|
16
|
-
import './chunks/browser.d
|
|
16
|
+
import './chunks/browser.d.DnU_kh8a.js';
|
|
17
17
|
import '@vitest/expect';
|
|
18
18
|
import 'vitest/optional-types.js';
|
|
19
19
|
import './chunks/benchmark.d.DAaHLpsq.js';
|