vitest 1.0.0-beta.6 → 1.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/dist/browser.d.ts +1 -1
- package/dist/child.js +7 -7
- package/dist/cli.js +2 -2
- package/dist/config.cjs +6 -3
- package/dist/config.d.ts +1 -1
- package/dist/config.js +6 -3
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +2 -2
- package/dist/{reporters-vMlHjCdM.d.ts → reporters-LLiOBu3g.d.ts} +7 -1
- package/dist/reporters.d.ts +1 -1
- package/dist/runners.d.ts +1 -1
- package/dist/{suite-vfxzpeqE.d.ts → suite-SvxfaIxW.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{environments.ewIbzajW.js → environments.hTqxBFDN.js} +2 -2
- package/dist/vendor/{execute.aMjV5C9u.js → execute.ILey0jnF.js} +24 -5
- package/dist/vendor/{loader.-JDdZ5RJ.js → loader.w8KTtIkD.js} +1 -1
- package/dist/vendor/{node.1xm0UoNi.js → node.mLeBfrTn.js} +16 -13
- package/dist/vm.js +3 -3
- package/dist/worker.js +3 -3
- package/package.json +11 -11
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { processError, startTests } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule } from './reporters-LLiOBu3g.js';
|
|
3
3
|
import { VitestExecutor } from './execute.js';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
package/dist/child.js
CHANGED
|
@@ -3,13 +3,13 @@ import v8 from 'node:v8';
|
|
|
3
3
|
import { c as createBirpc } from './vendor/index.cAUulNDf.js';
|
|
4
4
|
import { parseRegexp } from '@vitest/utils';
|
|
5
5
|
import { workerId } from 'tinypool';
|
|
6
|
-
import { l as loadEnvironment } from './vendor/loader
|
|
7
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.
|
|
6
|
+
import { l as loadEnvironment } from './vendor/loader.w8KTtIkD.js';
|
|
7
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.ILey0jnF.js';
|
|
8
8
|
import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
9
9
|
import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'vite-node/client';
|
|
12
|
-
import './vendor/environments.
|
|
12
|
+
import './vendor/environments.hTqxBFDN.js';
|
|
13
13
|
import 'node:console';
|
|
14
14
|
import 'local-pkg';
|
|
15
15
|
import 'node:url';
|
|
@@ -24,14 +24,14 @@ import 'node:module';
|
|
|
24
24
|
import 'vite-node/constants';
|
|
25
25
|
import './vendor/global.L7JRz1qU.js';
|
|
26
26
|
|
|
27
|
+
try {
|
|
28
|
+
process.title = `node (vitest ${workerId})`;
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
27
31
|
async function init(ctx) {
|
|
28
32
|
const { config, workerId: workerId$1, providedContext } = ctx;
|
|
29
33
|
process.env.VITEST_WORKER_ID = String(workerId$1);
|
|
30
34
|
process.env.VITEST_POOL_ID = String(workerId);
|
|
31
|
-
try {
|
|
32
|
-
process.title = `node (vitest ${workerId})`;
|
|
33
|
-
} catch {
|
|
34
|
-
}
|
|
35
35
|
let setCancel = (_reason) => {
|
|
36
36
|
};
|
|
37
37
|
const onCancel = new Promise((resolve) => {
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { v as version, s as startVitest } from './vendor/node.
|
|
4
|
+
import { v as version, s as startVitest } from './vendor/node.mLeBfrTn.js';
|
|
5
5
|
import './vendor/index.XU72Rmy8.js';
|
|
6
6
|
import { d as divider } from './vendor/reporters.pr8MinP9.js';
|
|
7
7
|
import { t as toArray } from './vendor/base._79unx2z.js';
|
|
@@ -45,7 +45,7 @@ import 'node:crypto';
|
|
|
45
45
|
import 'assert';
|
|
46
46
|
import 'magic-string';
|
|
47
47
|
import 'strip-literal';
|
|
48
|
-
import './vendor/environments.
|
|
48
|
+
import './vendor/environments.hTqxBFDN.js';
|
|
49
49
|
import 'node:console';
|
|
50
50
|
import 'node:readline';
|
|
51
51
|
import 'readline';
|
package/dist/config.cjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var os = require('node:os');
|
|
3
4
|
var stdEnv = require('std-env');
|
|
4
5
|
var vite = require('vite');
|
|
5
6
|
|
|
6
|
-
var _a;
|
|
7
|
-
typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
7
|
+
var _a$1;
|
|
8
|
+
typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
|
|
8
9
|
|
|
10
|
+
var _a, _b;
|
|
9
11
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
10
12
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*"];
|
|
11
13
|
const defaultCoverageExcludes = [
|
|
@@ -37,7 +39,8 @@ const coverageConfigDefaults = {
|
|
|
37
39
|
reportOnFailure: false,
|
|
38
40
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
39
41
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
|
|
40
|
-
allowExternal: false
|
|
42
|
+
allowExternal: false,
|
|
43
|
+
processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
|
|
41
44
|
};
|
|
42
45
|
const fakeTimersDefaults = {
|
|
43
46
|
loopLimit: 1e4,
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { a as ResolvedCoverageOptions, U as UserConfig, C as CoverageV8Options, P as ProjectConfig } from './reporters-
|
|
3
|
+
import { a as ResolvedCoverageOptions, U as UserConfig, C as CoverageV8Options, P as ProjectConfig } from './reporters-LLiOBu3g.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import 'vite-node';
|
|
6
6
|
import '@vitest/snapshot';
|
package/dist/config.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
1
2
|
import { isCI } from 'std-env';
|
|
2
3
|
export { mergeConfig } from 'vite';
|
|
3
4
|
|
|
4
|
-
var _a;
|
|
5
|
-
typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
5
|
+
var _a$1;
|
|
6
|
+
typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
|
|
6
7
|
|
|
8
|
+
var _a, _b;
|
|
7
9
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
8
10
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*"];
|
|
9
11
|
const defaultCoverageExcludes = [
|
|
@@ -35,7 +37,8 @@ const coverageConfigDefaults = {
|
|
|
35
37
|
reportOnFailure: false,
|
|
36
38
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
37
39
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
|
|
38
|
-
allowExternal: false
|
|
40
|
+
allowExternal: false,
|
|
41
|
+
processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
|
|
39
42
|
};
|
|
40
43
|
const fakeTimersDefaults = {
|
|
41
44
|
loopLimit: 1e4,
|
package/dist/coverage.d.ts
CHANGED
package/dist/environments.d.ts
CHANGED
package/dist/environments.js
CHANGED
package/dist/execute.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import vm from 'node:vm';
|
|
2
2
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
3
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
4
|
-
import { am as PendingSuiteMock, an as MockFactory, ao as MockMap, a2 as WorkerGlobalState, g as RuntimeRPC } from './reporters-
|
|
4
|
+
import { am as PendingSuiteMock, an as MockFactory, ao as MockMap, a2 as WorkerGlobalState, g as RuntimeRPC } from './reporters-LLiOBu3g.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import '@vitest/runner';
|
|
7
7
|
import '@vitest/snapshot';
|
package/dist/execute.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
|
|
2
2
|
export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
3
|
-
export { b as bench } from './suite-
|
|
3
|
+
export { b as bench } from './suite-SvxfaIxW.js';
|
|
4
4
|
import { ExpectStatic } from '@vitest/expect';
|
|
5
5
|
export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
|
|
6
|
-
import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, n as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-
|
|
7
|
-
export { K as ApiConfig, a6 as ArgumentsType, a5 as Arrayable, a3 as Awaitable, B as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, D as BuiltinEnvironment, I as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a8 as Constructable, x as Context, _ as ContextRPC, Y as ContextTestEnvironment, af as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ae as CoverageReporter, C as CoverageV8Options, ag as CustomProviderOptions, N as DepsOptimizationOptions, E as Environment, L as EnvironmentOptions, aa as EnvironmentReturn, H as HappyDOMOptions, Q as InlineConfig, J as JSDOMOptions, a9 as ModuleCache, a7 as MutableArray, a4 as Nullable, ac as OnServerRestartHandler, y as Pool, z as PoolOptions, P as ProjectConfig, r as RawErrsMap, ad as ReportContext, a0 as ResolveIdFunction, a as ResolvedCoverageOptions, Z as ResolvedTestEnvironment, w as RootAndTarget, X as RunnerRPC, g as RuntimeRPC, O as TransformModePatterns, t as TscErrorInfo, S as TypecheckConfig, U as UserConfig, e as Vitest, G as VitestEnvironment, V as VitestRunMode, ab as VmEnvironmentReturn, $ as WorkerContext, a2 as WorkerGlobalState, a1 as WorkerRPC } from './reporters-
|
|
6
|
+
import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, n as RuntimeConfig, f as ProvidedContext, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-LLiOBu3g.js';
|
|
7
|
+
export { K as ApiConfig, a6 as ArgumentsType, a5 as Arrayable, a3 as Awaitable, B as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, D as BuiltinEnvironment, I as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a8 as Constructable, x as Context, _ as ContextRPC, Y as ContextTestEnvironment, af as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ae as CoverageReporter, C as CoverageV8Options, ag as CustomProviderOptions, N as DepsOptimizationOptions, E as Environment, L as EnvironmentOptions, aa as EnvironmentReturn, H as HappyDOMOptions, Q as InlineConfig, J as JSDOMOptions, a9 as ModuleCache, a7 as MutableArray, a4 as Nullable, ac as OnServerRestartHandler, y as Pool, z as PoolOptions, P as ProjectConfig, r as RawErrsMap, ad as ReportContext, a0 as ResolveIdFunction, a as ResolvedCoverageOptions, Z as ResolvedTestEnvironment, w as RootAndTarget, X as RunnerRPC, g as RuntimeRPC, O as TransformModePatterns, t as TscErrorInfo, S as TypecheckConfig, U as UserConfig, e as Vitest, G as VitestEnvironment, V as VitestRunMode, ab as VmEnvironmentReturn, $ as WorkerContext, a2 as WorkerGlobalState, a1 as WorkerRPC } from './reporters-LLiOBu3g.js';
|
|
8
8
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
9
9
|
export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
|
|
10
10
|
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VitestRunMode, U as UserConfig, e as Vitest, R as ResolvedConfig, f as ProvidedContext, W as WorkspaceProject, g as RuntimeRPC, T as TestSequencer, h as WorkspaceSpec } from './reporters-
|
|
2
|
-
export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-
|
|
1
|
+
import { V as VitestRunMode, U as UserConfig, e as Vitest, R as ResolvedConfig, f as ProvidedContext, W as WorkspaceProject, g as RuntimeRPC, T as TestSequencer, h as WorkspaceSpec } from './reporters-LLiOBu3g.js';
|
|
2
|
+
export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-LLiOBu3g.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import 'vite-node';
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.mLeBfrTn.js';
|
|
2
2
|
import 'pathe';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'node:path';
|
|
@@ -51,6 +51,6 @@ import 'node:crypto';
|
|
|
51
51
|
import 'assert';
|
|
52
52
|
import 'magic-string';
|
|
53
53
|
import 'strip-literal';
|
|
54
|
-
import './vendor/environments.
|
|
54
|
+
import './vendor/environments.hTqxBFDN.js';
|
|
55
55
|
import 'node:readline';
|
|
56
56
|
import 'readline';
|
|
@@ -861,6 +861,7 @@ declare class Vitest {
|
|
|
861
861
|
private _onClose;
|
|
862
862
|
private _onSetServer;
|
|
863
863
|
private _onCancelListeners;
|
|
864
|
+
private _poolClosePromise?;
|
|
864
865
|
setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
|
|
865
866
|
private createCoreProject;
|
|
866
867
|
getCoreWorkspaceProject(): WorkspaceProject;
|
|
@@ -1341,7 +1342,7 @@ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
|
|
|
1341
1342
|
provider?: T;
|
|
1342
1343
|
} & (CoverageV8Options));
|
|
1343
1344
|
/** Fields that have default values. Internally these will always be defined. */
|
|
1344
|
-
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal';
|
|
1345
|
+
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal' | 'processingConcurrency';
|
|
1345
1346
|
type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
1346
1347
|
reporter: CoverageReporterWithOptions[];
|
|
1347
1348
|
};
|
|
@@ -1450,6 +1451,11 @@ interface BaseCoverageOptions {
|
|
|
1450
1451
|
* @default false
|
|
1451
1452
|
*/
|
|
1452
1453
|
allowExternal?: boolean;
|
|
1454
|
+
/**
|
|
1455
|
+
* Concurrency limit used when processing the coverage results.
|
|
1456
|
+
* Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
|
|
1457
|
+
*/
|
|
1458
|
+
processingConcurrency?: number;
|
|
1453
1459
|
}
|
|
1454
1460
|
interface CoverageIstanbulOptions extends BaseCoverageOptions {
|
|
1455
1461
|
/**
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ay as BaseReporter, aq as BasicReporter, aC as BenchmarkBuiltinReporters, aB as BenchmarkReportsMap, aA as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, ax as HangingProcessReporter, av as JUnitReporter, as as JsonReporter, q as Reporter, az as ReportersMap, aw as TapFlatReporter, au as TapReporter, at as VerboseReporter } from './reporters-
|
|
1
|
+
export { ay as BaseReporter, aq as BasicReporter, aC as BenchmarkBuiltinReporters, aB as BenchmarkReportsMap, aA as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, ax as HangingProcessReporter, av as JUnitReporter, as as JsonReporter, q as Reporter, az as ReportersMap, aw as TapFlatReporter, au as TapReporter, at as VerboseReporter } from './reporters-LLiOBu3g.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig } from './reporters-LLiOBu3g.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-
|
|
3
|
+
import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-LLiOBu3g.js';
|
|
4
4
|
import { Options } from 'tinybench';
|
|
5
5
|
|
|
6
6
|
declare function getBenchOptions(key: Custom): Options;
|
package/dist/suite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
|
|
2
2
|
export { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
export { g as getBenchFn, a as getBenchOptions } from './suite-
|
|
4
|
-
import './reporters-
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './suite-SvxfaIxW.js';
|
|
4
|
+
import './reporters-LLiOBu3g.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -158,7 +158,7 @@ ${c.green(`vi.mock("${mockpath}", async () => {
|
|
|
158
158
|
return {
|
|
159
159
|
...actual,
|
|
160
160
|
// your mocked methods
|
|
161
|
-
}
|
|
161
|
+
}
|
|
162
162
|
})`)}
|
|
163
163
|
`
|
|
164
164
|
);
|
|
@@ -242,13 +242,32 @@ ${c.green(`vi.mock("${mockpath}", async () => {
|
|
|
242
242
|
if (!define(newContainer, property, isFunction ? value : {}))
|
|
243
243
|
continue;
|
|
244
244
|
if (isFunction) {
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
let mockFunction2 = function() {
|
|
246
|
+
if (this instanceof newContainer[property]) {
|
|
247
|
+
for (const { key } of getAllMockableProperties(this, false, primitives)) {
|
|
248
|
+
const value2 = this[key];
|
|
249
|
+
const type2 = getType(value2);
|
|
250
|
+
const isFunction2 = type2.includes("Function") && typeof value2 === "function";
|
|
251
|
+
if (isFunction2) {
|
|
252
|
+
const original = this[key];
|
|
253
|
+
const mock2 = spyModule.spyOn(this, key).mockImplementation(original);
|
|
254
|
+
mock2.mockRestore = () => {
|
|
255
|
+
mock2.mockReset();
|
|
256
|
+
mock2.mockImplementation(original);
|
|
257
|
+
return mock2;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
if (!this.spyModule)
|
|
247
264
|
throw this.createError("[vitest] `spyModule` is not defined. This is Vitest error. Please open a new issue with reproduction.");
|
|
248
|
-
const
|
|
265
|
+
const spyModule = this.spyModule;
|
|
266
|
+
const primitives = this.primitives;
|
|
267
|
+
const mock = spyModule.spyOn(newContainer, property).mockImplementation(mockFunction2);
|
|
249
268
|
mock.mockRestore = () => {
|
|
250
269
|
mock.mockReset();
|
|
251
|
-
mock.mockImplementation(
|
|
270
|
+
mock.mockImplementation(mockFunction2);
|
|
252
271
|
return mock;
|
|
253
272
|
};
|
|
254
273
|
Object.defineProperty(newContainer[property], "length", { value: 0 });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve, normalize } from 'pathe';
|
|
2
2
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
|
-
import { e as environments } from './environments.
|
|
3
|
+
import { e as environments } from './environments.hTqxBFDN.js';
|
|
4
4
|
|
|
5
5
|
function isBuiltinEnvironment(env) {
|
|
6
6
|
return env in environments;
|
|
@@ -43,7 +43,7 @@ import crypto, { createHash } from 'node:crypto';
|
|
|
43
43
|
import require$$0$3 from 'assert';
|
|
44
44
|
import MagicString from 'magic-string';
|
|
45
45
|
import { stripLiteral } from 'strip-literal';
|
|
46
|
-
import { g as getEnvPackageName } from './environments.
|
|
46
|
+
import { g as getEnvPackageName } from './environments.hTqxBFDN.js';
|
|
47
47
|
import readline from 'node:readline';
|
|
48
48
|
import require$$0$4 from 'readline';
|
|
49
49
|
|
|
@@ -62,7 +62,7 @@ function _mergeNamespaces(n, m) {
|
|
|
62
62
|
return Object.freeze(n);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
var version$1 = "1.0.
|
|
65
|
+
var version$1 = "1.0.1";
|
|
66
66
|
|
|
67
67
|
const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
|
|
68
68
|
async function ensurePackageInstalled(dependency, root) {
|
|
@@ -3741,8 +3741,6 @@ function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
|
|
|
3741
3741
|
workerPort.close();
|
|
3742
3742
|
}
|
|
3743
3743
|
}
|
|
3744
|
-
const Sequencer = ctx.config.sequence.sequencer;
|
|
3745
|
-
const sequencer = new Sequencer(ctx);
|
|
3746
3744
|
return async (specs, invalidates) => {
|
|
3747
3745
|
const configs = /* @__PURE__ */ new Map();
|
|
3748
3746
|
const getConfig = (project) => {
|
|
@@ -3752,10 +3750,6 @@ function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
|
|
|
3752
3750
|
configs.set(project, config);
|
|
3753
3751
|
return config;
|
|
3754
3752
|
};
|
|
3755
|
-
const { shard } = ctx.config;
|
|
3756
|
-
if (shard)
|
|
3757
|
-
specs = await sequencer.shard(specs);
|
|
3758
|
-
specs = await sequencer.sort(specs);
|
|
3759
3753
|
const filesByEnv = await groupFilesByEnv(specs);
|
|
3760
3754
|
const promises = Object.values(filesByEnv).flat();
|
|
3761
3755
|
const results = await Promise.allSettled(promises.map(({ file, environment, project }) => runFiles(project, getConfig(project), [file], environment, invalidates)));
|
|
@@ -4691,6 +4685,7 @@ class StateManager {
|
|
|
4691
4685
|
}
|
|
4692
4686
|
}
|
|
4693
4687
|
|
|
4688
|
+
var _a, _b;
|
|
4694
4689
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
4695
4690
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*"];
|
|
4696
4691
|
const benchmarkConfigDefaults = {
|
|
@@ -4728,7 +4723,8 @@ const coverageConfigDefaults = {
|
|
|
4728
4723
|
reportOnFailure: false,
|
|
4729
4724
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
4730
4725
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
|
|
4731
|
-
allowExternal: false
|
|
4726
|
+
allowExternal: false,
|
|
4727
|
+
processingConcurrency: Math.min(20, ((_b = (_a = nodeos__default).availableParallelism) == null ? void 0 : _b.call(_a)) ?? nodeos__default.cpus().length)
|
|
4732
4728
|
};
|
|
4733
4729
|
const fakeTimersDefaults = {
|
|
4734
4730
|
loopLimit: 1e4,
|
|
@@ -6287,7 +6283,7 @@ createLogUpdate(process$2.stdout);
|
|
|
6287
6283
|
|
|
6288
6284
|
createLogUpdate(process$2.stderr);
|
|
6289
6285
|
|
|
6290
|
-
var version = "1.0.
|
|
6286
|
+
var version = "1.0.1";
|
|
6291
6287
|
|
|
6292
6288
|
async function printError(error, project, options) {
|
|
6293
6289
|
const { showCodeFrame = true, fullStack = false, type } = options;
|
|
@@ -6918,7 +6914,10 @@ async function createBrowserServer(project, configFile) {
|
|
|
6918
6914
|
port: defaultBrowserPort
|
|
6919
6915
|
};
|
|
6920
6916
|
server2.middlewareMode = false;
|
|
6921
|
-
config.server =
|
|
6917
|
+
config.server = {
|
|
6918
|
+
...config.server,
|
|
6919
|
+
...server2
|
|
6920
|
+
};
|
|
6922
6921
|
(_b = config.server).fs ?? (_b.fs = {});
|
|
6923
6922
|
config.server.fs.allow = config.server.fs.allow || [];
|
|
6924
6923
|
config.server.fs.allow.push(
|
|
@@ -7607,6 +7606,7 @@ class Vitest {
|
|
|
7607
7606
|
_onClose = [];
|
|
7608
7607
|
_onSetServer = [];
|
|
7609
7608
|
_onCancelListeners = [];
|
|
7609
|
+
_poolClosePromise;
|
|
7610
7610
|
async setServer(options, server, cliOptions) {
|
|
7611
7611
|
var _a, _b, _c, _d;
|
|
7612
7612
|
(_a = this.unregisterWatcher) == null ? void 0 : _a.call(this);
|
|
@@ -7797,7 +7797,7 @@ class Vitest {
|
|
|
7797
7797
|
return Promise.all(this.projects.map((w) => w.initBrowserProvider()));
|
|
7798
7798
|
}
|
|
7799
7799
|
async start(filters) {
|
|
7800
|
-
var _a, _b;
|
|
7800
|
+
var _a, _b, _c;
|
|
7801
7801
|
this._onClose = [];
|
|
7802
7802
|
try {
|
|
7803
7803
|
await this.initCoverageProvider();
|
|
@@ -7823,6 +7823,8 @@ class Vitest {
|
|
|
7823
7823
|
await this.cache.stats.populateStats(this.config.root, files);
|
|
7824
7824
|
await this.runFiles(files);
|
|
7825
7825
|
}
|
|
7826
|
+
if (!this.config.watch && ((_c = this.pool) == null ? void 0 : _c.close))
|
|
7827
|
+
this._poolClosePromise = this.pool.close();
|
|
7826
7828
|
await this.reportCoverage(true);
|
|
7827
7829
|
if (this.config.watch)
|
|
7828
7830
|
await this.report("onWatcherStart");
|
|
@@ -8143,7 +8145,8 @@ class Vitest {
|
|
|
8143
8145
|
if (this.pool) {
|
|
8144
8146
|
closePromises.push((async () => {
|
|
8145
8147
|
var _a, _b;
|
|
8146
|
-
await ((_b = (_a = this.pool) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a));
|
|
8148
|
+
await (this._poolClosePromise || ((_b = (_a = this.pool) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a)));
|
|
8149
|
+
this._poolClosePromise = void 0;
|
|
8147
8150
|
this.pool = void 0;
|
|
8148
8151
|
})());
|
|
8149
8152
|
}
|
package/dist/vm.js
CHANGED
|
@@ -7,11 +7,11 @@ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
|
|
|
7
7
|
import { resolve } from 'pathe';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
9
|
import { distDir } from './paths.js';
|
|
10
|
-
import { l as loadEnvironment } from './vendor/loader
|
|
11
|
-
import { b as startVitestExecutor } from './vendor/execute.
|
|
10
|
+
import { l as loadEnvironment } from './vendor/loader.w8KTtIkD.js';
|
|
11
|
+
import { b as startVitestExecutor } from './vendor/execute.ILey0jnF.js';
|
|
12
12
|
import { createCustomConsole } from './chunks/runtime-console.hf2msWA9.js';
|
|
13
13
|
import { c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
14
|
-
import './vendor/environments.
|
|
14
|
+
import './vendor/environments.hTqxBFDN.js';
|
|
15
15
|
import 'node:console';
|
|
16
16
|
import 'local-pkg';
|
|
17
17
|
import 'vite-node/utils';
|
package/dist/worker.js
CHANGED
|
@@ -2,13 +2,13 @@ import { performance } from 'node:perf_hooks';
|
|
|
2
2
|
import { c as createBirpc } from './vendor/index.cAUulNDf.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
|
|
5
|
-
import { l as loadEnvironment } from './vendor/loader
|
|
6
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.
|
|
5
|
+
import { l as loadEnvironment } from './vendor/loader.w8KTtIkD.js';
|
|
6
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.ILey0jnF.js';
|
|
7
7
|
import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
|
|
8
8
|
import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
9
9
|
import 'pathe';
|
|
10
10
|
import 'vite-node/client';
|
|
11
|
-
import './vendor/environments.
|
|
11
|
+
import './vendor/environments.hTqxBFDN.js';
|
|
12
12
|
import 'node:console';
|
|
13
13
|
import 'local-pkg';
|
|
14
14
|
import 'node:url';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"@edge-runtime/vm": "*",
|
|
108
108
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
109
|
-
"@vitest/browser": "
|
|
110
|
-
"@vitest/ui": "
|
|
109
|
+
"@vitest/browser": "^1.0.0",
|
|
110
|
+
"@vitest/ui": "^1.0.0",
|
|
111
111
|
"happy-dom": "*",
|
|
112
112
|
"jsdom": "*"
|
|
113
113
|
},
|
|
@@ -147,12 +147,12 @@
|
|
|
147
147
|
"tinypool": "^0.8.1",
|
|
148
148
|
"vite": "^5.0.0-beta.19 || ^5.0.0",
|
|
149
149
|
"why-is-node-running": "^2.2.2",
|
|
150
|
-
"@vitest/expect": "1.0.
|
|
151
|
-
"@vitest/
|
|
152
|
-
"@vitest/spy": "1.0.
|
|
153
|
-
"@vitest/
|
|
154
|
-
"
|
|
155
|
-
"
|
|
150
|
+
"@vitest/expect": "1.0.1",
|
|
151
|
+
"@vitest/snapshot": "1.0.1",
|
|
152
|
+
"@vitest/spy": "1.0.1",
|
|
153
|
+
"@vitest/runner": "1.0.1",
|
|
154
|
+
"@vitest/utils": "1.0.1",
|
|
155
|
+
"vite-node": "1.0.1"
|
|
156
156
|
},
|
|
157
157
|
"devDependencies": {
|
|
158
158
|
"@ampproject/remapping": "^2.2.1",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
164
164
|
"@types/istanbul-reports": "^3.0.4",
|
|
165
165
|
"@types/jsdom": "^21.1.6",
|
|
166
|
-
"@types/micromatch": "^4.0.
|
|
166
|
+
"@types/micromatch": "^4.0.6",
|
|
167
167
|
"@types/prompts": "^2.4.8",
|
|
168
168
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
169
169
|
"birpc": "0.2.14",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"flatted": "^3.2.9",
|
|
176
176
|
"get-tsconfig": "^4.7.2",
|
|
177
177
|
"happy-dom": "^12.10.3",
|
|
178
|
-
"jsdom": "^
|
|
178
|
+
"jsdom": "^23.0.1",
|
|
179
179
|
"log-update": "^6.0.0",
|
|
180
180
|
"micromatch": "^4.0.5",
|
|
181
181
|
"p-limit": "^5.0.0",
|