vitest 1.1.1 → 1.1.2
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/browser.js +1 -1
- package/dist/child.js +1 -1
- package/dist/chunks/{api-setup.jHV5vgr2.js → api-setup.mFKdEKxa.js} +27 -7
- package/dist/chunks/{integrations-globals.nOa2-o57.js → integrations-globals.tnKXwyh5.js} +2 -2
- package/dist/cli.js +2 -1
- package/dist/config.d.ts +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/entry-vm.js +2 -2
- package/dist/entry.js +2 -2
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +4 -4
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +2 -1
- package/dist/{reporters-O4LBziQ_.d.ts → reporters-xH8_lESK.d.ts} +1 -1
- package/dist/reporters.d.ts +1 -1
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +1 -1
- package/dist/{suite-dF4WyktM.d.ts → suite-GoqTeX8s.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{execute.vStuEOaI.js → execute.cedv4NLQ.js} +11 -7
- package/dist/vendor/{index.n6c6aC2Y.js → index.IhksUGLR.js} +1 -1
- package/dist/vendor/{node.d5m7SYoI.js → node.UBNKMR9Y.js} +100 -47
- package/dist/vendor/{vi.ciwVQ0al.js → vi.DTC--YO5.js} +4 -2
- package/dist/vm.js +1 -1
- package/dist/worker.js +1 -1
- package/package.json +8 -8
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-xH8_lESK.js';
|
|
3
3
|
import { VitestExecutor } from './execute.js';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
package/dist/browser.js
CHANGED
|
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
13
13
|
globalSetup = true;
|
|
14
14
|
setSafeTimers();
|
|
15
15
|
if (config.globals)
|
|
16
|
-
(await import('./chunks/integrations-globals.
|
|
16
|
+
(await import('./chunks/integrations-globals.tnKXwyh5.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
function setupDefines(defines) {
|
|
19
19
|
for (const key in defines)
|
package/dist/child.js
CHANGED
|
@@ -4,7 +4,7 @@ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
|
|
|
4
4
|
import { parseRegexp } from '@vitest/utils';
|
|
5
5
|
import { workerId } from 'tinypool';
|
|
6
6
|
import { l as loadEnvironment } from './vendor/loader.L9CYwKn1.js';
|
|
7
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.
|
|
7
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.cedv4NLQ.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';
|
|
@@ -12,6 +12,7 @@ import require$$3 from 'net';
|
|
|
12
12
|
import require$$4 from 'tls';
|
|
13
13
|
import require$$7 from 'url';
|
|
14
14
|
import { g as getDefaultExportFromCjs } from '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
15
|
+
import { isFileServingAllowed } from 'vite';
|
|
15
16
|
import { A as API_PATH } from '../vendor/constants.WSvnD_fn.js';
|
|
16
17
|
import '../vendor/index.XU72Rmy8.js';
|
|
17
18
|
import '@vitest/utils';
|
|
@@ -55,6 +56,19 @@ async function getModuleGraph(ctx, id) {
|
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
function cloneByOwnProperties(value) {
|
|
60
|
+
return Object.getOwnPropertyNames(value).reduce((clone, prop) => ({
|
|
61
|
+
...clone,
|
|
62
|
+
[prop]: value[prop]
|
|
63
|
+
}), {});
|
|
64
|
+
}
|
|
65
|
+
function stringifyReplace(key, value) {
|
|
66
|
+
if (value instanceof Error)
|
|
67
|
+
return cloneByOwnProperties(value);
|
|
68
|
+
else
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
/*! (c) 2020 Andrea Giammarchi */
|
|
59
73
|
|
|
60
74
|
const {parse: $parse, stringify: $stringify} = JSON;
|
|
@@ -4551,12 +4565,13 @@ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
|
4551
4565
|
|
|
4552
4566
|
var WebSocketServer$1 = /*@__PURE__*/getDefaultExportFromCjs(websocketServer);
|
|
4553
4567
|
|
|
4554
|
-
function setup(vitestOrWorkspace,
|
|
4568
|
+
function setup(vitestOrWorkspace, _server) {
|
|
4555
4569
|
var _a;
|
|
4556
4570
|
const ctx = "ctx" in vitestOrWorkspace ? vitestOrWorkspace.ctx : vitestOrWorkspace;
|
|
4557
4571
|
const wss = new WebSocketServer$1({ noServer: true });
|
|
4558
4572
|
const clients = /* @__PURE__ */ new Map();
|
|
4559
|
-
|
|
4573
|
+
const server = _server || ctx.server;
|
|
4574
|
+
(_a = server.httpServer) == null ? void 0 : _a.on("upgrade", (request, socket, head) => {
|
|
4560
4575
|
if (!request.url)
|
|
4561
4576
|
return;
|
|
4562
4577
|
const { pathname } = new URL(request.url, "http://localhost");
|
|
@@ -4567,6 +4582,10 @@ function setup(vitestOrWorkspace, server) {
|
|
|
4567
4582
|
setupClient(ws);
|
|
4568
4583
|
});
|
|
4569
4584
|
});
|
|
4585
|
+
function checkFileAccess(path) {
|
|
4586
|
+
if (!isFileServingAllowed(path, server))
|
|
4587
|
+
throw new Error(`Access denied to "${path}". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.`);
|
|
4588
|
+
}
|
|
4570
4589
|
function setupClient(ws) {
|
|
4571
4590
|
const rpc = createBirpc(
|
|
4572
4591
|
{
|
|
@@ -4605,7 +4624,8 @@ function setup(vitestOrWorkspace, server) {
|
|
|
4605
4624
|
return ctx.snapshot.resolveRawPath(testPath, rawPath);
|
|
4606
4625
|
},
|
|
4607
4626
|
async readSnapshotFile(snapshotPath) {
|
|
4608
|
-
|
|
4627
|
+
checkFileAccess(snapshotPath);
|
|
4628
|
+
if (!existsSync(snapshotPath))
|
|
4609
4629
|
return null;
|
|
4610
4630
|
return promises.readFile(snapshotPath, "utf-8");
|
|
4611
4631
|
},
|
|
@@ -4620,13 +4640,13 @@ function setup(vitestOrWorkspace, server) {
|
|
|
4620
4640
|
return promises.writeFile(id, content, "utf-8");
|
|
4621
4641
|
},
|
|
4622
4642
|
async saveSnapshotFile(id, content) {
|
|
4623
|
-
|
|
4624
|
-
throw new Error(`Snapshot file "${id}" does not exist.`);
|
|
4643
|
+
checkFileAccess(id);
|
|
4625
4644
|
await promises.mkdir(dirname(id), { recursive: true });
|
|
4626
4645
|
return promises.writeFile(id, content, "utf-8");
|
|
4627
4646
|
},
|
|
4628
4647
|
async removeSnapshotFile(id) {
|
|
4629
|
-
|
|
4648
|
+
checkFileAccess(id);
|
|
4649
|
+
if (!existsSync(id))
|
|
4630
4650
|
throw new Error(`Snapshot file "${id}" does not exist.`);
|
|
4631
4651
|
return promises.unlink(id);
|
|
4632
4652
|
},
|
|
@@ -4672,7 +4692,7 @@ function setup(vitestOrWorkspace, server) {
|
|
|
4672
4692
|
post: (msg) => ws.send(msg),
|
|
4673
4693
|
on: (fn) => ws.on("message", fn),
|
|
4674
4694
|
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
|
|
4675
|
-
serialize: stringify,
|
|
4695
|
+
serialize: (data) => stringify(data, stringifyReplace),
|
|
4676
4696
|
deserialize: parse$3
|
|
4677
4697
|
}
|
|
4678
4698
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as globalApis } from '../vendor/constants.WSvnD_fn.js';
|
|
2
|
-
import { i as index } from '../vendor/index.
|
|
2
|
+
import { i as index } from '../vendor/index.IhksUGLR.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import '../vendor/benchmark.WVm6DARl.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
@@ -9,7 +9,7 @@ import 'pathe';
|
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import '../vendor/global.L7JRz1qU.js';
|
|
11
11
|
import '../vendor/run-once.X3E7xx3F.js';
|
|
12
|
-
import '../vendor/vi.
|
|
12
|
+
import '../vendor/vi.DTC--YO5.js';
|
|
13
13
|
import 'chai';
|
|
14
14
|
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
15
15
|
import '@vitest/expect';
|
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.UBNKMR9Y.js';
|
|
5
5
|
import './vendor/index.XU72Rmy8.js';
|
|
6
6
|
import { d as divider } from './vendor/reporters.oUR9etwS.js';
|
|
7
7
|
import { t as toArray } from './vendor/base._79unx2z.js';
|
|
@@ -45,6 +45,7 @@ import '@vitest/runner/utils';
|
|
|
45
45
|
import 'node:crypto';
|
|
46
46
|
import 'assert';
|
|
47
47
|
import 'magic-string';
|
|
48
|
+
import '@vitest/utils/ast';
|
|
48
49
|
import 'strip-literal';
|
|
49
50
|
import './vendor/environments.QJtma9XQ.js';
|
|
50
51
|
import 'node:console';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserConfig, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { a as ResolvedCoverageOptions, C as CoverageV8Options, P as ProjectConfig } from './reporters-
|
|
3
|
+
import { a as ResolvedCoverageOptions, C as CoverageV8Options, P as ProjectConfig } from './reporters-xH8_lESK.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import 'vite-node';
|
|
6
6
|
import '@vitest/snapshot';
|
package/dist/coverage.d.ts
CHANGED
package/dist/entry-vm.js
CHANGED
|
@@ -8,7 +8,7 @@ import { setupColors, createColors } from '@vitest/utils';
|
|
|
8
8
|
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor/index.h0j9y5vy.js';
|
|
9
9
|
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor/coverage.v6aD8iAh.js';
|
|
10
10
|
import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
|
|
11
|
-
import { i as index } from './vendor/index.
|
|
11
|
+
import { i as index } from './vendor/index.IhksUGLR.js';
|
|
12
12
|
import { setupCommonEnv } from './browser.js';
|
|
13
13
|
import 'chai';
|
|
14
14
|
import '@vitest/snapshot/environment';
|
|
@@ -21,7 +21,7 @@ import '@vitest/runner/utils';
|
|
|
21
21
|
import './vendor/index.XU72Rmy8.js';
|
|
22
22
|
import 'std-env';
|
|
23
23
|
import './vendor/run-once.X3E7xx3F.js';
|
|
24
|
-
import './vendor/vi.
|
|
24
|
+
import './vendor/vi.DTC--YO5.js';
|
|
25
25
|
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
26
26
|
import '@vitest/expect';
|
|
27
27
|
import '@vitest/snapshot';
|
package/dist/entry.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests } from '@vitest/runner';
|
|
3
3
|
import './vendor/index.XU72Rmy8.js';
|
|
4
|
-
import { a as globalExpect, r as resetModules, v as vi } from './vendor/vi.
|
|
4
|
+
import { a as globalExpect, r as resetModules, v as vi } from './vendor/vi.DTC--YO5.js';
|
|
5
5
|
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor/coverage.v6aD8iAh.js';
|
|
6
6
|
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor/index.h0j9y5vy.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
@@ -10,7 +10,7 @@ import timers from 'node:timers';
|
|
|
10
10
|
import { isatty } from 'node:tty';
|
|
11
11
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
12
12
|
import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
|
|
13
|
-
import { i as index } from './vendor/index.
|
|
13
|
+
import { i as index } from './vendor/index.IhksUGLR.js';
|
|
14
14
|
import { setupCommonEnv } from './browser.js';
|
|
15
15
|
import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
|
|
16
16
|
import 'pathe';
|
package/dist/environments.d.ts
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-xH8_lESK.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import '@vitest/runner';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -53,12 +53,12 @@ declare class VitestMocker {
|
|
|
53
53
|
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
54
54
|
mockObject(object: Record<Key, any>, mockExports?: Record<Key, any>): Record<Key, any>;
|
|
55
55
|
unmockPath(path: string): void;
|
|
56
|
-
mockPath(originalId: string, path: string, external: string | null, factory
|
|
56
|
+
mockPath(originalId: string, path: string, external: string | null, factory: MockFactory | undefined, throwIfExists: boolean): void;
|
|
57
57
|
importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
|
|
58
58
|
importMock(rawId: string, importee: string): Promise<any>;
|
|
59
59
|
requestWithMock(url: string, callstack: string[]): Promise<any>;
|
|
60
|
-
queueMock(id: string, importer: string, factory?: MockFactory): void;
|
|
61
|
-
queueUnmock(id: string, importer: string): void;
|
|
60
|
+
queueMock(id: string, importer: string, factory?: MockFactory, throwIfCached?: boolean): void;
|
|
61
|
+
queueUnmock(id: string, importer: string, throwIfCached?: boolean): void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
interface ModuleEvaluateOptions {
|
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-GoqTeX8s.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-xH8_lESK.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-xH8_lESK.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/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
2
|
export { b as bench } from './vendor/benchmark.WVm6DARl.js';
|
|
3
3
|
export { i as isFirstRun, r as runOnce } from './vendor/run-once.X3E7xx3F.js';
|
|
4
|
-
export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.
|
|
5
|
-
import { d as dist } from './vendor/index.
|
|
6
|
-
export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor/index.
|
|
4
|
+
export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.DTC--YO5.js';
|
|
5
|
+
import { d as dist } from './vendor/index.IhksUGLR.js';
|
|
6
|
+
export { c as assertType, g as getRunningMode, a as inject, b as isWatchMode } from './vendor/index.IhksUGLR.js';
|
|
7
7
|
import * as chai from 'chai';
|
|
8
8
|
export { chai };
|
|
9
9
|
export { assert, should } from 'chai';
|
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-xH8_lESK.js';
|
|
2
|
+
export { l as BrowserProvider, k as BrowserProviderInitializationOptions, m as BrowserProviderOptions, i as ProcessPool, j as TestSequencerConstructor, s as startVitest } from './reporters-xH8_lESK.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.UBNKMR9Y.js';
|
|
2
2
|
import 'pathe';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'node:path';
|
|
@@ -50,6 +50,7 @@ import './vendor/tasks.IknbGB2n.js';
|
|
|
50
50
|
import 'node:crypto';
|
|
51
51
|
import 'assert';
|
|
52
52
|
import 'magic-string';
|
|
53
|
+
import '@vitest/utils/ast';
|
|
53
54
|
import 'strip-literal';
|
|
54
55
|
import './vendor/environments.QJtma9XQ.js';
|
|
55
56
|
import 'node:readline';
|
|
@@ -1223,6 +1223,7 @@ interface PendingSuiteMock {
|
|
|
1223
1223
|
id: string;
|
|
1224
1224
|
importer: string;
|
|
1225
1225
|
type: 'mock' | 'unmock';
|
|
1226
|
+
throwIfCached: boolean;
|
|
1226
1227
|
factory?: MockFactory;
|
|
1227
1228
|
}
|
|
1228
1229
|
|
|
@@ -2057,7 +2058,6 @@ interface InlineConfig {
|
|
|
2057
2058
|
api?: boolean | number | ApiConfig;
|
|
2058
2059
|
/**
|
|
2059
2060
|
* Enable Vitest UI
|
|
2060
|
-
* @internal
|
|
2061
2061
|
*/
|
|
2062
2062
|
ui?: boolean;
|
|
2063
2063
|
/**
|
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-xH8_lESK.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-xH8_lESK.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
package/dist/runners.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.DTC--YO5.js';
|
|
3
3
|
import './vendor/index.XU72Rmy8.js';
|
|
4
4
|
import { a as rpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
5
5
|
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
|
|
@@ -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-xH8_lESK.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-GoqTeX8s.js';
|
|
4
|
+
import './reporters-xH8_lESK.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -119,7 +119,7 @@ class VitestMocker {
|
|
|
119
119
|
if (mock.type === "unmock")
|
|
120
120
|
this.unmockPath(fsPath);
|
|
121
121
|
if (mock.type === "mock")
|
|
122
|
-
this.mockPath(mock.id, fsPath, external, mock.factory);
|
|
122
|
+
this.mockPath(mock.id, fsPath, external, mock.factory, mock.throwIfCached);
|
|
123
123
|
}));
|
|
124
124
|
VitestMocker.pendingIds = [];
|
|
125
125
|
}
|
|
@@ -298,9 +298,13 @@ ${c.green(`vi.mock("${mockpath}", async (importOriginal) => {
|
|
|
298
298
|
delete mock[id];
|
|
299
299
|
this.deleteCachedItem(id);
|
|
300
300
|
}
|
|
301
|
-
mockPath(originalId, path, external, factory) {
|
|
302
|
-
const suitefile = this.getSuiteFilepath();
|
|
301
|
+
mockPath(originalId, path, external, factory, throwIfExists) {
|
|
303
302
|
const id = this.normalizePath(path);
|
|
303
|
+
if (throwIfExists && this.moduleCache.has(id))
|
|
304
|
+
throw new Error(`[vitest] Cannot mock "${originalId}" because it is already loaded. Did you import it in a setup file?
|
|
305
|
+
|
|
306
|
+
Please, remove the import if you want static imports to be mocked, or clear module cache by calling "vi.resetModules()" before mocking if you are going to import the file again. See: https://vitest.dev/guide/common-errors.html#cannot-mock-mocked-file.js-because-it-is-already-loaded`);
|
|
307
|
+
const suitefile = this.getSuiteFilepath();
|
|
304
308
|
const mocks = this.mockMap.get(suitefile) || {};
|
|
305
309
|
const resolves = this.resolveCache.get(suitefile) || {};
|
|
306
310
|
mocks[id] = factory || this.resolveMockPath(path, external);
|
|
@@ -356,11 +360,11 @@ ${c.green(`vi.mock("${mockpath}", async (importOriginal) => {
|
|
|
356
360
|
if (typeof mock === "string" && !callstack.includes(mock))
|
|
357
361
|
return mock;
|
|
358
362
|
}
|
|
359
|
-
queueMock(id, importer, factory) {
|
|
360
|
-
VitestMocker.pendingIds.push({ type: "mock", id, importer, factory });
|
|
363
|
+
queueMock(id, importer, factory, throwIfCached = false) {
|
|
364
|
+
VitestMocker.pendingIds.push({ type: "mock", id, importer, factory, throwIfCached });
|
|
361
365
|
}
|
|
362
|
-
queueUnmock(id, importer) {
|
|
363
|
-
VitestMocker.pendingIds.push({ type: "unmock", id, importer });
|
|
366
|
+
queueUnmock(id, importer, throwIfCached = false) {
|
|
367
|
+
VitestMocker.pendingIds.push({ type: "unmock", id, importer, throwIfCached });
|
|
364
368
|
}
|
|
365
369
|
}
|
|
366
370
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
2
|
import { b as bench } from './benchmark.WVm6DARl.js';
|
|
3
3
|
import { i as isFirstRun, r as runOnce } from './run-once.X3E7xx3F.js';
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.DTC--YO5.js';
|
|
5
5
|
import { g as getWorkerState } from './global.L7JRz1qU.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
import { assert, should } from 'chai';
|
|
@@ -37,12 +37,13 @@ import { createRequire } from 'node:module';
|
|
|
37
37
|
import { isPackageExists, resolveModule } from 'local-pkg';
|
|
38
38
|
import { isCI, provider as provider$1 } from 'std-env';
|
|
39
39
|
import ge from 'module';
|
|
40
|
-
import { ancestor,
|
|
40
|
+
import { ancestor, findNodeAround } from 'acorn-walk';
|
|
41
41
|
import { generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks, hasFailed } from '@vitest/runner/utils';
|
|
42
42
|
import { R as ReportersMap, B as BenchmarkReportsMap, s as stripAnsi, a as ansiStyles, b as sliceAnsi, d as divider, F as F_POINTER, c as cliTruncate } from './reporters.oUR9etwS.js';
|
|
43
43
|
import crypto, { createHash } from 'node:crypto';
|
|
44
44
|
import require$$0$3 from 'assert';
|
|
45
45
|
import MagicString from 'magic-string';
|
|
46
|
+
import { esmWalker } from '@vitest/utils/ast';
|
|
46
47
|
import { stripLiteral } from 'strip-literal';
|
|
47
48
|
import { g as getEnvPackageName } from './environments.QJtma9XQ.js';
|
|
48
49
|
import readline from 'node:readline';
|
|
@@ -63,7 +64,7 @@ function _mergeNamespaces(n, m) {
|
|
|
63
64
|
return Object.freeze(n);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
var version$1 = "1.1.
|
|
67
|
+
var version$1 = "1.1.2";
|
|
67
68
|
|
|
68
69
|
const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
|
|
69
70
|
async function ensurePackageInstalled(dependency, root) {
|
|
@@ -3612,7 +3613,7 @@ function getWorkerMemoryLimit(config) {
|
|
|
3612
3613
|
var _a, _b, _c, _d;
|
|
3613
3614
|
const memoryLimit = (_b = (_a = config.poolOptions) == null ? void 0 : _a.vmThreads) == null ? void 0 : _b.memoryLimit;
|
|
3614
3615
|
if (memoryLimit)
|
|
3615
|
-
return
|
|
3616
|
+
return memoryLimit;
|
|
3616
3617
|
return 1 / (((_d = (_c = config.poolOptions) == null ? void 0 : _c.vmThreads) == null ? void 0 : _d.maxThreads) ?? getDefaultThreadsCount(config));
|
|
3617
3618
|
}
|
|
3618
3619
|
function stringToBytes(input, percentageReference) {
|
|
@@ -3661,7 +3662,7 @@ function stringToBytes(input, percentageReference) {
|
|
|
3661
3662
|
} else if (input > 1) {
|
|
3662
3663
|
return Math.floor(input);
|
|
3663
3664
|
} else {
|
|
3664
|
-
throw new Error('Unexpected numerical input for "
|
|
3665
|
+
throw new Error('Unexpected numerical input for "memoryLimit"');
|
|
3665
3666
|
}
|
|
3666
3667
|
}
|
|
3667
3668
|
return null;
|
|
@@ -3787,7 +3788,7 @@ function getMemoryLimit(config) {
|
|
|
3787
3788
|
config.watch ? memory / 2 : memory
|
|
3788
3789
|
);
|
|
3789
3790
|
}
|
|
3790
|
-
if (limit && limit > 1)
|
|
3791
|
+
if (typeof limit === "number" && limit > 1 || typeof limit === "string" && limit.at(-1) !== "%")
|
|
3791
3792
|
return stringToBytes(limit);
|
|
3792
3793
|
return null;
|
|
3793
3794
|
}
|
|
@@ -6479,7 +6480,7 @@ createLogUpdate(process$2.stdout);
|
|
|
6479
6480
|
|
|
6480
6481
|
createLogUpdate(process$2.stderr);
|
|
6481
6482
|
|
|
6482
|
-
var version = "1.1.
|
|
6483
|
+
var version = "1.1.2";
|
|
6483
6484
|
|
|
6484
6485
|
async function printError(error, project, options) {
|
|
6485
6486
|
const { showCodeFrame = true, fullStack = false, type } = options;
|
|
@@ -6884,6 +6885,14 @@ function transformImportSpecifiers(node) {
|
|
|
6884
6885
|
return "";
|
|
6885
6886
|
return `{ ${dynamicImports} }`;
|
|
6886
6887
|
}
|
|
6888
|
+
function getBetterEnd(code, node) {
|
|
6889
|
+
let end = node.end;
|
|
6890
|
+
if (code[node.end] === ";")
|
|
6891
|
+
end += 1;
|
|
6892
|
+
if (code[node.end + 1] === "\n")
|
|
6893
|
+
end += 1;
|
|
6894
|
+
return end;
|
|
6895
|
+
}
|
|
6887
6896
|
const regexpHoistable = /^[ \t]*\b(vi|vitest)\s*\.\s*(mock|unmock|hoisted)\(/m;
|
|
6888
6897
|
const regexpAssignedHoisted = /=[ \t]*(\bawait|)[ \t]*\b(vi|vitest)\s*\.\s*hoisted\(/;
|
|
6889
6898
|
const hashbangRE = /^#!.*\n/;
|
|
@@ -6904,52 +6913,85 @@ ${err.message}`);
|
|
|
6904
6913
|
const hoistIndex = ((_a = code.match(hashbangRE)) == null ? void 0 : _a[0].length) ?? 0;
|
|
6905
6914
|
let hoistedCode = "";
|
|
6906
6915
|
let hoistedVitestImports = "";
|
|
6916
|
+
let uid = 0;
|
|
6917
|
+
const idToImportMap = /* @__PURE__ */ new Map();
|
|
6907
6918
|
const transformImportDeclaration = (node) => {
|
|
6908
6919
|
const source = node.source.value;
|
|
6909
|
-
const
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
`;
|
|
6914
|
-
const specifiers = transformImportSpecifiers(node);
|
|
6915
|
-
if (specifiers) {
|
|
6916
|
-
if (namespace)
|
|
6917
|
-
code2 += `const ${specifiers} = ${namespace.local.name}
|
|
6918
|
-
`;
|
|
6919
|
-
else
|
|
6920
|
-
code2 += `const ${specifiers} = await import('${source}')
|
|
6920
|
+
const importId = `__vi_import_${uid++}__`;
|
|
6921
|
+
const hasSpecifiers = node.specifiers.length > 0;
|
|
6922
|
+
const code2 = hasSpecifiers ? `const ${importId} = await import('${source}')
|
|
6923
|
+
` : `await import('${source}')
|
|
6921
6924
|
`;
|
|
6922
|
-
|
|
6923
|
-
code2
|
|
6924
|
-
|
|
6925
|
-
}
|
|
6926
|
-
return code2;
|
|
6925
|
+
return {
|
|
6926
|
+
code: code2,
|
|
6927
|
+
id: importId
|
|
6928
|
+
};
|
|
6927
6929
|
};
|
|
6928
|
-
function
|
|
6929
|
-
s.remove(node.start, node.end);
|
|
6930
|
+
function defineImport(node) {
|
|
6930
6931
|
if (node.source.value === "vitest") {
|
|
6931
|
-
const
|
|
6932
|
+
const code2 = `const ${transformImportSpecifiers(node)} = await import('vitest')
|
|
6932
6933
|
`;
|
|
6933
|
-
hoistedVitestImports +=
|
|
6934
|
+
hoistedVitestImports += code2;
|
|
6935
|
+
s.remove(node.start, getBetterEnd(code2, node));
|
|
6934
6936
|
return;
|
|
6935
6937
|
}
|
|
6936
|
-
const
|
|
6937
|
-
|
|
6938
|
+
const declaration = transformImportDeclaration(node);
|
|
6939
|
+
if (!declaration)
|
|
6940
|
+
return null;
|
|
6941
|
+
s.appendLeft(hoistIndex, declaration.code);
|
|
6942
|
+
return declaration.id;
|
|
6938
6943
|
}
|
|
6939
6944
|
for (const node of ast.body) {
|
|
6940
|
-
if (node.type === "ImportDeclaration")
|
|
6941
|
-
|
|
6945
|
+
if (node.type === "ImportDeclaration") {
|
|
6946
|
+
const importId = defineImport(node);
|
|
6947
|
+
if (!importId)
|
|
6948
|
+
continue;
|
|
6949
|
+
s.remove(node.start, getBetterEnd(code, node));
|
|
6950
|
+
for (const spec of node.specifiers) {
|
|
6951
|
+
if (spec.type === "ImportSpecifier") {
|
|
6952
|
+
idToImportMap.set(
|
|
6953
|
+
spec.local.name,
|
|
6954
|
+
`${importId}.${spec.imported.name}`
|
|
6955
|
+
);
|
|
6956
|
+
} else if (spec.type === "ImportDefaultSpecifier") {
|
|
6957
|
+
idToImportMap.set(spec.local.name, `${importId}.default`);
|
|
6958
|
+
} else {
|
|
6959
|
+
idToImportMap.set(spec.local.name, importId);
|
|
6960
|
+
}
|
|
6961
|
+
}
|
|
6962
|
+
}
|
|
6942
6963
|
}
|
|
6943
|
-
|
|
6944
|
-
|
|
6964
|
+
const declaredConst = /* @__PURE__ */ new Set();
|
|
6965
|
+
esmWalker(ast, {
|
|
6966
|
+
onIdentifier(id2, info, parentStack) {
|
|
6967
|
+
const binding = idToImportMap.get(id2.name);
|
|
6968
|
+
if (!binding)
|
|
6969
|
+
return;
|
|
6970
|
+
if (info.hasBindingShortcut) {
|
|
6971
|
+
s.appendLeft(id2.end, `: ${binding}`);
|
|
6972
|
+
} else if (info.classDeclaration) {
|
|
6973
|
+
if (!declaredConst.has(id2.name)) {
|
|
6974
|
+
declaredConst.add(id2.name);
|
|
6975
|
+
const topNode = parentStack[parentStack.length - 2];
|
|
6976
|
+
s.prependRight(topNode.start, `const ${id2.name} = ${binding};
|
|
6977
|
+
`);
|
|
6978
|
+
}
|
|
6979
|
+
} else if (
|
|
6980
|
+
// don't transform class name identifier
|
|
6981
|
+
!info.classExpression
|
|
6982
|
+
) {
|
|
6983
|
+
s.update(id2.start, id2.end, binding);
|
|
6984
|
+
}
|
|
6985
|
+
},
|
|
6986
|
+
onCallExpression(node) {
|
|
6945
6987
|
var _a2, _b;
|
|
6946
|
-
const node = _node;
|
|
6947
6988
|
if (node.callee.type === "MemberExpression" && isIdentifier(node.callee.object) && (node.callee.object.name === "vi" || node.callee.object.name === "vitest") && isIdentifier(node.callee.property)) {
|
|
6948
6989
|
const methodName = node.callee.property.name;
|
|
6949
6990
|
if (methodName === "mock" || methodName === "unmock") {
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6991
|
+
const end = getBetterEnd(code, node);
|
|
6992
|
+
const nodeCode = code.slice(node.start, end);
|
|
6993
|
+
hoistedCode += `${nodeCode}${nodeCode.endsWith("\n") ? "" : "\n"}`;
|
|
6994
|
+
s.remove(node.start, end);
|
|
6953
6995
|
}
|
|
6954
6996
|
if (methodName === "hoisted") {
|
|
6955
6997
|
const declarationNode = (_a2 = findNodeAround(ast, node.start, "VariableDeclaration")) == null ? void 0 : _a2.node;
|
|
@@ -6959,13 +7001,15 @@ ${err.message}`);
|
|
|
6959
7001
|
};
|
|
6960
7002
|
const canMoveDeclaration = init && init.type === "CallExpression" && isViHoisted(init) || init && init.type === "AwaitExpression" && init.argument.type === "CallExpression" && isViHoisted(init.argument);
|
|
6961
7003
|
if (canMoveDeclaration) {
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
7004
|
+
const end = getBetterEnd(code, declarationNode);
|
|
7005
|
+
const nodeCode = code.slice(declarationNode.start, end);
|
|
7006
|
+
hoistedCode += `${nodeCode}${nodeCode.endsWith("\n") ? "" : "\n"}`;
|
|
7007
|
+
s.remove(declarationNode.start, end);
|
|
6965
7008
|
} else {
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
7009
|
+
const end = getBetterEnd(code, node);
|
|
7010
|
+
const nodeCode = code.slice(node.start, end);
|
|
7011
|
+
hoistedCode += `${nodeCode}${nodeCode.endsWith("\n") ? "" : "\n"}`;
|
|
7012
|
+
s.remove(node.start, end);
|
|
6969
7013
|
}
|
|
6970
7014
|
}
|
|
6971
7015
|
}
|
|
@@ -7136,7 +7180,7 @@ async function createBrowserServer(project, configFile) {
|
|
|
7136
7180
|
]
|
|
7137
7181
|
});
|
|
7138
7182
|
await server.listen();
|
|
7139
|
-
(await import('../chunks/api-setup.
|
|
7183
|
+
(await import('../chunks/api-setup.mFKdEKxa.js')).setup(project, server);
|
|
7140
7184
|
return server;
|
|
7141
7185
|
}
|
|
7142
7186
|
|
|
@@ -7843,7 +7887,9 @@ class Vitest {
|
|
|
7843
7887
|
const serverRestart = server.restart;
|
|
7844
7888
|
server.restart = async (...args) => {
|
|
7845
7889
|
await Promise.all(this._onRestartListeners.map((fn) => fn()));
|
|
7846
|
-
|
|
7890
|
+
await serverRestart(...args);
|
|
7891
|
+
this.unregisterWatcher();
|
|
7892
|
+
this.registerWatcher();
|
|
7847
7893
|
};
|
|
7848
7894
|
server.watcher.on("change", async (file) => {
|
|
7849
7895
|
file = normalize(file);
|
|
@@ -7851,6 +7897,8 @@ class Vitest {
|
|
|
7851
7897
|
if (isConfig) {
|
|
7852
7898
|
await Promise.all(this._onRestartListeners.map((fn) => fn("config")));
|
|
7853
7899
|
await serverRestart();
|
|
7900
|
+
this.unregisterWatcher();
|
|
7901
|
+
this.registerWatcher();
|
|
7854
7902
|
}
|
|
7855
7903
|
});
|
|
7856
7904
|
}
|
|
@@ -8300,8 +8348,13 @@ class Vitest {
|
|
|
8300
8348
|
return [id];
|
|
8301
8349
|
}
|
|
8302
8350
|
const projects = this.getModuleProjects(id);
|
|
8303
|
-
if (!projects.length)
|
|
8351
|
+
if (!projects.length) {
|
|
8352
|
+
if (this.state.filesMap.has(id) || this.projects.some((project) => project.isTestFile(id))) {
|
|
8353
|
+
this.changedTests.add(id);
|
|
8354
|
+
return [id];
|
|
8355
|
+
}
|
|
8304
8356
|
return [];
|
|
8357
|
+
}
|
|
8305
8358
|
const files = [];
|
|
8306
8359
|
for (const project of projects) {
|
|
8307
8360
|
const { server } = project;
|
|
@@ -8547,7 +8600,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
8547
8600
|
try {
|
|
8548
8601
|
await ctx.setServer(options, server, userConfig);
|
|
8549
8602
|
if (options.api && options.watch)
|
|
8550
|
-
(await import('../chunks/api-setup.
|
|
8603
|
+
(await import('../chunks/api-setup.mFKdEKxa.js')).setup(ctx);
|
|
8551
8604
|
} catch (err) {
|
|
8552
8605
|
await ctx.logger.printError(err, { fullStack: true });
|
|
8553
8606
|
process.exit(1);
|
|
@@ -3406,7 +3406,8 @@ function createVitest() {
|
|
|
3406
3406
|
_mocker.queueMock(
|
|
3407
3407
|
path,
|
|
3408
3408
|
importer,
|
|
3409
|
-
factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0
|
|
3409
|
+
factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0,
|
|
3410
|
+
true
|
|
3410
3411
|
);
|
|
3411
3412
|
},
|
|
3412
3413
|
unmock(path) {
|
|
@@ -3417,7 +3418,8 @@ function createVitest() {
|
|
|
3417
3418
|
_mocker.queueMock(
|
|
3418
3419
|
path,
|
|
3419
3420
|
importer,
|
|
3420
|
-
factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0
|
|
3421
|
+
factory ? () => factory(() => _mocker.importActual(path, importer, _mocker.getMockContext().callstack)) : void 0,
|
|
3422
|
+
false
|
|
3421
3423
|
);
|
|
3422
3424
|
},
|
|
3423
3425
|
doUnmock(path) {
|
package/dist/vm.js
CHANGED
|
@@ -8,7 +8,7 @@ import { resolve } from 'pathe';
|
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
9
|
import { distDir } from './paths.js';
|
|
10
10
|
import { l as loadEnvironment } from './vendor/loader.L9CYwKn1.js';
|
|
11
|
-
import { b as startVitestExecutor } from './vendor/execute.
|
|
11
|
+
import { b as startVitestExecutor } from './vendor/execute.cedv4NLQ.js';
|
|
12
12
|
import { createCustomConsole } from './chunks/runtime-console.hf2msWA9.js';
|
|
13
13
|
import { c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
14
14
|
import './vendor/environments.QJtma9XQ.js';
|
package/dist/worker.js
CHANGED
|
@@ -3,7 +3,7 @@ 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
5
|
import { l as loadEnvironment } from './vendor/loader.L9CYwKn1.js';
|
|
6
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.
|
|
6
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.cedv4NLQ.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';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
|
-
"acorn-walk": "^8.3.
|
|
135
|
+
"acorn-walk": "^8.3.1",
|
|
136
136
|
"cac": "^6.7.14",
|
|
137
137
|
"chai": "^4.3.10",
|
|
138
138
|
"debug": "^4.3.4",
|
|
@@ -147,12 +147,12 @@
|
|
|
147
147
|
"tinypool": "^0.8.1",
|
|
148
148
|
"vite": "^5.0.0",
|
|
149
149
|
"why-is-node-running": "^2.2.2",
|
|
150
|
-
"@vitest/
|
|
151
|
-
"@vitest/
|
|
152
|
-
"@vitest/
|
|
153
|
-
"@vitest/
|
|
154
|
-
"@vitest/
|
|
155
|
-
"vite-node": "1.1.
|
|
150
|
+
"@vitest/expect": "1.1.2",
|
|
151
|
+
"@vitest/runner": "1.1.2",
|
|
152
|
+
"@vitest/spy": "1.1.2",
|
|
153
|
+
"@vitest/utils": "1.1.2",
|
|
154
|
+
"@vitest/snapshot": "1.1.2",
|
|
155
|
+
"vite-node": "1.1.2"
|
|
156
156
|
},
|
|
157
157
|
"devDependencies": {
|
|
158
158
|
"@ampproject/remapping": "^2.2.1",
|