vitest 0.25.5 → 0.25.7
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 +3 -3
- package/dist/{chunk-api-setup.995f6ab7.js → chunk-api-setup.5669c9a4.js} +2 -2
- package/dist/{chunk-runtime-mocker.34e72575.js → chunk-runtime-mocker.bf08ae09.js} +8 -4
- package/dist/{chunk-vite-node-externalize.ca4784be.js → chunk-vite-node-externalize.5a3e0bdc.js} +15 -17
- package/dist/{chunk-vite-node-source-map.d0aa773d.js → chunk-vite-node-source-map.2b1f492a.js} +19 -15
- package/dist/{chunk-vite-node-utils.9047cb87.js → chunk-vite-node-utils.0e4a6a88.js} +1 -4
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/{index-2f15c9a8.d.ts → index-fde81ec3.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/loader.js +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.js +4 -4
- package/dist/{types-79a05dee.d.ts → types-c441ef31.d.ts} +8 -8
- package/dist/worker.js +3 -3
- package/package.json +5 -5
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-
|
|
2
|
-
import { b as ResolvedConfig } from './types-
|
|
3
|
-
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-
|
|
1
|
+
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-fde81ec3.js';
|
|
2
|
+
import { b as ResolvedConfig } from './types-c441ef31.js';
|
|
3
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-c441ef31.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-source-map.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-source-map.2b1f492a.js';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -12,7 +12,7 @@ import url from 'url';
|
|
|
12
12
|
import { A as API_PATH } from './chunk-utils-env.03f840f2.js';
|
|
13
13
|
import 'module';
|
|
14
14
|
import 'vm';
|
|
15
|
-
import './chunk-vite-node-utils.
|
|
15
|
+
import './chunk-vite-node-utils.0e4a6a88.js';
|
|
16
16
|
import 'acorn';
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'assert';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-source-map.
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-source-map.2b1f492a.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
3
|
import { g as getWorkerState, J as mergeSlashes, s as slash, x as getType, K as getAllMockableProperties } from './chunk-typecheck-constants.ed987901.js';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import {
|
|
5
|
+
import { c as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin } from './chunk-vite-node-utils.0e4a6a88.js';
|
|
6
6
|
import { p as picocolors, d as dirname, j as join, c as basename, l as extname, b as resolve, e as distDir } from './chunk-utils-env.03f840f2.js';
|
|
7
7
|
|
|
8
8
|
class RefTracker {
|
|
@@ -318,14 +318,18 @@ class VitestRunner extends ViteNodeRunner {
|
|
|
318
318
|
prepareContext(context) {
|
|
319
319
|
const request = context.__vite_ssr_import__;
|
|
320
320
|
const resolveId = context.__vitest_resolve_id__;
|
|
321
|
+
const resolveUrl = async (dep) => {
|
|
322
|
+
const [id, resolvedId] = await resolveId(dep);
|
|
323
|
+
return resolvedId || id;
|
|
324
|
+
};
|
|
321
325
|
const mocker = new VitestMocker(this.options, this.moduleCache, request);
|
|
322
326
|
const workerState = getWorkerState();
|
|
323
327
|
if (workerState.filepath && normalizePath(workerState.filepath) === normalizePath(context.__filename)) {
|
|
324
328
|
Object.defineProperty(context.__vite_ssr_import_meta__, "vitest", { get: () => globalThis.__vitest_index__ });
|
|
325
329
|
}
|
|
326
330
|
return Object.assign(context, {
|
|
327
|
-
__vite_ssr_import__: async (dep) => mocker.requestWithMock(await
|
|
328
|
-
__vite_ssr_dynamic_import__: async (dep) => mocker.requestWithMock(await
|
|
331
|
+
__vite_ssr_import__: async (dep) => mocker.requestWithMock(await resolveUrl(dep)),
|
|
332
|
+
__vite_ssr_dynamic_import__: async (dep) => mocker.requestWithMock(await resolveUrl(dep)),
|
|
329
333
|
__vitest_mocker__: mocker
|
|
330
334
|
});
|
|
331
335
|
}
|
package/dist/{chunk-vite-node-externalize.ca4784be.js → chunk-vite-node-externalize.5a3e0bdc.js}
RENAMED
|
@@ -12,10 +12,10 @@ import util$2 from 'util';
|
|
|
12
12
|
import require$$0$1 from 'stream';
|
|
13
13
|
import require$$2 from 'events';
|
|
14
14
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
15
|
-
import { w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-source-map.
|
|
15
|
+
import { w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-source-map.2b1f492a.js';
|
|
16
16
|
import { performance } from 'perf_hooks';
|
|
17
17
|
import createDebug from 'debug';
|
|
18
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, n as normalizeModuleId, b as toFilePath
|
|
18
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, n as normalizeModuleId, b as toFilePath } from './chunk-vite-node-utils.0e4a6a88.js';
|
|
19
19
|
import { writeFile, rm } from 'fs/promises';
|
|
20
20
|
import { e as execa } from './vendor-index.737c3cff.js';
|
|
21
21
|
import { SourceMapConsumer } from 'source-map';
|
|
@@ -35,7 +35,7 @@ import { stripLiteral } from 'strip-literal';
|
|
|
35
35
|
import require$$0$2 from 'readline';
|
|
36
36
|
import { p as prompts } from './vendor-index.9f20a9be.js';
|
|
37
37
|
|
|
38
|
-
var version$1 = "0.25.
|
|
38
|
+
var version$1 = "0.25.7";
|
|
39
39
|
|
|
40
40
|
class EndError extends Error {
|
|
41
41
|
constructor(value) {
|
|
@@ -7025,8 +7025,6 @@ class ViteNodeServer {
|
|
|
7025
7025
|
const module = this.server.moduleGraph.getModuleById(id);
|
|
7026
7026
|
const timestamp = module ? module.lastHMRTimestamp : null;
|
|
7027
7027
|
const cache = this.fetchCache.get(filePath);
|
|
7028
|
-
if (cache == null ? void 0 : cache.result.id)
|
|
7029
|
-
id = cache.result.id;
|
|
7030
7028
|
if (timestamp !== null && cache && cache.timestamp >= timestamp)
|
|
7031
7029
|
return cache.result;
|
|
7032
7030
|
const time = Date.now();
|
|
@@ -7036,16 +7034,10 @@ class ViteNodeServer {
|
|
|
7036
7034
|
result = { externalize };
|
|
7037
7035
|
(_a = this.debugger) == null ? void 0 : _a.recordExternalize(id, externalize);
|
|
7038
7036
|
} else {
|
|
7039
|
-
let file = module == null ? void 0 : module.file;
|
|
7040
|
-
if (!file) {
|
|
7041
|
-
const [, resolvedId] = await this.server.moduleGraph.resolveUrl(id, true);
|
|
7042
|
-
id = resolvedId;
|
|
7043
|
-
file = cleanUrl(resolvedId);
|
|
7044
|
-
}
|
|
7045
7037
|
const start = performance.now();
|
|
7046
7038
|
const r = await this._transformRequest(id);
|
|
7047
7039
|
duration = performance.now() - start;
|
|
7048
|
-
result = {
|
|
7040
|
+
result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map };
|
|
7049
7041
|
}
|
|
7050
7042
|
this.fetchCache.set(filePath, {
|
|
7051
7043
|
duration,
|
|
@@ -8735,7 +8727,7 @@ function escapeXML(value) {
|
|
|
8735
8727
|
);
|
|
8736
8728
|
}
|
|
8737
8729
|
function executionTime(durationMS) {
|
|
8738
|
-
return (durationMS / 1e3).toLocaleString(
|
|
8730
|
+
return (durationMS / 1e3).toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 10 });
|
|
8739
8731
|
}
|
|
8740
8732
|
function getDuration(task) {
|
|
8741
8733
|
var _a;
|
|
@@ -10215,7 +10207,7 @@ createLogUpdate(process$1.stdout);
|
|
|
10215
10207
|
|
|
10216
10208
|
createLogUpdate(process$1.stderr);
|
|
10217
10209
|
|
|
10218
|
-
var version = "0.25.
|
|
10210
|
+
var version = "0.25.7";
|
|
10219
10211
|
|
|
10220
10212
|
function fileFromParsedStack(stack) {
|
|
10221
10213
|
var _a, _b;
|
|
@@ -10527,6 +10519,7 @@ class Vitest {
|
|
|
10527
10519
|
this.restartsCount = 0;
|
|
10528
10520
|
this.runner = void 0;
|
|
10529
10521
|
this._onRestartListeners = [];
|
|
10522
|
+
this._onSetServer = [];
|
|
10530
10523
|
this.unregisterWatcher = noop$1;
|
|
10531
10524
|
this.logger = new Logger(this);
|
|
10532
10525
|
}
|
|
@@ -10579,6 +10572,7 @@ class Vitest {
|
|
|
10579
10572
|
await this.cache.results.readFromCache();
|
|
10580
10573
|
} catch {
|
|
10581
10574
|
}
|
|
10575
|
+
await Promise.all(this._onSetServer.map((fn) => fn()));
|
|
10582
10576
|
}
|
|
10583
10577
|
async initCoverageProvider() {
|
|
10584
10578
|
if (this.coverageProvider !== void 0)
|
|
@@ -10981,6 +10975,9 @@ class Vitest {
|
|
|
10981
10975
|
onServerRestart(fn) {
|
|
10982
10976
|
this._onRestartListeners.push(fn);
|
|
10983
10977
|
}
|
|
10978
|
+
onAfterSetServer(fn) {
|
|
10979
|
+
this._onSetServer.push(fn);
|
|
10980
|
+
}
|
|
10984
10981
|
}
|
|
10985
10982
|
|
|
10986
10983
|
function generateCssFilenameHash(filepath) {
|
|
@@ -11394,7 +11391,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11394
11391
|
try {
|
|
11395
11392
|
await ctx.setServer(options, server);
|
|
11396
11393
|
if (options.api && options.watch)
|
|
11397
|
-
(await import('./chunk-api-setup.
|
|
11394
|
+
(await import('./chunk-api-setup.5669c9a4.js')).setup(ctx);
|
|
11398
11395
|
} catch (err) {
|
|
11399
11396
|
ctx.logger.printError(err, true);
|
|
11400
11397
|
process.exit(1);
|
|
@@ -11562,8 +11559,9 @@ async function startVitest(mode, cliFilters, options, viteOverrides) {
|
|
|
11562
11559
|
ctx.report("onServerRestart", reason);
|
|
11563
11560
|
if (process.env.VITEST_CLI_WRAPPER)
|
|
11564
11561
|
process.exit(EXIT_CODE_RESTART);
|
|
11565
|
-
|
|
11566
|
-
|
|
11562
|
+
});
|
|
11563
|
+
ctx.onAfterSetServer(() => {
|
|
11564
|
+
ctx.start(cliFilters);
|
|
11567
11565
|
});
|
|
11568
11566
|
try {
|
|
11569
11567
|
await ctx.start(cliFilters);
|
package/dist/{chunk-vite-node-source-map.d0aa773d.js → chunk-vite-node-source-map.2b1f492a.js}
RENAMED
|
@@ -2,7 +2,7 @@ import { createRequire } from 'module';
|
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
4
|
import { b as resolve, d as dirname, g as isAbsolute, l as extname } from './chunk-utils-env.03f840f2.js';
|
|
5
|
-
import { s as slash,
|
|
5
|
+
import { s as slash, c as normalizeRequestId, b as toFilePath, d as cleanUrl, e as isPrimitive, i as isNodeBuiltin, n as normalizeModuleId } from './chunk-vite-node-utils.0e4a6a88.js';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
import './vendor-source-map-support.1ce17397.js';
|
|
8
8
|
|
|
@@ -176,9 +176,9 @@ class ViteNodeRunner {
|
|
|
176
176
|
async directRequest(id, fsPath, _callstack) {
|
|
177
177
|
const callstack = [..._callstack, fsPath];
|
|
178
178
|
let mod = this.moduleCache.get(fsPath);
|
|
179
|
-
const request = async (
|
|
179
|
+
const request = async (dep2) => {
|
|
180
180
|
var _a;
|
|
181
|
-
const depFsPath = toFilePath(normalizeRequestId(
|
|
181
|
+
const depFsPath = toFilePath(normalizeRequestId(dep2, this.options.base), this.root);
|
|
182
182
|
const getStack = () => {
|
|
183
183
|
return `stack:
|
|
184
184
|
${[...callstack, depFsPath].reverse().map((p) => `- ${p}`).join("\n")}`;
|
|
@@ -194,37 +194,40 @@ ${getStack()}`), 2e3);
|
|
|
194
194
|
return depExports;
|
|
195
195
|
throw new Error(`[vite-node] Failed to resolve circular dependency, ${getStack()}`);
|
|
196
196
|
}
|
|
197
|
-
return await this.cachedRequest(
|
|
197
|
+
return await this.cachedRequest(dep2, callstack);
|
|
198
198
|
} finally {
|
|
199
199
|
if (debugTimer)
|
|
200
200
|
clearTimeout(debugTimer);
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
Object.defineProperty(request, "callstack", { get: () => callstack });
|
|
204
|
-
const resolveId = async (
|
|
205
|
-
if (this.options.resolveId && this.shouldResolveId(
|
|
204
|
+
const resolveId = async (dep2, callstackPosition = 1) => {
|
|
205
|
+
if (this.options.resolveId && this.shouldResolveId(dep2)) {
|
|
206
206
|
let importer = callstack[callstack.length - callstackPosition];
|
|
207
|
+
if (importer && !dep2.startsWith("."))
|
|
208
|
+
importer = void 0;
|
|
207
209
|
if (importer && importer.startsWith("mock:"))
|
|
208
210
|
importer = importer.slice(5);
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
+
const resolved = await this.options.resolveId(normalizeRequestId(dep2), importer);
|
|
212
|
+
return [dep2, resolved == null ? void 0 : resolved.id];
|
|
211
213
|
}
|
|
212
|
-
return
|
|
214
|
+
return [dep2, void 0];
|
|
213
215
|
};
|
|
216
|
+
const [dep, resolvedId] = await resolveId(id, 2);
|
|
214
217
|
const requestStubs = this.options.requestStubs || DEFAULT_REQUEST_STUBS;
|
|
215
218
|
if (id in requestStubs)
|
|
216
219
|
return requestStubs[id];
|
|
217
|
-
let { code: transformed, externalize
|
|
218
|
-
if (
|
|
219
|
-
if (this.moduleCache.has(
|
|
220
|
-
mod = this.moduleCache.get(
|
|
220
|
+
let { code: transformed, externalize } = await this.options.fetchModule(resolvedId || dep);
|
|
221
|
+
if (resolvedId && !fsPath.includes("?") && fsPath !== resolvedId) {
|
|
222
|
+
if (this.moduleCache.has(resolvedId)) {
|
|
223
|
+
mod = this.moduleCache.get(resolvedId);
|
|
221
224
|
this.moduleCache.set(fsPath, mod);
|
|
222
225
|
if (mod.promise)
|
|
223
226
|
return mod.promise;
|
|
224
227
|
if (mod.exports)
|
|
225
228
|
return mod.exports;
|
|
226
229
|
} else {
|
|
227
|
-
this.moduleCache.set(
|
|
230
|
+
this.moduleCache.set(resolvedId, mod);
|
|
228
231
|
}
|
|
229
232
|
}
|
|
230
233
|
if (externalize) {
|
|
@@ -235,7 +238,8 @@ ${getStack()}`), 2e3);
|
|
|
235
238
|
}
|
|
236
239
|
if (transformed == null)
|
|
237
240
|
throw new Error(`[vite-node] Failed to load ${id}`);
|
|
238
|
-
const
|
|
241
|
+
const file = cleanUrl(resolvedId || fsPath);
|
|
242
|
+
const url = pathToFileURL(file).href;
|
|
239
243
|
const meta = { url };
|
|
240
244
|
const exports = /* @__PURE__ */ Object.create(null);
|
|
241
245
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
@@ -1334,9 +1334,6 @@ const isWindows = process.platform === "win32";
|
|
|
1334
1334
|
function slash(str) {
|
|
1335
1335
|
return str.replace(/\\/g, "/");
|
|
1336
1336
|
}
|
|
1337
|
-
function mergeSlashes(str) {
|
|
1338
|
-
return str.replace(/\/\//g, "/");
|
|
1339
|
-
}
|
|
1340
1337
|
function normalizeRequestId(id, base) {
|
|
1341
1338
|
if (base && id.startsWith(base))
|
|
1342
1339
|
id = `/${id.slice(base.length)}`;
|
|
@@ -1385,4 +1382,4 @@ function toArray(array) {
|
|
|
1385
1382
|
return [array];
|
|
1386
1383
|
}
|
|
1387
1384
|
|
|
1388
|
-
export { isValidNodeImport as a, toFilePath as b,
|
|
1385
|
+
export { isValidNodeImport as a, toFilePath as b, normalizeRequestId as c, cleanUrl as d, isPrimitive as e, hasCJSSyntax as h, isNodeBuiltin as i, normalizeModuleId as n, pathFromRoot as p, slash as s, toArray as t };
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as picocolors, n as normalize } from './chunk-utils-env.03f840f2.js';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.5a3e0bdc.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
6
6
|
import 'path';
|
|
@@ -16,10 +16,10 @@ import 'os';
|
|
|
16
16
|
import 'util';
|
|
17
17
|
import 'stream';
|
|
18
18
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
19
|
-
import './chunk-vite-node-source-map.
|
|
19
|
+
import './chunk-vite-node-source-map.2b1f492a.js';
|
|
20
20
|
import 'module';
|
|
21
21
|
import 'vm';
|
|
22
|
-
import './chunk-vite-node-utils.
|
|
22
|
+
import './chunk-vite-node-utils.0e4a6a88.js';
|
|
23
23
|
import 'acorn';
|
|
24
24
|
import 'assert';
|
|
25
25
|
import 'debug';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv } from 'vite';
|
|
3
|
-
import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-
|
|
3
|
+
import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-c441ef31.js';
|
|
4
4
|
import 'tinybench';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'worker_threads';
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpyImpl } from 'tinyspy';
|
|
2
|
-
import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-
|
|
2
|
+
import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-c441ef31.js';
|
|
3
3
|
|
|
4
4
|
declare type Not<T extends boolean> = T extends true ? false : true;
|
|
5
5
|
declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-
|
|
2
|
-
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-
|
|
3
|
-
import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-
|
|
4
|
-
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-
|
|
1
|
+
import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-fde81ec3.js';
|
|
2
|
+
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-fde81ec3.js';
|
|
3
|
+
import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-c441ef31.js';
|
|
4
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-c441ef31.js';
|
|
5
5
|
import { TransformResult } from 'vite';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
package/dist/loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pathToFileURL } from 'url';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
|
-
import { i as isNodeBuiltin, n as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.
|
|
3
|
+
import { i as isNodeBuiltin, n as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.0e4a6a88.js';
|
|
4
4
|
import { g as getWorkerState } from './chunk-typecheck-constants.ed987901.js';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import './chunk-utils-env.03f840f2.js';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as ModuleCacheMap, ay as ViteNodeRunnerOptions, az as MockMap, aA as ViteNodeRunner, aB as TestSequencer } from './types-
|
|
2
|
-
export { aB as TestSequencer, aD as TestSequencerConstructor, N as Vitest, aC as startVitest } from './types-
|
|
1
|
+
import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as ModuleCacheMap, ay as ViteNodeRunnerOptions, az as MockMap, aA as ViteNodeRunner, aB as TestSequencer } from './types-c441ef31.js';
|
|
2
|
+
export { aB as TestSequencer, aD as TestSequencerConstructor, N as Vitest, aC as startVitest } from './types-c441ef31.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
4
|
import 'tinybench';
|
|
5
5
|
import 'fs';
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.5a3e0bdc.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.bf08ae09.js';
|
|
3
3
|
import './chunk-utils-env.03f840f2.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
@@ -17,10 +17,10 @@ import 'util';
|
|
|
17
17
|
import 'stream';
|
|
18
18
|
import 'events';
|
|
19
19
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
20
|
-
import './chunk-vite-node-source-map.
|
|
20
|
+
import './chunk-vite-node-source-map.2b1f492a.js';
|
|
21
21
|
import 'module';
|
|
22
22
|
import 'vm';
|
|
23
|
-
import './chunk-vite-node-utils.
|
|
23
|
+
import './chunk-vite-node-utils.0e4a6a88.js';
|
|
24
24
|
import 'acorn';
|
|
25
25
|
import 'assert';
|
|
26
26
|
import 'debug';
|
|
@@ -211,6 +211,7 @@ interface CustomEventMap {
|
|
|
211
211
|
|
|
212
212
|
interface InvalidatePayload {
|
|
213
213
|
path: string
|
|
214
|
+
message: string | undefined
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
type InferCustomEventPayload<T extends string> =
|
|
@@ -228,22 +229,21 @@ interface ViteHotContext {
|
|
|
228
229
|
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
229
230
|
accept(
|
|
230
231
|
deps: readonly string[],
|
|
231
|
-
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
232
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
|
232
233
|
): void
|
|
233
234
|
|
|
234
|
-
acceptExports(exportNames: string | readonly string[]): void
|
|
235
235
|
acceptExports(
|
|
236
236
|
exportNames: string | readonly string[],
|
|
237
|
-
cb
|
|
237
|
+
cb?: (mod: ModuleNamespace | undefined) => void,
|
|
238
238
|
): void
|
|
239
239
|
|
|
240
240
|
dispose(cb: (data: any) => void): void
|
|
241
|
-
|
|
242
|
-
invalidate(): void
|
|
241
|
+
prune(cb: (data: any) => void): void
|
|
242
|
+
invalidate(message?: string): void
|
|
243
243
|
|
|
244
244
|
on<T extends string>(
|
|
245
245
|
event: T,
|
|
246
|
-
cb: (payload: InferCustomEventPayload<T>) => void
|
|
246
|
+
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
247
247
|
): void
|
|
248
248
|
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
|
249
249
|
}
|
|
@@ -323,8 +323,6 @@ interface FetchResult {
|
|
|
323
323
|
code?: string;
|
|
324
324
|
externalize?: string;
|
|
325
325
|
map?: RawSourceMap;
|
|
326
|
-
id?: string;
|
|
327
|
-
file?: string;
|
|
328
326
|
}
|
|
329
327
|
declare type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
|
|
330
328
|
declare type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
@@ -643,6 +641,7 @@ declare class Vitest {
|
|
|
643
641
|
runner: ViteNodeRunner;
|
|
644
642
|
constructor(mode: VitestRunMode);
|
|
645
643
|
private _onRestartListeners;
|
|
644
|
+
private _onSetServer;
|
|
646
645
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
647
646
|
initCoverageProvider(): Promise<CoverageProvider | null | undefined>;
|
|
648
647
|
getSerializableConfig(): ResolvedConfig;
|
|
@@ -674,6 +673,7 @@ declare class Vitest {
|
|
|
674
673
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
675
674
|
isInSourceTestFile(code: string): boolean;
|
|
676
675
|
onServerRestart(fn: OnServerRestartHandler): void;
|
|
676
|
+
onAfterSetServer(fn: OnServerRestartHandler): void;
|
|
677
677
|
}
|
|
678
678
|
|
|
679
679
|
declare type MockMap = Map<string, Record<string, string | null | (() => unknown)>>;
|
package/dist/worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { b as resolve, e as distDir } from './chunk-utils-env.03f840f2.js';
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-source-map.
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-source-map.2b1f492a.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { g as getWorkerState } from './chunk-typecheck-constants.ed987901.js';
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.bf08ae09.js';
|
|
6
6
|
import { r as rpc } from './chunk-runtime-rpc.42aebbb9.js';
|
|
7
7
|
import { p as processError } from './chunk-runtime-error.616e92ca.js';
|
|
8
8
|
import 'tty';
|
|
@@ -10,7 +10,7 @@ import 'url';
|
|
|
10
10
|
import 'path';
|
|
11
11
|
import 'module';
|
|
12
12
|
import 'vm';
|
|
13
|
-
import './chunk-vite-node-utils.
|
|
13
|
+
import './chunk-vite-node-utils.0e4a6a88.js';
|
|
14
14
|
import 'fs';
|
|
15
15
|
import 'acorn';
|
|
16
16
|
import 'assert';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.7",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"tinybench": "^2.3.1",
|
|
114
114
|
"tinypool": "^0.3.0",
|
|
115
115
|
"tinyspy": "^1.0.2",
|
|
116
|
-
"vite": "^3.0.0"
|
|
116
|
+
"vite": "^3.0.0 || ^4.0.0"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@antfu/install-pkg": "^0.1.1",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"@types/natural-compare": "^1.4.1",
|
|
126
126
|
"@types/prompts": "^2.4.1",
|
|
127
127
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
128
|
-
"@vitest/ui": "0.25.
|
|
128
|
+
"@vitest/ui": "0.25.7",
|
|
129
129
|
"birpc": "^0.2.3",
|
|
130
130
|
"cac": "^6.7.14",
|
|
131
131
|
"chai-subset": "^1.6.0",
|
|
@@ -148,13 +148,13 @@
|
|
|
148
148
|
"p-limit": "^4.0.0",
|
|
149
149
|
"pathe": "^0.2.0",
|
|
150
150
|
"picocolors": "^1.0.0",
|
|
151
|
-
"pkg-types": "^0.
|
|
151
|
+
"pkg-types": "^1.0.1",
|
|
152
152
|
"pretty-format": "^27.5.1",
|
|
153
153
|
"prompts": "^2.4.2",
|
|
154
154
|
"rollup": "^2.79.1",
|
|
155
155
|
"strip-ansi": "^7.0.1",
|
|
156
156
|
"typescript": "^4.8.4",
|
|
157
|
-
"vite-node": "0.25.
|
|
157
|
+
"vite-node": "0.25.7",
|
|
158
158
|
"ws": "^8.11.0"
|
|
159
159
|
},
|
|
160
160
|
"scripts": {
|