vitest 0.24.0 → 0.24.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 +3 -3
- package/dist/browser.js +7 -7
- package/dist/{chunk-api-setup.33222ae9.js → chunk-api-setup.cdeaef6b.js} +5 -5
- package/dist/{chunk-install-pkg.107b0cd7.js → chunk-install-pkg.22707ee4.js} +3 -3
- package/dist/{chunk-integrations-globals.f50b2307.js → chunk-integrations-globals.10e6725a.js} +6 -6
- package/dist/{chunk-magic-string.cacfbf9d.js → chunk-magic-string.ffe2b171.js} +7 -2
- package/dist/{chunk-mock-date.b1b404e8.js → chunk-mock-date.9fe2b438.js} +3 -6
- package/dist/{chunk-node-git.6d82fb34.js → chunk-node-git.82174cfe.js} +4 -4
- package/dist/{chunk-runtime-chain.4dd0a07a.js → chunk-runtime-chain.072b5677.js} +5 -5
- package/dist/{chunk-runtime-error.38d92035.js → chunk-runtime-error.b043a88d.js} +14 -11
- package/dist/{chunk-runtime-hooks.72f95cdb.js → chunk-runtime-hooks.6963ff8f.js} +3 -3
- package/dist/{chunk-runtime-mocker.623b90b6.js → chunk-runtime-mocker.3eb1fcc0.js} +4 -4
- package/dist/{chunk-runtime-rpc.4f6f88e8.js → chunk-runtime-rpc.e583f5e7.js} +1 -1
- package/dist/{chunk-constants.22640ce4.js → chunk-utils-env.b1281522.js} +7 -3
- package/dist/{chunk-utils-source-map.175ffa40.js → chunk-utils-source-map.d9d36eb0.js} +2 -2
- package/dist/{chunk-vite-node-client.4dd32c96.js → chunk-vite-node-client.e22799cd.js} +2 -2
- package/dist/{chunk-vite-node-externalize.a2e9daf4.js → chunk-vite-node-externalize.02d922bf.js} +82 -13
- package/dist/{chunk-vite-node-utils.c8c74a41.js → chunk-vite-node-utils.835c8b2c.js} +1 -1
- package/dist/cli-wrapper.js +4 -4
- package/dist/cli.js +9 -9
- package/dist/config.d.ts +1 -1
- package/dist/entry.js +36 -24
- package/dist/environments.d.ts +1 -1
- package/dist/{global-6d79484b.d.ts → global-732f9b14.d.ts} +0 -4
- package/dist/{index-e0804ba8.d.ts → index-40e0cb97.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/loader.js +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +10 -10
- package/dist/suite.js +5 -5
- package/dist/{vendor-index.95542d0a.js → vendor-index.12d51d29.js} +0 -0
- package/dist/{vendor-index.8919d83a.js → vendor-index.1a291e86.js} +0 -0
- package/dist/{vendor-index.c902d578.js → vendor-index.9c919048.js} +0 -0
- package/dist/{vendor-index.07e6fc5a.js → vendor-index.cc8d244b.js} +2 -2
- package/dist/worker.js +6 -6
- package/index.d.cts +1 -0
- package/package.json +7 -6
- package/dist/chunk-vite-node-debug.77d9dcea.js +0 -76
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-
|
|
2
|
-
import { R as ResolvedConfig } from './global-
|
|
3
|
-
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-
|
|
1
|
+
export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-40e0cb97.js';
|
|
2
|
+
import { R as ResolvedConfig } from './global-732f9b14.js';
|
|
3
|
+
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-732f9b14.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
package/dist/browser.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.
|
|
3
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.
|
|
1
|
+
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.072b5677.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.6963ff8f.js';
|
|
3
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.b043a88d.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-mock-date.
|
|
8
|
+
import './chunk-mock-date.9fe2b438.js';
|
|
9
9
|
import 'path';
|
|
10
|
-
import './chunk-
|
|
10
|
+
import './chunk-utils-env.b1281522.js';
|
|
11
11
|
import 'tty';
|
|
12
12
|
import 'url';
|
|
13
13
|
import 'local-pkg';
|
|
14
14
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
15
|
-
import './chunk-runtime-rpc.
|
|
15
|
+
import './chunk-runtime-rpc.e583f5e7.js';
|
|
16
16
|
import './chunk-utils-timers.ab764c0c.js';
|
|
17
17
|
import 'fs';
|
|
18
|
-
import './chunk-utils-source-map.
|
|
18
|
+
import './chunk-utils-source-map.d9d36eb0.js';
|
|
19
19
|
import './spy.js';
|
|
20
20
|
import 'tinyspy';
|
|
21
21
|
import 'perf_hooks';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-client.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-client.e22799cd.js';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -9,17 +9,17 @@ import require$$2 from 'events';
|
|
|
9
9
|
import require$$1 from 'https';
|
|
10
10
|
import require$$2$1 from 'http';
|
|
11
11
|
import url from 'url';
|
|
12
|
-
import { A as API_PATH } from './chunk-
|
|
13
|
-
import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.
|
|
12
|
+
import { A as API_PATH } from './chunk-utils-env.b1281522.js';
|
|
13
|
+
import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.d9d36eb0.js';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-vite-node-utils.
|
|
16
|
+
import './chunk-vite-node-utils.835c8b2c.js';
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'assert';
|
|
19
19
|
import 'util';
|
|
20
20
|
import 'debug';
|
|
21
21
|
import 'tty';
|
|
22
|
-
import './chunk-mock-date.
|
|
22
|
+
import './chunk-mock-date.9fe2b438.js';
|
|
23
23
|
import 'local-pkg';
|
|
24
24
|
|
|
25
25
|
/*! (c) 2020 Andrea Giammarchi */
|
|
@@ -2,10 +2,10 @@ import fs$2 from 'fs';
|
|
|
2
2
|
import path$2 from 'path';
|
|
3
3
|
import util from 'util';
|
|
4
4
|
import childProcess$1 from 'child_process';
|
|
5
|
-
import { p as pathKey, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.
|
|
6
|
-
import { o as onetime$1 } from './vendor-index.
|
|
5
|
+
import { p as pathKey, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.12d51d29.js';
|
|
6
|
+
import { o as onetime$1 } from './vendor-index.9c919048.js';
|
|
7
7
|
import require$$0 from 'os';
|
|
8
|
-
import { s as signalExit } from './vendor-index.
|
|
8
|
+
import { s as signalExit } from './vendor-index.1a291e86.js';
|
|
9
9
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
10
10
|
import 'buffer';
|
|
11
11
|
import 'stream';
|
package/dist/{chunk-integrations-globals.f50b2307.js → chunk-integrations-globals.10e6725a.js}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as index } from './chunk-runtime-hooks.
|
|
1
|
+
import { m as globalApis } from './chunk-utils-env.b1281522.js';
|
|
2
|
+
import { i as index } from './chunk-runtime-hooks.6963ff8f.js';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|
|
6
|
-
import './chunk-runtime-chain.
|
|
6
|
+
import './chunk-runtime-chain.072b5677.js';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-mock-date.
|
|
8
|
+
import './chunk-mock-date.9fe2b438.js';
|
|
9
9
|
import 'local-pkg';
|
|
10
10
|
import 'chai';
|
|
11
11
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
12
|
+
import './chunk-runtime-rpc.e583f5e7.js';
|
|
13
13
|
import './chunk-utils-timers.ab764c0c.js';
|
|
14
14
|
import 'fs';
|
|
15
|
-
import './chunk-utils-source-map.
|
|
15
|
+
import './chunk-utils-source-map.d9d36eb0.js';
|
|
16
16
|
import './spy.js';
|
|
17
17
|
import 'tinyspy';
|
|
18
18
|
|
|
@@ -723,6 +723,11 @@ class MagicString {
|
|
|
723
723
|
}
|
|
724
724
|
|
|
725
725
|
overwrite(start, end, content, options) {
|
|
726
|
+
options = options || {};
|
|
727
|
+
return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
update(start, end, content, options) {
|
|
726
731
|
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
727
732
|
|
|
728
733
|
while (start < 0) start += this.original.length;
|
|
@@ -748,7 +753,7 @@ class MagicString {
|
|
|
748
753
|
options = { storeName: true };
|
|
749
754
|
}
|
|
750
755
|
const storeName = options !== undefined ? options.storeName : false;
|
|
751
|
-
const
|
|
756
|
+
const overwrite = options !== undefined ? options.overwrite : false;
|
|
752
757
|
|
|
753
758
|
if (storeName) {
|
|
754
759
|
const original = this.original.slice(start, end);
|
|
@@ -772,7 +777,7 @@ class MagicString {
|
|
|
772
777
|
chunk.edit('', false);
|
|
773
778
|
}
|
|
774
779
|
|
|
775
|
-
first.edit(content, storeName,
|
|
780
|
+
first.edit(content, storeName, !overwrite);
|
|
776
781
|
} else {
|
|
777
782
|
// must be inserting at the end
|
|
778
783
|
const newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { relative } from 'path';
|
|
2
|
-
import { r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-
|
|
2
|
+
import { i as isNode, a as isBrowser, r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.b1281522.js';
|
|
3
3
|
import { isPackageExists } from 'local-pkg';
|
|
4
4
|
|
|
5
5
|
const RealDate = Date;
|
|
@@ -218,9 +218,6 @@ function getWorkerState() {
|
|
|
218
218
|
return globalThis.__vitest_worker__;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
var _a;
|
|
222
|
-
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
223
|
-
const isBrowser = typeof window !== "undefined";
|
|
224
221
|
isNode && process.platform === "win32";
|
|
225
222
|
const getRunMode = () => getWorkerState().config.mode;
|
|
226
223
|
const isRunningInTest = () => getRunMode() === "test";
|
|
@@ -273,7 +270,7 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
273
270
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
274
271
|
});
|
|
275
272
|
if (install) {
|
|
276
|
-
await (await import('./chunk-install-pkg.
|
|
273
|
+
await (await import('./chunk-install-pkg.22707ee4.js')).installPackage(dependency, { dev: true });
|
|
277
274
|
process.stderr.write(picocolors.exports.yellow(`
|
|
278
275
|
Package ${dependency} installed, re-run the command to start.
|
|
279
276
|
`));
|
|
@@ -329,4 +326,4 @@ function createDefer() {
|
|
|
329
326
|
return p;
|
|
330
327
|
}
|
|
331
328
|
|
|
332
|
-
export { AggregateErrorPonyfill as A,
|
|
329
|
+
export { AggregateErrorPonyfill as A, deepMerge as B, ensurePackageInstalled as C, stdout as D, mergeSlashes as E, getAllMockableProperties as F, RealDate as R, resetModules as a, getCallLastIndex as b, getNames as c, assertTypes as d, getFullName as e, isRunningInTest as f, getWorkerState as g, isRunningInBenchmark as h, isObject as i, notNullish as j, deepClone as k, getType as l, mockDate as m, noop as n, relativePath as o, partitionSuiteChildren as p, shuffle as q, resetDate as r, slash as s, toArray as t, hasTests as u, hasFailed as v, createDefer as w, getTests as x, hasFailedSnapshot as y, getSuites as z };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { e as execa } from './vendor-index.
|
|
1
|
+
import { b as resolve } from './chunk-utils-env.b1281522.js';
|
|
2
|
+
import { e as execa } from './vendor-index.cc8d244b.js';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'buffer';
|
|
7
7
|
import 'child_process';
|
|
8
8
|
import 'process';
|
|
9
|
-
import './vendor-index.
|
|
9
|
+
import './vendor-index.12d51d29.js';
|
|
10
10
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
11
11
|
import 'fs';
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'os';
|
|
15
|
-
import './vendor-index.
|
|
15
|
+
import './vendor-index.1a291e86.js';
|
|
16
16
|
import 'assert';
|
|
17
17
|
import 'events';
|
|
18
18
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
|
-
import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.
|
|
2
|
+
import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.9fe2b438.js';
|
|
3
3
|
import * as chai$2 from 'chai';
|
|
4
4
|
import { expect, AssertionError, util } from 'chai';
|
|
5
5
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.e583f5e7.js';
|
|
7
7
|
import fs, { promises } from 'fs';
|
|
8
|
-
import { j as join, d as dirname, p as picocolors } from './chunk-
|
|
9
|
-
import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.
|
|
8
|
+
import { j as join, d as dirname, p as picocolors } from './chunk-utils-env.b1281522.js';
|
|
9
|
+
import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.d9d36eb0.js';
|
|
10
10
|
import { isMockFunction } from './spy.js';
|
|
11
11
|
import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.ab764c0c.js';
|
|
12
12
|
|
|
@@ -600,7 +600,7 @@ function deepMergeSnapshot(target, source) {
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
async function saveInlineSnapshots(snapshots) {
|
|
603
|
-
const MagicString = (await import('./chunk-magic-string.
|
|
603
|
+
const MagicString = (await import('./chunk-magic-string.ffe2b171.js')).default;
|
|
604
604
|
const files = new Set(snapshots.map((i) => i.file));
|
|
605
605
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
606
606
|
const map = await rpc().getSourceMap(file);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
2
|
import { t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.cca09977.js';
|
|
3
|
-
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.
|
|
4
|
-
import { k as deepClone, l as getType,
|
|
5
|
-
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getFn, n as setState, G as GLOBAL_EXPECT, o as getState } from './chunk-runtime-chain.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
3
|
+
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.6963ff8f.js';
|
|
4
|
+
import { k as deepClone, l as getType, g as getWorkerState, R as RealDate, t as toArray, o as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, q as shuffle, u as hasTests, v as hasFailed, w as createDefer, d as assertTypes, e as getFullName } from './chunk-mock-date.9fe2b438.js';
|
|
5
|
+
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getFn, n as setState, G as GLOBAL_EXPECT, o as getState } from './chunk-runtime-chain.072b5677.js';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.e583f5e7.js';
|
|
7
7
|
import util$1 from 'util';
|
|
8
8
|
import { util } from 'chai';
|
|
9
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
9
|
+
import { s as stringify } from './chunk-utils-source-map.d9d36eb0.js';
|
|
10
10
|
import { e as environments } from './chunk-env-node.700b7e95.js';
|
|
11
|
+
import { i as isNode, a as isBrowser } from './chunk-utils-env.b1281522.js';
|
|
11
12
|
import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.ab764c0c.js';
|
|
12
13
|
|
|
13
14
|
const OBJECT_PROTO = Object.getPrototypeOf({});
|
|
@@ -154,7 +155,7 @@ async function setupGlobalEnv(config) {
|
|
|
154
155
|
if (isNode)
|
|
155
156
|
await setupConsoleLogSpy();
|
|
156
157
|
if (config.globals)
|
|
157
|
-
(await import('./chunk-integrations-globals.
|
|
158
|
+
(await import('./chunk-integrations-globals.10e6725a.js')).registerApiGlobally();
|
|
158
159
|
}
|
|
159
160
|
function setupDefines(defines) {
|
|
160
161
|
for (const key in defines)
|
|
@@ -498,7 +499,7 @@ const callCleanupHooks = async (cleanups) => {
|
|
|
498
499
|
async function runTest(test) {
|
|
499
500
|
var _a, _b;
|
|
500
501
|
if (test.mode !== "run") {
|
|
501
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
502
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.072b5677.js').then(function (n) { return n.q; });
|
|
502
503
|
getSnapshotClient().skipTestSnapshots(test);
|
|
503
504
|
return;
|
|
504
505
|
}
|
|
@@ -514,7 +515,7 @@ async function runTest(test) {
|
|
|
514
515
|
updateTask(test);
|
|
515
516
|
clearModuleMocks();
|
|
516
517
|
if (isNode) {
|
|
517
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
518
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.072b5677.js').then(function (n) { return n.q; });
|
|
518
519
|
await getSnapshotClient().setTest(test);
|
|
519
520
|
}
|
|
520
521
|
const workerState = getWorkerState();
|
|
@@ -574,7 +575,7 @@ async function runTest(test) {
|
|
|
574
575
|
if (isBrowser && test.result.error)
|
|
575
576
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
576
577
|
if (isNode) {
|
|
577
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
578
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.072b5677.js').then(function (n) { return n.q; });
|
|
578
579
|
getSnapshotClient().clearTest();
|
|
579
580
|
}
|
|
580
581
|
test.result.duration = now() - start;
|
|
@@ -714,7 +715,9 @@ async function runBenchmarkSuite(suite) {
|
|
|
714
715
|
}
|
|
715
716
|
});
|
|
716
717
|
benchmark.task.addEventListener("error", (e) => {
|
|
717
|
-
|
|
718
|
+
const task = e.task;
|
|
719
|
+
const _benchmark = benchmarkMap[task.name || ""];
|
|
720
|
+
defer.reject(_benchmark ? task.result.error : e);
|
|
718
721
|
});
|
|
719
722
|
});
|
|
720
723
|
Promise.all(benchmarkGroup.map(async (benchmark) => {
|
|
@@ -777,7 +780,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
777
780
|
async function startTestsNode(paths, config) {
|
|
778
781
|
const files = await collectTests(paths, config);
|
|
779
782
|
rpc().onCollected(files);
|
|
780
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
783
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.072b5677.js').then(function (n) { return n.q; });
|
|
781
784
|
getSnapshotClient().clear();
|
|
782
785
|
await runFiles(files, config);
|
|
783
786
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.
|
|
2
|
-
import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.
|
|
3
|
-
import { p as parseStacktrace } from './chunk-utils-source-map.
|
|
1
|
+
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.072b5677.js';
|
|
2
|
+
import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.9fe2b438.js';
|
|
3
|
+
import { p as parseStacktrace } from './chunk-utils-source-map.d9d36eb0.js';
|
|
4
4
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
5
5
|
import util from 'util';
|
|
6
6
|
import { spyOn, fn, isMockFunction, spies } from './spy.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-client.
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-client.e22799cd.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { g as getWorkerState,
|
|
3
|
+
import { g as getWorkerState, E as mergeSlashes, s as slash, l as getType, F as getAllMockableProperties } from './chunk-mock-date.9fe2b438.js';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.
|
|
6
|
-
import { d as dirname, j as join,
|
|
5
|
+
import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.835c8b2c.js';
|
|
6
|
+
import { d as dirname, j as join, c as basename, l as extname, b as resolve, e as distDir } from './chunk-utils-env.b1281522.js';
|
|
7
7
|
|
|
8
8
|
class RefTracker {
|
|
9
9
|
constructor() {
|
|
@@ -246,8 +246,12 @@ const _path = /*#__PURE__*/Object.freeze({
|
|
|
246
246
|
..._path
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
const
|
|
249
|
+
var _a;
|
|
250
|
+
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
251
|
+
const isBrowser = typeof window !== "undefined";
|
|
252
|
+
|
|
253
|
+
const rootDir = isNode ? resolve(url.fileURLToPath(import.meta.url), "../../") : import.meta.url;
|
|
254
|
+
const distDir = isNode ? resolve(url.fileURLToPath(import.meta.url), "../../dist") : import.meta.url;
|
|
251
255
|
const defaultPort = 51204;
|
|
252
256
|
const EXIT_CODE_RESTART = 43;
|
|
253
257
|
const API_PATH = "/__vitest_api__";
|
|
@@ -281,4 +285,4 @@ const globalApis = [
|
|
|
281
285
|
"afterEach"
|
|
282
286
|
];
|
|
283
287
|
|
|
284
|
-
export { API_PATH as A, EXIT_CODE_RESTART as E,
|
|
288
|
+
export { API_PATH as A, EXIT_CODE_RESTART as E, isBrowser as a, resolve as b, basename as c, dirname as d, distDir as e, rootDir as f, isAbsolute as g, configFiles as h, isNode as i, join as j, defaultPort as k, extname as l, globalApis as m, normalize as n, picocolors as p, relative as r, toNamespacedPath as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as slash, j as notNullish } from './chunk-mock-date.
|
|
2
|
-
import { p as picocolors } from './chunk-
|
|
1
|
+
import { s as slash, j as notNullish } from './chunk-mock-date.9fe2b438.js';
|
|
2
|
+
import { p as picocolors } from './chunk-utils-env.b1281522.js';
|
|
3
3
|
|
|
4
4
|
var build = {};
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import {
|
|
5
|
-
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.
|
|
4
|
+
import { b as resolve, d as dirname, g as isAbsolute, l as extname } from './chunk-utils-env.b1281522.js';
|
|
5
|
+
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.835c8b2c.js';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
|
|
8
8
|
const debugExecute = createDebug("vite-node:client:execute");
|
package/dist/{chunk-vite-node-externalize.a2e9daf4.js → chunk-vite-node-externalize.02d922bf.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as resolve, p as picocolors, j as join, c as basename, d as dirname, e as distDir, f as rootDir, g as isAbsolute, r as relative, i as isNode, h as configFiles, k as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.b1281522.js';
|
|
2
2
|
import { p as pLimit, g as getCoverageProvider, C as CoverageProviderMap } from './chunk-integrations-coverage.cca09977.js';
|
|
3
3
|
import { g as getEnvPackageName } from './chunk-env-node.700b7e95.js';
|
|
4
|
-
import { A as AggregateErrorPonyfill, s as slash$2, o as
|
|
4
|
+
import { A as AggregateErrorPonyfill, s as slash$2, o as relativePath, x as getTests, e as getFullName, v as hasFailed, y as hasFailedSnapshot, z as getSuites, j as notNullish, q as shuffle, t as toArray$1, n as noop$1, B as deepMerge, b as getCallLastIndex, C as ensurePackageInstalled, D as stdout } from './chunk-mock-date.9fe2b438.js';
|
|
5
5
|
import { loadConfigFromFile, normalizePath, createServer, mergeConfig } from 'vite';
|
|
6
6
|
import path$a from 'path';
|
|
7
7
|
import url, { fileURLToPath } from 'url';
|
|
@@ -12,24 +12,24 @@ 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 { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.
|
|
15
|
+
import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.e22799cd.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, b as toFilePath, w as withInlineSourcemap } from './chunk-vite-node-utils.
|
|
18
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap } from './chunk-vite-node-utils.835c8b2c.js';
|
|
19
19
|
import { MessageChannel } from 'worker_threads';
|
|
20
20
|
import { Tinypool } from 'tinypool';
|
|
21
|
-
import { c as stripAnsi, d as cliTruncate, p as parseStacktrace, i as interpretSourcePos, e as stringWidth, h as ansiStyles, j as sliceAnsi, s as stringify$5, u as unifiedDiff, b as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.
|
|
21
|
+
import { c as stripAnsi, d as cliTruncate, p as parseStacktrace, i as interpretSourcePos, e as stringWidth, h as ansiStyles, j as sliceAnsi, s as stringify$5, u as unifiedDiff, b as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.d9d36eb0.js';
|
|
22
22
|
import { b as safeSetInterval, c as safeClearInterval, s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.ab764c0c.js';
|
|
23
23
|
import { resolveModule } from 'local-pkg';
|
|
24
24
|
import { createHash } from 'crypto';
|
|
25
|
-
import { o as onetime } from './vendor-index.
|
|
26
|
-
import { s as signalExit } from './vendor-index.
|
|
27
|
-
import MagicString from './chunk-magic-string.
|
|
25
|
+
import { o as onetime } from './vendor-index.9c919048.js';
|
|
26
|
+
import { s as signalExit } from './vendor-index.1a291e86.js';
|
|
27
|
+
import MagicString from './chunk-magic-string.ffe2b171.js';
|
|
28
28
|
import { stripLiteral } from 'strip-literal';
|
|
29
29
|
import require$$0$2 from 'readline';
|
|
30
30
|
import { p as prompts } from './vendor-index.9f20a9be.js';
|
|
31
31
|
|
|
32
|
-
var version$1 = "0.24.
|
|
32
|
+
var version$1 = "0.24.2";
|
|
33
33
|
|
|
34
34
|
class EndError extends Error {
|
|
35
35
|
constructor(value) {
|
|
@@ -6861,6 +6861,75 @@ function patchWindowsImportPath(path) {
|
|
|
6861
6861
|
return path;
|
|
6862
6862
|
}
|
|
6863
6863
|
|
|
6864
|
+
function hashCode(s) {
|
|
6865
|
+
return s.split("").reduce((a, b) => {
|
|
6866
|
+
a = (a << 5) - a + b.charCodeAt(0);
|
|
6867
|
+
return a & a;
|
|
6868
|
+
}, 0);
|
|
6869
|
+
}
|
|
6870
|
+
class Debugger {
|
|
6871
|
+
constructor(root, options) {
|
|
6872
|
+
this.options = options;
|
|
6873
|
+
this.externalizeMap = /* @__PURE__ */ new Map();
|
|
6874
|
+
if (options.dumpModules)
|
|
6875
|
+
this.dumpDir = resolve(root, options.dumpModules === true ? ".vite-node/dump" : options.dumpModules);
|
|
6876
|
+
if (this.dumpDir) {
|
|
6877
|
+
if (options.loadDumppedModules)
|
|
6878
|
+
console.info(picocolors.exports.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`));
|
|
6879
|
+
else
|
|
6880
|
+
console.info(picocolors.exports.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`));
|
|
6881
|
+
}
|
|
6882
|
+
this.initPromise = this.clearDump();
|
|
6883
|
+
}
|
|
6884
|
+
async clearDump() {
|
|
6885
|
+
if (!this.dumpDir)
|
|
6886
|
+
return;
|
|
6887
|
+
if (!this.options.loadDumppedModules && existsSync(this.dumpDir))
|
|
6888
|
+
await promises.rm(this.dumpDir, { recursive: true, force: true });
|
|
6889
|
+
await promises.mkdir(this.dumpDir, { recursive: true });
|
|
6890
|
+
}
|
|
6891
|
+
encodeId(id) {
|
|
6892
|
+
return `${id.replace(/[^\w@_-]/g, "_").replace(/_+/g, "_")}-${hashCode(id)}.js`;
|
|
6893
|
+
}
|
|
6894
|
+
async recordExternalize(id, path) {
|
|
6895
|
+
if (!this.dumpDir)
|
|
6896
|
+
return;
|
|
6897
|
+
this.externalizeMap.set(id, path);
|
|
6898
|
+
await this.writeInfo();
|
|
6899
|
+
}
|
|
6900
|
+
async dumpFile(id, result) {
|
|
6901
|
+
if (!result || !this.dumpDir)
|
|
6902
|
+
return;
|
|
6903
|
+
await this.initPromise;
|
|
6904
|
+
const name = this.encodeId(id);
|
|
6905
|
+
return await promises.writeFile(join(this.dumpDir, name), `// ${id.replace(/\0/g, "\\0")}
|
|
6906
|
+
${result.code}`, "utf-8");
|
|
6907
|
+
}
|
|
6908
|
+
async loadDump(id) {
|
|
6909
|
+
if (!this.dumpDir)
|
|
6910
|
+
return null;
|
|
6911
|
+
await this.initPromise;
|
|
6912
|
+
const name = this.encodeId(id);
|
|
6913
|
+
const path = join(this.dumpDir, name);
|
|
6914
|
+
if (!existsSync(path))
|
|
6915
|
+
return null;
|
|
6916
|
+
const code = await promises.readFile(path, "utf-8");
|
|
6917
|
+
return {
|
|
6918
|
+
code: code.replace(/^\/\/.*?\n/, ""),
|
|
6919
|
+
map: void 0
|
|
6920
|
+
};
|
|
6921
|
+
}
|
|
6922
|
+
async writeInfo() {
|
|
6923
|
+
if (!this.dumpDir)
|
|
6924
|
+
return;
|
|
6925
|
+
const info = JSON.stringify({
|
|
6926
|
+
time: new Date().toLocaleString(),
|
|
6927
|
+
externalize: Object.fromEntries(this.externalizeMap.entries())
|
|
6928
|
+
}, null, 2);
|
|
6929
|
+
return promises.writeFile(join(this.dumpDir, "info.json"), info, "utf-8");
|
|
6930
|
+
}
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6864
6933
|
const debugRequest = createDebug("vite-node:server:request");
|
|
6865
6934
|
const RealDate = Date;
|
|
6866
6935
|
class ViteNodeServer {
|
|
@@ -6889,7 +6958,7 @@ class ViteNodeServer {
|
|
|
6889
6958
|
}, options.debug ?? {});
|
|
6890
6959
|
}
|
|
6891
6960
|
if (options.debug)
|
|
6892
|
-
|
|
6961
|
+
this.debugger = new Debugger(server.config.root, options.debug);
|
|
6893
6962
|
}
|
|
6894
6963
|
shouldExternalize(id) {
|
|
6895
6964
|
return shouldExternalize(id, this.options.deps, this.externalizeCache);
|
|
@@ -9464,7 +9533,7 @@ createLogUpdate(process$1.stdout);
|
|
|
9464
9533
|
|
|
9465
9534
|
createLogUpdate(process$1.stderr);
|
|
9466
9535
|
|
|
9467
|
-
var version = "0.24.
|
|
9536
|
+
var version = "0.24.2";
|
|
9468
9537
|
|
|
9469
9538
|
function fileFromParsedStack(stack) {
|
|
9470
9539
|
var _a, _b;
|
|
@@ -9886,7 +9955,7 @@ class Vitest {
|
|
|
9886
9955
|
}
|
|
9887
9956
|
async filterTestsBySource(tests) {
|
|
9888
9957
|
if (this.config.changed && !this.config.related) {
|
|
9889
|
-
const { VitestGit } = await import('./chunk-node-git.
|
|
9958
|
+
const { VitestGit } = await import('./chunk-node-git.82174cfe.js');
|
|
9890
9959
|
const vitestGit = new VitestGit(this.config.root);
|
|
9891
9960
|
const related2 = await vitestGit.findChangedFiles({
|
|
9892
9961
|
changedSince: this.config.changed
|
|
@@ -10557,7 +10626,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
10557
10626
|
try {
|
|
10558
10627
|
await ctx.setServer(options, server);
|
|
10559
10628
|
if (options.api && options.watch)
|
|
10560
|
-
(await import('./chunk-api-setup.
|
|
10629
|
+
(await import('./chunk-api-setup.cdeaef6b.js')).setup(ctx);
|
|
10561
10630
|
} catch (err) {
|
|
10562
10631
|
ctx.logger.printError(err, true);
|
|
10563
10632
|
process.exit(1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pathToFileURL, fileURLToPath as fileURLToPath$1, URL as URL$1 } from 'url';
|
|
2
|
-
import {
|
|
2
|
+
import { b as resolve$1, r as relative } from './chunk-utils-env.b1281522.js';
|
|
3
3
|
import { builtinModules } from 'module';
|
|
4
4
|
import fs, { promises, statSync, existsSync, realpathSync, Stats } from 'fs';
|
|
5
5
|
import path from 'path';
|
package/dist/cli-wrapper.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-
|
|
3
|
-
import { e as execa } from './vendor-index.
|
|
2
|
+
import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.b1281522.js';
|
|
3
|
+
import { e as execa } from './vendor-index.cc8d244b.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'buffer';
|
|
7
7
|
import 'child_process';
|
|
8
8
|
import 'process';
|
|
9
|
-
import './vendor-index.
|
|
9
|
+
import './vendor-index.12d51d29.js';
|
|
10
10
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
11
11
|
import 'fs';
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'os';
|
|
15
|
-
import './vendor-index.
|
|
15
|
+
import './vendor-index.1a291e86.js';
|
|
16
16
|
import 'assert';
|
|
17
17
|
import 'events';
|
|
18
18
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { p as picocolors } from './chunk-utils-env.b1281522.js';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.02d922bf.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
6
6
|
import 'path';
|
|
@@ -8,7 +8,7 @@ import './chunk-integrations-coverage.cca09977.js';
|
|
|
8
8
|
import 'local-pkg';
|
|
9
9
|
import './chunk-env-node.700b7e95.js';
|
|
10
10
|
import 'console';
|
|
11
|
-
import './chunk-mock-date.
|
|
11
|
+
import './chunk-mock-date.9fe2b438.js';
|
|
12
12
|
import 'vite';
|
|
13
13
|
import 'process';
|
|
14
14
|
import 'fs';
|
|
@@ -16,21 +16,21 @@ import 'os';
|
|
|
16
16
|
import 'util';
|
|
17
17
|
import 'stream';
|
|
18
18
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
19
|
-
import './chunk-vite-node-client.
|
|
19
|
+
import './chunk-vite-node-client.e22799cd.js';
|
|
20
20
|
import 'module';
|
|
21
21
|
import 'vm';
|
|
22
|
-
import './chunk-vite-node-utils.
|
|
22
|
+
import './chunk-vite-node-utils.835c8b2c.js';
|
|
23
23
|
import 'assert';
|
|
24
24
|
import 'debug';
|
|
25
25
|
import 'perf_hooks';
|
|
26
26
|
import 'worker_threads';
|
|
27
27
|
import 'tinypool';
|
|
28
|
-
import './chunk-utils-source-map.
|
|
28
|
+
import './chunk-utils-source-map.d9d36eb0.js';
|
|
29
29
|
import './chunk-utils-timers.ab764c0c.js';
|
|
30
30
|
import 'crypto';
|
|
31
|
-
import './vendor-index.
|
|
32
|
-
import './vendor-index.
|
|
33
|
-
import './chunk-magic-string.
|
|
31
|
+
import './vendor-index.9c919048.js';
|
|
32
|
+
import './vendor-index.1a291e86.js';
|
|
33
|
+
import './chunk-magic-string.ffe2b171.js';
|
|
34
34
|
import 'strip-literal';
|
|
35
35
|
import 'readline';
|
|
36
36
|
import './vendor-index.9f20a9be.js';
|
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, ad as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './global-
|
|
3
|
+
import { U as UserConfig$1, ad as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './global-732f9b14.js';
|
|
4
4
|
import 'tinybench';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'worker_threads';
|
package/dist/entry.js
CHANGED
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { g as getWorkerState, a as resetModules } from './chunk-mock-date.
|
|
2
|
+
import { g as getWorkerState, a as resetModules } from './chunk-mock-date.9fe2b438.js';
|
|
3
3
|
import { a as envs } from './chunk-env-node.700b7e95.js';
|
|
4
|
-
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-error.
|
|
4
|
+
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-error.b043a88d.js';
|
|
5
5
|
import 'path';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-utils-env.b1281522.js';
|
|
7
7
|
import 'tty';
|
|
8
8
|
import 'url';
|
|
9
9
|
import 'local-pkg';
|
|
10
10
|
import 'console';
|
|
11
11
|
import 'perf_hooks';
|
|
12
12
|
import './chunk-integrations-coverage.cca09977.js';
|
|
13
|
-
import './chunk-runtime-hooks.
|
|
14
|
-
import './chunk-runtime-chain.
|
|
13
|
+
import './chunk-runtime-hooks.6963ff8f.js';
|
|
14
|
+
import './chunk-runtime-chain.072b5677.js';
|
|
15
15
|
import 'util';
|
|
16
16
|
import 'chai';
|
|
17
17
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
18
|
-
import './chunk-runtime-rpc.
|
|
18
|
+
import './chunk-runtime-rpc.e583f5e7.js';
|
|
19
19
|
import './chunk-utils-timers.ab764c0c.js';
|
|
20
|
-
import './chunk-utils-source-map.
|
|
20
|
+
import './chunk-utils-source-map.d9d36eb0.js';
|
|
21
21
|
import './spy.js';
|
|
22
22
|
import 'tinyspy';
|
|
23
23
|
|
|
24
|
+
function groupBy(collection, iteratee) {
|
|
25
|
+
return collection.reduce((acc, item) => {
|
|
26
|
+
const key = iteratee(item);
|
|
27
|
+
acc[key] || (acc[key] = []);
|
|
28
|
+
acc[key].push(item);
|
|
29
|
+
return acc;
|
|
30
|
+
}, {});
|
|
31
|
+
}
|
|
24
32
|
async function run(files, config) {
|
|
25
33
|
await setupGlobalEnv(config);
|
|
26
34
|
const workerState = getWorkerState();
|
|
@@ -30,19 +38,17 @@ async function run(files, config) {
|
|
|
30
38
|
return;
|
|
31
39
|
}
|
|
32
40
|
const filesWithEnv = await Promise.all(files.map(async (file) => {
|
|
33
|
-
var _a;
|
|
41
|
+
var _a, _b;
|
|
34
42
|
const code = await promises.readFile(file, "utf-8");
|
|
35
43
|
const env = ((_a = code.match(/@(?:vitest|jest)-environment\s+?([\w-]+)\b/)) == null ? void 0 : _a[1]) || config.environment || "node";
|
|
44
|
+
const envOptions = JSON.parse(((_b = code.match(/@(?:vitest|jest)-environment-options\s+?(.+)/)) == null ? void 0 : _b[1]) || "null");
|
|
36
45
|
return {
|
|
37
46
|
file,
|
|
38
|
-
env
|
|
47
|
+
env,
|
|
48
|
+
envOptions: envOptions ? { [env]: envOptions } : null
|
|
39
49
|
};
|
|
40
50
|
}));
|
|
41
|
-
const filesByEnv = filesWithEnv
|
|
42
|
-
acc[env] || (acc[env] = []);
|
|
43
|
-
acc[env].push(file);
|
|
44
|
-
return acc;
|
|
45
|
-
}, {});
|
|
51
|
+
const filesByEnv = groupBy(filesWithEnv, ({ env }) => env);
|
|
46
52
|
const orderedEnvs = envs.concat(
|
|
47
53
|
Object.keys(filesByEnv).filter((env) => !envs.includes(env))
|
|
48
54
|
);
|
|
@@ -51,17 +57,23 @@ async function run(files, config) {
|
|
|
51
57
|
const files2 = filesByEnv[environment];
|
|
52
58
|
if (!files2 || !files2.length)
|
|
53
59
|
continue;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
const filesByOptions = groupBy(files2, ({ envOptions }) => JSON.stringify(envOptions));
|
|
61
|
+
for (const options of Object.keys(filesByOptions)) {
|
|
62
|
+
const files3 = filesByOptions[options];
|
|
63
|
+
if (!files3 || !files3.length)
|
|
64
|
+
continue;
|
|
65
|
+
await withEnv(environment, files3[0].envOptions || config.environmentOptions || {}, async () => {
|
|
66
|
+
for (const { file } of files3) {
|
|
67
|
+
if (config.isolate) {
|
|
68
|
+
workerState.mockMap.clear();
|
|
69
|
+
resetModules(workerState.moduleCache, true);
|
|
70
|
+
}
|
|
71
|
+
workerState.filepath = file;
|
|
72
|
+
await startTests([file], config);
|
|
73
|
+
workerState.filepath = void 0;
|
|
59
74
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
workerState.filepath = void 0;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
79
|
|
package/dist/environments.d.ts
CHANGED
|
@@ -1220,10 +1220,6 @@ interface RuntimeContext {
|
|
|
1220
1220
|
currentSuite: SuiteCollector | null;
|
|
1221
1221
|
}
|
|
1222
1222
|
interface TestContext {
|
|
1223
|
-
/**
|
|
1224
|
-
* @deprecated Use promise instead
|
|
1225
|
-
*/
|
|
1226
|
-
(error?: any): void;
|
|
1227
1223
|
/**
|
|
1228
1224
|
* Metadata of the current test
|
|
1229
1225
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpyImpl } from 'tinyspy';
|
|
2
|
-
import { m as SuiteAPI, l as TestAPI, al as BenchmarkAPI, o as SuiteHooks, H as HookListener, s as TestContext, S as Suite, n as HookCleanupCallback, h as Test } from './global-
|
|
2
|
+
import { m as SuiteAPI, l as TestAPI, al as BenchmarkAPI, o as SuiteHooks, H as HookListener, s as TestContext, S as Suite, n as HookCleanupCallback, h as Test } from './global-732f9b14.js';
|
|
3
3
|
|
|
4
4
|
interface MockResultReturn<T> {
|
|
5
5
|
type: 'return';
|
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 { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-
|
|
3
|
-
import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-
|
|
4
|
-
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-
|
|
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-40e0cb97.js';
|
|
2
|
+
export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-40e0cb97.js';
|
|
3
|
+
import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-732f9b14.js';
|
|
4
|
+
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-732f9b14.js';
|
|
5
5
|
import { TransformResult } from 'vite';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.
|
|
1
|
+
export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.072b5677.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.6963ff8f.js';
|
|
3
3
|
import * as chai from 'chai';
|
|
4
4
|
export { chai };
|
|
5
5
|
export { assert, should } from 'chai';
|
|
6
6
|
import 'util';
|
|
7
|
-
import './chunk-mock-date.
|
|
7
|
+
import './chunk-mock-date.9fe2b438.js';
|
|
8
8
|
import 'path';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-utils-env.b1281522.js';
|
|
10
10
|
import 'tty';
|
|
11
11
|
import 'url';
|
|
12
12
|
import 'local-pkg';
|
|
13
13
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
14
|
-
import './chunk-runtime-rpc.
|
|
14
|
+
import './chunk-runtime-rpc.e583f5e7.js';
|
|
15
15
|
import './chunk-utils-timers.ab764c0c.js';
|
|
16
16
|
import 'fs';
|
|
17
|
-
import './chunk-utils-source-map.
|
|
17
|
+
import './chunk-utils-source-map.d9d36eb0.js';
|
|
18
18
|
import './spy.js';
|
|
19
19
|
import 'tinyspy';
|
package/dist/loader.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { pathToFileURL } from 'url';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
|
-
import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.
|
|
4
|
-
import { g as getWorkerState } from './chunk-mock-date.
|
|
5
|
-
import './chunk-
|
|
3
|
+
import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.835c8b2c.js';
|
|
4
|
+
import { g as getWorkerState } from './chunk-mock-date.9fe2b438.js';
|
|
5
|
+
import './chunk-utils-env.b1281522.js';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'path';
|
|
8
8
|
import 'module';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as VitestRunMode, U as UserConfig, t as Vitest, am as ModuleCacheMap, an as ViteNodeRunnerOptions, ao as MockMap, ap as ViteNodeRunner, aq as TestSequencer } from './global-
|
|
2
|
-
export { aq as TestSequencer, as as TestSequencerConstructor, t as Vitest, ar as startVitest } from './global-
|
|
1
|
+
import { c as VitestRunMode, U as UserConfig, t as Vitest, am as ModuleCacheMap, an as ViteNodeRunnerOptions, ao as MockMap, ap as ViteNodeRunner, aq as TestSequencer } from './global-732f9b14.js';
|
|
2
|
+
export { aq as TestSequencer, as as TestSequencerConstructor, t as Vitest, ar as startVitest } from './global-732f9b14.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,6 +1,6 @@
|
|
|
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.
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.02d922bf.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.3eb1fcc0.js';
|
|
3
|
+
import './chunk-utils-env.b1281522.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
6
6
|
import 'path';
|
|
@@ -8,7 +8,7 @@ import './chunk-integrations-coverage.cca09977.js';
|
|
|
8
8
|
import 'local-pkg';
|
|
9
9
|
import './chunk-env-node.700b7e95.js';
|
|
10
10
|
import 'console';
|
|
11
|
-
import './chunk-mock-date.
|
|
11
|
+
import './chunk-mock-date.9fe2b438.js';
|
|
12
12
|
import 'vite';
|
|
13
13
|
import 'process';
|
|
14
14
|
import 'fs';
|
|
@@ -17,21 +17,21 @@ import 'util';
|
|
|
17
17
|
import 'stream';
|
|
18
18
|
import 'events';
|
|
19
19
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
20
|
-
import './chunk-vite-node-client.
|
|
20
|
+
import './chunk-vite-node-client.e22799cd.js';
|
|
21
21
|
import 'module';
|
|
22
22
|
import 'vm';
|
|
23
|
-
import './chunk-vite-node-utils.
|
|
23
|
+
import './chunk-vite-node-utils.835c8b2c.js';
|
|
24
24
|
import 'assert';
|
|
25
25
|
import 'debug';
|
|
26
26
|
import 'perf_hooks';
|
|
27
27
|
import 'worker_threads';
|
|
28
28
|
import 'tinypool';
|
|
29
|
-
import './chunk-utils-source-map.
|
|
29
|
+
import './chunk-utils-source-map.d9d36eb0.js';
|
|
30
30
|
import './chunk-utils-timers.ab764c0c.js';
|
|
31
31
|
import 'crypto';
|
|
32
|
-
import './vendor-index.
|
|
33
|
-
import './vendor-index.
|
|
34
|
-
import './chunk-magic-string.
|
|
32
|
+
import './vendor-index.9c919048.js';
|
|
33
|
+
import './vendor-index.1a291e86.js';
|
|
34
|
+
import './chunk-magic-string.ffe2b171.js';
|
|
35
35
|
import 'strip-literal';
|
|
36
36
|
import 'readline';
|
|
37
37
|
import './vendor-index.9f20a9be.js';
|
package/dist/suite.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import 'util';
|
|
2
|
-
import './chunk-mock-date.
|
|
3
|
-
export { b as bench, f as clearCollectorContext, p as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
+
import './chunk-mock-date.9fe2b438.js';
|
|
3
|
+
export { b as bench, f as clearCollectorContext, p as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.072b5677.js';
|
|
4
4
|
import 'path';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-utils-env.b1281522.js';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'url';
|
|
8
8
|
import 'local-pkg';
|
|
9
9
|
import 'chai';
|
|
10
10
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
11
|
-
import './chunk-runtime-rpc.
|
|
11
|
+
import './chunk-runtime-rpc.e583f5e7.js';
|
|
12
12
|
import './chunk-utils-timers.ab764c0c.js';
|
|
13
13
|
import 'fs';
|
|
14
|
-
import './chunk-utils-source-map.
|
|
14
|
+
import './chunk-utils-source-map.d9d36eb0.js';
|
|
15
15
|
import './spy.js';
|
|
16
16
|
import 'tinyspy';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,10 +2,10 @@ import { Buffer } from 'buffer';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import childProcess from 'child_process';
|
|
4
4
|
import process$1 from 'process';
|
|
5
|
-
import { m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.
|
|
5
|
+
import { m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.12d51d29.js';
|
|
6
6
|
import url from 'url';
|
|
7
7
|
import require$$0, { constants } from 'os';
|
|
8
|
-
import { s as signalExit } from './vendor-index.
|
|
8
|
+
import { s as signalExit } from './vendor-index.1a291e86.js';
|
|
9
9
|
|
|
10
10
|
function stripFinalNewline(input) {
|
|
11
11
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
package/dist/worker.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.
|
|
1
|
+
import { b as resolve, e as distDir } from './chunk-utils-env.b1281522.js';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.e22799cd.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
|
-
import { g as getWorkerState } from './chunk-mock-date.
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
4
|
+
import { g as getWorkerState } from './chunk-mock-date.9fe2b438.js';
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.3eb1fcc0.js';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.e583f5e7.js';
|
|
7
7
|
import 'tty';
|
|
8
8
|
import 'url';
|
|
9
9
|
import 'path';
|
|
10
10
|
import 'module';
|
|
11
11
|
import 'vm';
|
|
12
|
-
import './chunk-vite-node-utils.
|
|
12
|
+
import './chunk-vite-node-utils.835c8b2c.js';
|
|
13
13
|
import 'fs';
|
|
14
14
|
import 'assert';
|
|
15
15
|
import 'util';
|
package/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/index.js'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.24.
|
|
4
|
+
"version": "0.24.2",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"dist",
|
|
68
68
|
"bin",
|
|
69
69
|
"*.d.ts",
|
|
70
|
+
"*.d.cts",
|
|
70
71
|
"*.mjs",
|
|
71
72
|
"*.cjs"
|
|
72
73
|
],
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
"debug": "^4.3.4",
|
|
106
107
|
"local-pkg": "^0.4.2",
|
|
107
108
|
"strip-literal": "^0.4.2",
|
|
108
|
-
"tinybench": "^2.
|
|
109
|
+
"tinybench": "^2.3.0",
|
|
109
110
|
"tinypool": "^0.3.0",
|
|
110
111
|
"tinyspy": "^1.0.2",
|
|
111
112
|
"vite": "^3.0.0"
|
|
@@ -118,9 +119,9 @@
|
|
|
118
119
|
"@types/jsdom": "^20.0.0",
|
|
119
120
|
"@types/micromatch": "^4.0.2",
|
|
120
121
|
"@types/natural-compare": "^1.4.1",
|
|
121
|
-
"@types/prompts": "^2.4.
|
|
122
|
+
"@types/prompts": "^2.4.1",
|
|
122
123
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
123
|
-
"@vitest/ui": "0.24.
|
|
124
|
+
"@vitest/ui": "0.24.2",
|
|
124
125
|
"birpc": "^0.2.3",
|
|
125
126
|
"cac": "^6.7.14",
|
|
126
127
|
"chai-subset": "^1.6.0",
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
"happy-dom": "^6.0.4",
|
|
135
136
|
"jsdom": "^20.0.1",
|
|
136
137
|
"log-update": "^5.0.1",
|
|
137
|
-
"magic-string": "^0.26.
|
|
138
|
+
"magic-string": "^0.26.7",
|
|
138
139
|
"micromatch": "^4.0.5",
|
|
139
140
|
"mlly": "^0.5.16",
|
|
140
141
|
"natural-compare": "^1.4.0",
|
|
@@ -148,7 +149,7 @@
|
|
|
148
149
|
"source-map-js": "^1.0.2",
|
|
149
150
|
"strip-ansi": "^7.0.1",
|
|
150
151
|
"typescript": "^4.8.4",
|
|
151
|
-
"vite-node": "0.24.
|
|
152
|
+
"vite-node": "0.24.2",
|
|
152
153
|
"ws": "^8.9.0"
|
|
153
154
|
},
|
|
154
155
|
"scripts": {
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { existsSync, promises } from 'fs';
|
|
2
|
-
import { a as resolve, p as picocolors, j as join } from './chunk-constants.22640ce4.js';
|
|
3
|
-
import 'tty';
|
|
4
|
-
import 'url';
|
|
5
|
-
import 'path';
|
|
6
|
-
|
|
7
|
-
function hashCode(s) {
|
|
8
|
-
return s.split("").reduce((a, b) => {
|
|
9
|
-
a = (a << 5) - a + b.charCodeAt(0);
|
|
10
|
-
return a & a;
|
|
11
|
-
}, 0);
|
|
12
|
-
}
|
|
13
|
-
class Debugger {
|
|
14
|
-
constructor(root, options) {
|
|
15
|
-
this.options = options;
|
|
16
|
-
this.externalizeMap = /* @__PURE__ */ new Map();
|
|
17
|
-
if (options.dumpModules)
|
|
18
|
-
this.dumpDir = resolve(root, options.dumpModules === true ? ".vite-node/dump" : options.dumpModules);
|
|
19
|
-
if (this.dumpDir) {
|
|
20
|
-
if (options.loadDumppedModules)
|
|
21
|
-
console.info(picocolors.exports.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`));
|
|
22
|
-
else
|
|
23
|
-
console.info(picocolors.exports.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`));
|
|
24
|
-
}
|
|
25
|
-
this.initPromise = this.clearDump();
|
|
26
|
-
}
|
|
27
|
-
async clearDump() {
|
|
28
|
-
if (!this.dumpDir)
|
|
29
|
-
return;
|
|
30
|
-
if (!this.options.loadDumppedModules && existsSync(this.dumpDir))
|
|
31
|
-
await promises.rm(this.dumpDir, { recursive: true, force: true });
|
|
32
|
-
await promises.mkdir(this.dumpDir, { recursive: true });
|
|
33
|
-
}
|
|
34
|
-
encodeId(id) {
|
|
35
|
-
return `${id.replace(/[^\w@_-]/g, "_").replace(/_+/g, "_")}-${hashCode(id)}.js`;
|
|
36
|
-
}
|
|
37
|
-
async recordExternalize(id, path) {
|
|
38
|
-
if (!this.dumpDir)
|
|
39
|
-
return;
|
|
40
|
-
this.externalizeMap.set(id, path);
|
|
41
|
-
await this.writeInfo();
|
|
42
|
-
}
|
|
43
|
-
async dumpFile(id, result) {
|
|
44
|
-
if (!result || !this.dumpDir)
|
|
45
|
-
return;
|
|
46
|
-
await this.initPromise;
|
|
47
|
-
const name = this.encodeId(id);
|
|
48
|
-
return await promises.writeFile(join(this.dumpDir, name), `// ${id.replace(/\0/g, "\\0")}
|
|
49
|
-
${result.code}`, "utf-8");
|
|
50
|
-
}
|
|
51
|
-
async loadDump(id) {
|
|
52
|
-
if (!this.dumpDir)
|
|
53
|
-
return null;
|
|
54
|
-
await this.initPromise;
|
|
55
|
-
const name = this.encodeId(id);
|
|
56
|
-
const path = join(this.dumpDir, name);
|
|
57
|
-
if (!existsSync(path))
|
|
58
|
-
return null;
|
|
59
|
-
const code = await promises.readFile(path, "utf-8");
|
|
60
|
-
return {
|
|
61
|
-
code: code.replace(/^\/\/.*?\n/, ""),
|
|
62
|
-
map: void 0
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async writeInfo() {
|
|
66
|
-
if (!this.dumpDir)
|
|
67
|
-
return;
|
|
68
|
-
const info = JSON.stringify({
|
|
69
|
-
time: new Date().toLocaleString(),
|
|
70
|
-
externalize: Object.fromEntries(this.externalizeMap.entries())
|
|
71
|
-
}, null, 2);
|
|
72
|
-
return promises.writeFile(join(this.dumpDir, "info.json"), info, "utf-8");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export { Debugger };
|