vitest 0.26.3 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -54
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +15 -15
- package/dist/{chunk-api-setup.47a09f0f.js → chunk-api-setup.16ac28c0.js} +9 -4
- package/dist/{chunk-integrations-coverage.befed097.js → chunk-integrations-coverage.44413252.js} +19 -1
- package/dist/chunk-integrations-globals.3dfaeb99.js +27 -0
- package/dist/{chunk-typecheck-constants.06e1fe5b.js → chunk-mock-date.a1c85759.js} +9 -27
- package/dist/{chunk-node-git.a90c0582.js → chunk-node-git.543e964a.js} +1 -2
- package/dist/{chunk-runtime-chain.f51aa930.js → chunk-runtime-chain.6df5a66b.js} +1191 -1027
- package/dist/{chunk-runtime-error.f5c8aaf2.js → chunk-runtime-error.fad2c32b.js} +2 -2
- package/dist/{chunk-runtime-mocker.887bf8c8.js → chunk-runtime-mocker.a677dd28.js} +8 -6
- package/dist/{chunk-runtime-rpc.54d72169.js → chunk-runtime-rpc.7f83c8a9.js} +2 -2
- package/dist/{chunk-runtime-setup.a06d5c72.js → chunk-runtime-setup.731b2b04.js} +51 -52
- package/dist/{chunk-snapshot-manager.70695b70.js → chunk-snapshot-manager.700322bf.js} +408 -272
- package/dist/{chunk-utils-env.3fdc1793.js → chunk-utils-env.b861e3a0.js} +1 -63
- package/dist/{chunk-utils-import.e7f64637.js → chunk-utils-import.2baa69a9.js} +22 -8
- package/dist/chunk-utils-source-map.60562959.js +408 -0
- package/dist/{chunk-utils-timers.715da787.js → chunk-utils-timers.52534f96.js} +2977 -3458
- package/dist/cli-wrapper.js +11 -11
- package/dist/cli.js +12 -624
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +2 -1
- package/dist/entry.js +14 -14
- package/dist/environments.d.ts +1 -1
- package/dist/{index-761e769b.d.ts → index-2d10c3fd.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +12 -12
- package/dist/loader.js +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +8 -8
- package/dist/spy.js +2 -102
- package/dist/suite.js +10 -10
- package/dist/{types-bae746aa.d.ts → types-e1e1d1e5.d.ts} +88 -76
- package/dist/vendor-index.723a074f.js +102 -0
- package/dist/worker.js +7 -7
- package/package.json +9 -5
- package/dist/chunk-integrations-globals.ee28730b.js +0 -27
- package/dist/chunk-utils-source-map.5278ee22.js +0 -86
package/dist/config.js
CHANGED
|
@@ -15,10 +15,11 @@ const defaultCoverageExcludes = [
|
|
|
15
15
|
"**/.{eslint,mocha,prettier}rc.{js,cjs,yml}"
|
|
16
16
|
];
|
|
17
17
|
const coverageConfigDefaults = {
|
|
18
|
+
all: false,
|
|
18
19
|
provider: "c8",
|
|
19
20
|
enabled: false,
|
|
20
21
|
clean: true,
|
|
21
|
-
cleanOnRerun:
|
|
22
|
+
cleanOnRerun: true,
|
|
22
23
|
reportsDirectory: "./coverage",
|
|
23
24
|
excludeNodeModules: true,
|
|
24
25
|
exclude: defaultCoverageExcludes,
|
package/dist/entry.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { promises } from 'node:fs';
|
|
2
|
-
import { g as getWorkerState, a as resetModules } from './chunk-
|
|
3
|
-
import { v as vi } from './chunk-utils-import.
|
|
2
|
+
import { g as getWorkerState, a as resetModules } from './chunk-mock-date.a1c85759.js';
|
|
3
|
+
import { v as vi } from './chunk-utils-import.2baa69a9.js';
|
|
4
4
|
import { a as envs } from './chunk-env-node.b3664da2.js';
|
|
5
|
-
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.
|
|
5
|
+
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.731b2b04.js';
|
|
6
6
|
import 'node:path';
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
7
|
+
import 'picocolors';
|
|
8
|
+
import 'local-pkg';
|
|
9
|
+
import './chunk-utils-env.b861e3a0.js';
|
|
9
10
|
import 'node:url';
|
|
10
11
|
import 'path';
|
|
11
|
-
import '
|
|
12
|
-
import './chunk-runtime-chain.f51aa930.js';
|
|
12
|
+
import './chunk-runtime-chain.6df5a66b.js';
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'chai';
|
|
15
15
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './
|
|
18
|
-
import './chunk-utils-source-map.5278ee22.js';
|
|
19
|
-
import 'fs';
|
|
20
|
-
import './spy.js';
|
|
16
|
+
import './chunk-utils-timers.52534f96.js';
|
|
17
|
+
import './vendor-index.723a074f.js';
|
|
21
18
|
import 'tinyspy';
|
|
19
|
+
import './chunk-utils-source-map.60562959.js';
|
|
20
|
+
import './chunk-runtime-rpc.7f83c8a9.js';
|
|
21
|
+
import 'fs';
|
|
22
22
|
import 'node:console';
|
|
23
23
|
import 'perf_hooks';
|
|
24
|
-
import './chunk-integrations-coverage.
|
|
25
|
-
import './chunk-runtime-error.
|
|
24
|
+
import './chunk-integrations-coverage.44413252.js';
|
|
25
|
+
import './chunk-runtime-error.fad2c32b.js';
|
|
26
26
|
import 'vite-node/source-map';
|
|
27
27
|
|
|
28
28
|
function groupBy(collection, iteratee) {
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpyImpl } from 'tinyspy';
|
|
2
|
-
import {
|
|
2
|
+
import { w as SuiteAPI, v as TestAPI, av as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, q as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, r as Test } from './types-e1e1d1e5.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, M as MockFactoryWithHelper, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, c as ModuleGraphData, d as Reporter } from './types-
|
|
4
|
-
export {
|
|
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-2d10c3fd.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-2d10c3fd.js';
|
|
3
|
+
import { D as DoneCallback, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, c as ModuleGraphData, d as Reporter } from './types-e1e1d1e5.js';
|
|
4
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ao as BaseCoverageOptions, au as BenchFunction, as as Benchmark, av as BenchmarkAPI, at as BenchmarkResult, ar as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, aq as CoverageC8Options, ap as CoverageIstanbulOptions, am as CoverageOptions, aj as CoverageProvider, ak as CoverageProviderModule, al as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, an as ResolvedCoverageOptions, h as RootAndTarget, m 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, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-e1e1d1e5.js';
|
|
5
5
|
import { TransformResult } from 'vite';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
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
|
-
import { e as dist } from './chunk-utils-import.
|
|
3
|
-
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-utils-import.
|
|
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.6df5a66b.js';
|
|
2
|
+
import { e as dist } from './chunk-utils-import.2baa69a9.js';
|
|
3
|
+
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-utils-import.2baa69a9.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-
|
|
8
|
+
import './chunk-mock-date.a1c85759.js';
|
|
9
9
|
import 'node:path';
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
10
|
+
import 'picocolors';
|
|
11
|
+
import 'local-pkg';
|
|
12
|
+
import './chunk-utils-env.b861e3a0.js';
|
|
12
13
|
import 'node:url';
|
|
13
14
|
import 'path';
|
|
14
|
-
import 'local-pkg';
|
|
15
15
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './
|
|
16
|
+
import './chunk-utils-timers.52534f96.js';
|
|
17
|
+
import './vendor-index.723a074f.js';
|
|
18
|
+
import 'tinyspy';
|
|
19
|
+
import './chunk-utils-source-map.60562959.js';
|
|
20
|
+
import './chunk-runtime-rpc.7f83c8a9.js';
|
|
18
21
|
import 'node:fs';
|
|
19
|
-
import './chunk-utils-source-map.5278ee22.js';
|
|
20
22
|
import 'fs';
|
|
21
|
-
import './spy.js';
|
|
22
|
-
import 'tinyspy';
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
package/dist/loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { i as isNodeBuiltin, h as hasCJSSyntax } from './vendor-index.2e96c50b.js';
|
|
4
4
|
import { normalizeModuleId } from 'vite-node/utils';
|
|
5
|
-
import { g as getWorkerState } from './chunk-
|
|
5
|
+
import { g as getWorkerState } from './chunk-mock-date.a1c85759.js';
|
|
6
6
|
import 'acorn';
|
|
7
7
|
import 'node:module';
|
|
8
8
|
import 'node:fs';
|
|
@@ -13,9 +13,9 @@ import 'module';
|
|
|
13
13
|
import 'assert';
|
|
14
14
|
import 'util';
|
|
15
15
|
import 'node:path';
|
|
16
|
-
import '
|
|
17
|
-
import 'tty';
|
|
16
|
+
import 'picocolors';
|
|
18
17
|
import 'local-pkg';
|
|
18
|
+
import './chunk-utils-env.b861e3a0.js';
|
|
19
19
|
|
|
20
20
|
var ModuleFormat = /* @__PURE__ */ ((ModuleFormat2) => {
|
|
21
21
|
ModuleFormat2["Builtin"] = "builtin";
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as VitestRunMode, U as UserConfig,
|
|
2
|
-
export {
|
|
1
|
+
import { k as VitestRunMode, U as UserConfig, N as Vitest, aw as MockFactory, ax as MockMap, ay as TestSequencer } from './types-e1e1d1e5.js';
|
|
2
|
+
export { ay as TestSequencer, aA as TestSequencerConstructor, N as Vitest, az as startVitest } from './types-e1e1d1e5.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
4
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
5
5
|
import { ViteNodeRunnerOptions } from 'vite-node';
|
package/dist/node.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-snapshot-manager.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
3
|
-
import './chunk-utils-env.
|
|
4
|
-
import 'tty';
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-snapshot-manager.700322bf.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.a677dd28.js';
|
|
3
|
+
import './chunk-utils-env.b861e3a0.js';
|
|
5
4
|
import 'node:url';
|
|
6
5
|
import 'path';
|
|
7
|
-
import './chunk-integrations-coverage.
|
|
6
|
+
import './chunk-integrations-coverage.44413252.js';
|
|
8
7
|
import 'local-pkg';
|
|
9
8
|
import './chunk-env-node.b3664da2.js';
|
|
10
9
|
import 'node:console';
|
|
11
|
-
import './chunk-
|
|
10
|
+
import './chunk-mock-date.a1c85759.js';
|
|
12
11
|
import 'node:path';
|
|
12
|
+
import 'picocolors';
|
|
13
13
|
import 'vite';
|
|
14
14
|
import 'node:process';
|
|
15
15
|
import 'node:fs';
|
|
@@ -38,8 +38,8 @@ import 'node:worker_threads';
|
|
|
38
38
|
import 'tinypool';
|
|
39
39
|
import './vendor-index.783e7f3e.js';
|
|
40
40
|
import 'perf_hooks';
|
|
41
|
-
import './chunk-utils-
|
|
42
|
-
import './chunk-utils-
|
|
41
|
+
import './chunk-utils-source-map.60562959.js';
|
|
42
|
+
import './chunk-utils-timers.52534f96.js';
|
|
43
43
|
import 'crypto';
|
|
44
44
|
import 'vite-node/utils';
|
|
45
45
|
import './vendor-index.9c919048.js';
|
package/dist/spy.js
CHANGED
|
@@ -1,102 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const spies = /* @__PURE__ */ new Set();
|
|
4
|
-
function isMockFunction(fn2) {
|
|
5
|
-
return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
|
|
6
|
-
}
|
|
7
|
-
function spyOn(obj, method, accessType) {
|
|
8
|
-
const dictionary = {
|
|
9
|
-
get: "getter",
|
|
10
|
-
set: "setter"
|
|
11
|
-
};
|
|
12
|
-
const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
|
|
13
|
-
const stub = tinyspy.spyOn(obj, objMethod);
|
|
14
|
-
return enhanceSpy(stub);
|
|
15
|
-
}
|
|
16
|
-
let callOrder = 0;
|
|
17
|
-
function enhanceSpy(spy) {
|
|
18
|
-
const stub = spy;
|
|
19
|
-
let implementation;
|
|
20
|
-
let instances = [];
|
|
21
|
-
let invocations = [];
|
|
22
|
-
const mockContext = {
|
|
23
|
-
get calls() {
|
|
24
|
-
return stub.calls;
|
|
25
|
-
},
|
|
26
|
-
get instances() {
|
|
27
|
-
return instances;
|
|
28
|
-
},
|
|
29
|
-
get invocationCallOrder() {
|
|
30
|
-
return invocations;
|
|
31
|
-
},
|
|
32
|
-
get results() {
|
|
33
|
-
return stub.results.map(([callType, value]) => {
|
|
34
|
-
const type = callType === "error" ? "throw" : "return";
|
|
35
|
-
return { type, value };
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
get lastCall() {
|
|
39
|
-
return stub.calls[stub.calls.length - 1];
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
let onceImplementations = [];
|
|
43
|
-
let name = stub.name;
|
|
44
|
-
stub.getMockName = () => name || "vi.fn()";
|
|
45
|
-
stub.mockName = (n) => {
|
|
46
|
-
name = n;
|
|
47
|
-
return stub;
|
|
48
|
-
};
|
|
49
|
-
stub.mockClear = () => {
|
|
50
|
-
stub.reset();
|
|
51
|
-
instances = [];
|
|
52
|
-
invocations = [];
|
|
53
|
-
return stub;
|
|
54
|
-
};
|
|
55
|
-
stub.mockReset = () => {
|
|
56
|
-
stub.mockClear();
|
|
57
|
-
implementation = () => void 0;
|
|
58
|
-
onceImplementations = [];
|
|
59
|
-
return stub;
|
|
60
|
-
};
|
|
61
|
-
stub.mockRestore = () => {
|
|
62
|
-
stub.mockReset();
|
|
63
|
-
implementation = void 0;
|
|
64
|
-
return stub;
|
|
65
|
-
};
|
|
66
|
-
stub.getMockImplementation = () => implementation;
|
|
67
|
-
stub.mockImplementation = (fn2) => {
|
|
68
|
-
implementation = fn2;
|
|
69
|
-
return stub;
|
|
70
|
-
};
|
|
71
|
-
stub.mockImplementationOnce = (fn2) => {
|
|
72
|
-
onceImplementations.push(fn2);
|
|
73
|
-
return stub;
|
|
74
|
-
};
|
|
75
|
-
stub.mockReturnThis = () => stub.mockImplementation(function() {
|
|
76
|
-
return this;
|
|
77
|
-
});
|
|
78
|
-
stub.mockReturnValue = (val) => stub.mockImplementation(() => val);
|
|
79
|
-
stub.mockReturnValueOnce = (val) => stub.mockImplementationOnce(() => val);
|
|
80
|
-
stub.mockResolvedValue = (val) => stub.mockImplementation(() => Promise.resolve(val));
|
|
81
|
-
stub.mockResolvedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.resolve(val));
|
|
82
|
-
stub.mockRejectedValue = (val) => stub.mockImplementation(() => Promise.reject(val));
|
|
83
|
-
stub.mockRejectedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.reject(val));
|
|
84
|
-
Object.defineProperty(stub, "mock", {
|
|
85
|
-
get: () => mockContext
|
|
86
|
-
});
|
|
87
|
-
stub.willCall(function(...args) {
|
|
88
|
-
instances.push(this);
|
|
89
|
-
invocations.push(++callOrder);
|
|
90
|
-
const impl = onceImplementations.shift() || implementation || stub.getOriginal() || (() => {
|
|
91
|
-
});
|
|
92
|
-
return impl.apply(this, args);
|
|
93
|
-
});
|
|
94
|
-
spies.add(stub);
|
|
95
|
-
return stub;
|
|
96
|
-
}
|
|
97
|
-
function fn(implementation) {
|
|
98
|
-
return enhanceSpy(tinyspy.spyOn({ fn: implementation || (() => {
|
|
99
|
-
}) }, "fn"));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export { fn, isMockFunction, spies, spyOn };
|
|
1
|
+
export { f as fn, i as isMockFunction, a as spies, s as spyOn } from './vendor-index.723a074f.js';
|
|
2
|
+
import 'tinyspy';
|
package/dist/suite.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import 'util';
|
|
2
2
|
import 'chai';
|
|
3
|
-
import './chunk-
|
|
4
|
-
export { b as bench, f as clearCollectorContext,
|
|
3
|
+
import './chunk-mock-date.a1c85759.js';
|
|
4
|
+
export { b as bench, f as clearCollectorContext, r as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.6df5a66b.js';
|
|
5
5
|
import 'node:path';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
6
|
+
import 'picocolors';
|
|
7
|
+
import 'local-pkg';
|
|
8
|
+
import './chunk-utils-env.b861e3a0.js';
|
|
8
9
|
import 'node:url';
|
|
9
10
|
import 'path';
|
|
10
|
-
import 'local-pkg';
|
|
11
11
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './
|
|
12
|
+
import './chunk-utils-timers.52534f96.js';
|
|
13
|
+
import './vendor-index.723a074f.js';
|
|
14
|
+
import 'tinyspy';
|
|
15
|
+
import './chunk-utils-source-map.60562959.js';
|
|
16
|
+
import './chunk-runtime-rpc.7f83c8a9.js';
|
|
14
17
|
import 'node:fs';
|
|
15
|
-
import './chunk-utils-source-map.5278ee22.js';
|
|
16
18
|
import 'fs';
|
|
17
|
-
import './spy.js';
|
|
18
|
-
import 'tinyspy';
|
|
@@ -173,6 +173,10 @@ interface ParsedFile extends File {
|
|
|
173
173
|
start: number;
|
|
174
174
|
end: number;
|
|
175
175
|
}
|
|
176
|
+
interface ParsedTest extends Test {
|
|
177
|
+
start: number;
|
|
178
|
+
end: number;
|
|
179
|
+
}
|
|
176
180
|
interface ParsedSuite extends Suite {
|
|
177
181
|
start: number;
|
|
178
182
|
end: number;
|
|
@@ -181,9 +185,9 @@ interface LocalCallDefinition {
|
|
|
181
185
|
start: number;
|
|
182
186
|
end: number;
|
|
183
187
|
name: string;
|
|
184
|
-
type:
|
|
188
|
+
type: 'suite' | 'test';
|
|
185
189
|
mode: 'run' | 'skip' | 'only' | 'todo';
|
|
186
|
-
task: ParsedSuite | ParsedFile;
|
|
190
|
+
task: ParsedSuite | ParsedFile | ParsedTest;
|
|
187
191
|
}
|
|
188
192
|
interface FileInformation {
|
|
189
193
|
file: File;
|
|
@@ -213,12 +217,14 @@ declare class Typechecker {
|
|
|
213
217
|
private _result;
|
|
214
218
|
private _tests;
|
|
215
219
|
private tempConfigPath?;
|
|
220
|
+
private allowJs?;
|
|
216
221
|
private process;
|
|
217
222
|
constructor(ctx: Vitest, files: string[]);
|
|
218
223
|
onParseStart(fn: Callback): void;
|
|
219
224
|
onParseEnd(fn: Callback<[ErrorsCache]>): void;
|
|
220
225
|
onWatcherRerun(fn: Callback): void;
|
|
221
226
|
protected collectFileTests(filepath: string): Promise<FileInformation | null>;
|
|
227
|
+
protected getFiles(): string[];
|
|
222
228
|
collectTests(): Promise<Record<string, FileInformation>>;
|
|
223
229
|
protected prepareResults(output: string): Promise<{
|
|
224
230
|
files: File[];
|
|
@@ -231,6 +237,7 @@ declare class Typechecker {
|
|
|
231
237
|
clear(): Promise<void>;
|
|
232
238
|
stop(): Promise<void>;
|
|
233
239
|
protected ensurePackageInstalled(root: string, checker: string): Promise<void>;
|
|
240
|
+
prepare(): Promise<void>;
|
|
234
241
|
start(): Promise<void>;
|
|
235
242
|
getResult(): ErrorsCache;
|
|
236
243
|
getTestFiles(): File[];
|
|
@@ -403,6 +410,7 @@ declare class Vitest {
|
|
|
403
410
|
*/
|
|
404
411
|
exit(force?: boolean): Promise<void>;
|
|
405
412
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
413
|
+
globFiles(filters: string[], include: string[], exclude: string[]): Promise<string[]>;
|
|
406
414
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
407
415
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
408
416
|
isInSourceTestFile(code: string): boolean;
|
|
@@ -951,13 +959,18 @@ interface TaskBase {
|
|
|
951
959
|
result?: TaskResult;
|
|
952
960
|
retry?: number;
|
|
953
961
|
logs?: UserConsoleLog[];
|
|
962
|
+
meta?: any;
|
|
954
963
|
}
|
|
955
964
|
interface TaskResult {
|
|
956
965
|
state: TaskState;
|
|
957
966
|
duration?: number;
|
|
958
967
|
startTime?: number;
|
|
959
968
|
heap?: number;
|
|
969
|
+
/**
|
|
970
|
+
* @deprecated Use "errors" instead
|
|
971
|
+
*/
|
|
960
972
|
error?: ErrorWithDiff;
|
|
973
|
+
errors?: ErrorWithDiff[];
|
|
961
974
|
htmlError?: string;
|
|
962
975
|
hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
|
|
963
976
|
benchmark?: BenchmarkResult;
|
|
@@ -984,10 +997,7 @@ interface Test<ExtraContext = {}> extends TaskBase {
|
|
|
984
997
|
context: TestContext & ExtraContext;
|
|
985
998
|
onFailed?: OnTestFailedHandler[];
|
|
986
999
|
}
|
|
987
|
-
|
|
988
|
-
type: 'typecheck';
|
|
989
|
-
}
|
|
990
|
-
type Task = Test | Suite | File | Benchmark | TypeCheck;
|
|
1000
|
+
type Task = Test | Suite | File | Benchmark;
|
|
991
1001
|
type DoneCallback = (error?: any) => void;
|
|
992
1002
|
type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<any> | void;
|
|
993
1003
|
type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
|
|
@@ -1246,7 +1256,7 @@ interface BaseCoverageOptions {
|
|
|
1246
1256
|
/**
|
|
1247
1257
|
* Clean coverage report on watch rerun
|
|
1248
1258
|
*
|
|
1249
|
-
* @default
|
|
1259
|
+
* @default true
|
|
1250
1260
|
*/
|
|
1251
1261
|
cleanOnRerun?: boolean;
|
|
1252
1262
|
/**
|
|
@@ -1966,38 +1976,11 @@ declare module 'vite' {
|
|
|
1966
1976
|
}
|
|
1967
1977
|
}
|
|
1968
1978
|
|
|
1969
|
-
|
|
1979
|
+
declare function stringify(object: unknown, maxDepth?: number, { maxLength, ...options }?: PrettyFormatOptions & {
|
|
1980
|
+
maxLength?: number;
|
|
1981
|
+
}): string;
|
|
1970
1982
|
|
|
1971
|
-
|
|
1972
|
-
comment?: string;
|
|
1973
|
-
expectedColor?: Formatter;
|
|
1974
|
-
isDirectExpectCall?: boolean;
|
|
1975
|
-
isNot?: boolean;
|
|
1976
|
-
promise?: string;
|
|
1977
|
-
receivedColor?: Formatter;
|
|
1978
|
-
secondArgument?: string;
|
|
1979
|
-
secondArgumentColor?: Formatter;
|
|
1980
|
-
}
|
|
1981
|
-
interface DiffOptions {
|
|
1982
|
-
aAnnotation?: string;
|
|
1983
|
-
aColor?: Formatter;
|
|
1984
|
-
aIndicator?: string;
|
|
1985
|
-
bAnnotation?: string;
|
|
1986
|
-
bColor?: Formatter;
|
|
1987
|
-
bIndicator?: string;
|
|
1988
|
-
changeColor?: Formatter;
|
|
1989
|
-
changeLineTrailingSpaceColor?: Formatter;
|
|
1990
|
-
commonColor?: Formatter;
|
|
1991
|
-
commonIndicator?: string;
|
|
1992
|
-
commonLineTrailingSpaceColor?: Formatter;
|
|
1993
|
-
contextLines?: number;
|
|
1994
|
-
emptyFirstOrLastLinePlaceholder?: string;
|
|
1995
|
-
expand?: boolean;
|
|
1996
|
-
includeChangeCounts?: boolean;
|
|
1997
|
-
omitAnnotationLines?: boolean;
|
|
1998
|
-
patchColor?: Formatter;
|
|
1999
|
-
compareKeys?: any;
|
|
2000
|
-
}
|
|
1983
|
+
type Formatter = (input: string | number | null | undefined) => string;
|
|
2001
1984
|
|
|
2002
1985
|
declare const EXPECTED_COLOR: Formatter;
|
|
2003
1986
|
declare const RECEIVED_COLOR: Formatter;
|
|
@@ -2005,37 +1988,97 @@ declare const INVERTED_COLOR: Formatter;
|
|
|
2005
1988
|
declare const BOLD_WEIGHT: Formatter;
|
|
2006
1989
|
declare const DIM_COLOR: Formatter;
|
|
2007
1990
|
declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
|
|
2008
|
-
declare function stringify(object: unknown, maxDepth?: number, { maxLength, ...options }?: PrettyFormatOptions & {
|
|
2009
|
-
maxLength?: number;
|
|
2010
|
-
}): string;
|
|
2011
1991
|
declare const printReceived: (object: unknown) => string;
|
|
2012
1992
|
declare const printExpected: (value: unknown) => string;
|
|
2013
1993
|
declare function diff(a: any, b: any, options?: DiffOptions): string;
|
|
2014
1994
|
|
|
1995
|
+
declare const jestMatcherUtils_stringify: typeof stringify;
|
|
2015
1996
|
declare const jestMatcherUtils_EXPECTED_COLOR: typeof EXPECTED_COLOR;
|
|
2016
1997
|
declare const jestMatcherUtils_RECEIVED_COLOR: typeof RECEIVED_COLOR;
|
|
2017
1998
|
declare const jestMatcherUtils_INVERTED_COLOR: typeof INVERTED_COLOR;
|
|
2018
1999
|
declare const jestMatcherUtils_BOLD_WEIGHT: typeof BOLD_WEIGHT;
|
|
2019
2000
|
declare const jestMatcherUtils_DIM_COLOR: typeof DIM_COLOR;
|
|
2020
2001
|
declare const jestMatcherUtils_matcherHint: typeof matcherHint;
|
|
2021
|
-
declare const jestMatcherUtils_stringify: typeof stringify;
|
|
2022
2002
|
declare const jestMatcherUtils_printReceived: typeof printReceived;
|
|
2023
2003
|
declare const jestMatcherUtils_printExpected: typeof printExpected;
|
|
2024
2004
|
declare const jestMatcherUtils_diff: typeof diff;
|
|
2025
2005
|
declare namespace jestMatcherUtils {
|
|
2026
2006
|
export {
|
|
2007
|
+
jestMatcherUtils_stringify as stringify,
|
|
2027
2008
|
jestMatcherUtils_EXPECTED_COLOR as EXPECTED_COLOR,
|
|
2028
2009
|
jestMatcherUtils_RECEIVED_COLOR as RECEIVED_COLOR,
|
|
2029
2010
|
jestMatcherUtils_INVERTED_COLOR as INVERTED_COLOR,
|
|
2030
2011
|
jestMatcherUtils_BOLD_WEIGHT as BOLD_WEIGHT,
|
|
2031
2012
|
jestMatcherUtils_DIM_COLOR as DIM_COLOR,
|
|
2032
2013
|
jestMatcherUtils_matcherHint as matcherHint,
|
|
2033
|
-
jestMatcherUtils_stringify as stringify,
|
|
2034
2014
|
jestMatcherUtils_printReceived as printReceived,
|
|
2035
2015
|
jestMatcherUtils_printExpected as printExpected,
|
|
2036
2016
|
jestMatcherUtils_diff as diff,
|
|
2037
2017
|
};
|
|
2038
2018
|
}
|
|
2019
|
+
type Tester = (a: any, b: any) => boolean | undefined;
|
|
2020
|
+
interface MatcherHintOptions {
|
|
2021
|
+
comment?: string;
|
|
2022
|
+
expectedColor?: Formatter;
|
|
2023
|
+
isDirectExpectCall?: boolean;
|
|
2024
|
+
isNot?: boolean;
|
|
2025
|
+
promise?: string;
|
|
2026
|
+
receivedColor?: Formatter;
|
|
2027
|
+
secondArgument?: string;
|
|
2028
|
+
secondArgumentColor?: Formatter;
|
|
2029
|
+
}
|
|
2030
|
+
interface DiffOptions {
|
|
2031
|
+
aAnnotation?: string;
|
|
2032
|
+
aColor?: Formatter;
|
|
2033
|
+
aIndicator?: string;
|
|
2034
|
+
bAnnotation?: string;
|
|
2035
|
+
bColor?: Formatter;
|
|
2036
|
+
bIndicator?: string;
|
|
2037
|
+
changeColor?: Formatter;
|
|
2038
|
+
changeLineTrailingSpaceColor?: Formatter;
|
|
2039
|
+
commonColor?: Formatter;
|
|
2040
|
+
commonIndicator?: string;
|
|
2041
|
+
commonLineTrailingSpaceColor?: Formatter;
|
|
2042
|
+
contextLines?: number;
|
|
2043
|
+
emptyFirstOrLastLinePlaceholder?: string;
|
|
2044
|
+
expand?: boolean;
|
|
2045
|
+
includeChangeCounts?: boolean;
|
|
2046
|
+
omitAnnotationLines?: boolean;
|
|
2047
|
+
patchColor?: Formatter;
|
|
2048
|
+
compareKeys?: any;
|
|
2049
|
+
}
|
|
2050
|
+
interface MatcherState$1 {
|
|
2051
|
+
assertionCalls: number;
|
|
2052
|
+
currentTestName?: string;
|
|
2053
|
+
dontThrow?: () => void;
|
|
2054
|
+
error?: Error;
|
|
2055
|
+
equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
|
|
2056
|
+
expand?: boolean;
|
|
2057
|
+
expectedAssertionsNumber?: number | null;
|
|
2058
|
+
expectedAssertionsNumberErrorGen?: (() => Error) | null;
|
|
2059
|
+
isExpectingAssertions?: boolean;
|
|
2060
|
+
isExpectingAssertionsError?: Error | null;
|
|
2061
|
+
isNot: boolean;
|
|
2062
|
+
promise: string;
|
|
2063
|
+
suppressedErrors: Array<Error>;
|
|
2064
|
+
testPath?: string;
|
|
2065
|
+
utils: typeof jestMatcherUtils & {
|
|
2066
|
+
iterableEquality: Tester;
|
|
2067
|
+
subsetEquality: Tester;
|
|
2068
|
+
};
|
|
2069
|
+
}
|
|
2070
|
+
interface SyncExpectationResult {
|
|
2071
|
+
pass: boolean;
|
|
2072
|
+
message: () => string;
|
|
2073
|
+
actual?: any;
|
|
2074
|
+
expected?: any;
|
|
2075
|
+
}
|
|
2076
|
+
type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
|
2077
|
+
type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
|
2078
|
+
interface RawMatcherFn<T extends MatcherState$1 = MatcherState$1> {
|
|
2079
|
+
(this: T, received: any, expected: any, options?: any): ExpectationResult;
|
|
2080
|
+
}
|
|
2081
|
+
type MatchersObject<T extends MatcherState$1 = MatcherState$1> = Record<string, RawMatcherFn<T>>;
|
|
2039
2082
|
|
|
2040
2083
|
/**
|
|
2041
2084
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
@@ -2084,41 +2127,10 @@ declare class SnapshotState {
|
|
|
2084
2127
|
pack(): Promise<SnapshotResult>;
|
|
2085
2128
|
}
|
|
2086
2129
|
|
|
2087
|
-
|
|
2088
|
-
interface MatcherState {
|
|
2089
|
-
assertionCalls: number;
|
|
2090
|
-
currentTestName?: string;
|
|
2091
|
-
dontThrow?: () => void;
|
|
2092
|
-
error?: Error;
|
|
2093
|
-
equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
|
|
2094
|
-
expand?: boolean;
|
|
2095
|
-
expectedAssertionsNumber?: number | null;
|
|
2096
|
-
expectedAssertionsNumberErrorGen?: (() => Error) | null;
|
|
2097
|
-
isExpectingAssertions?: boolean;
|
|
2098
|
-
isExpectingAssertionsError?: Error | null;
|
|
2099
|
-
isNot: boolean;
|
|
2130
|
+
interface MatcherState extends MatcherState$1 {
|
|
2100
2131
|
environment: VitestEnvironment;
|
|
2101
|
-
promise: string;
|
|
2102
2132
|
snapshotState: SnapshotState;
|
|
2103
|
-
suppressedErrors: Array<Error>;
|
|
2104
|
-
testPath?: string;
|
|
2105
|
-
utils: typeof jestMatcherUtils & {
|
|
2106
|
-
iterableEquality: Tester;
|
|
2107
|
-
subsetEquality: Tester;
|
|
2108
|
-
};
|
|
2109
|
-
}
|
|
2110
|
-
interface SyncExpectationResult {
|
|
2111
|
-
pass: boolean;
|
|
2112
|
-
message: () => string;
|
|
2113
|
-
actual?: any;
|
|
2114
|
-
expected?: any;
|
|
2115
|
-
}
|
|
2116
|
-
type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
|
2117
|
-
type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
|
2118
|
-
interface RawMatcherFn<T extends MatcherState = MatcherState> {
|
|
2119
|
-
(this: T, received: any, expected: any, options?: any): ExpectationResult;
|
|
2120
2133
|
}
|
|
2121
|
-
type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;
|
|
2122
2134
|
|
|
2123
2135
|
type Promisify<O> = {
|
|
2124
2136
|
[K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
|
|
@@ -2245,4 +2257,4 @@ type Context = RootAndTarget & {
|
|
|
2245
2257
|
lastActivePath?: string;
|
|
2246
2258
|
};
|
|
2247
2259
|
|
|
2248
|
-
export {
|
|
2260
|
+
export { WorkerContext as $, ApiConfig as A, BuiltinEnvironment as B, CollectLineNumbers as C, DoneCallback as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, SuiteFactory as G, HookListener as H, InlineConfig as I, JSDOMOptions as J, RuntimeContext as K, TestContext as L, MockFactoryWithHelper as M, Vitest as N, OnTestFailedHandler as O, SnapshotData as P, SnapshotUpdateState as Q, RuntimeConfig as R, SequenceHooks as S, TaskResultPack as T, UserConfig as U, VitestEnvironment as V, SnapshotStateOptions as W, SnapshotMatchOptions as X, SnapshotResult as Y, UncheckedSnapshot as Z, SnapshotSummary as _, File as a, ResolveIdFunction as a0, AfterSuiteRunMeta as a1, WorkerRPC as a2, WorkerGlobalState as a3, Awaitable as a4, Nullable as a5, Arrayable as a6, ArgumentsType$1 as a7, MergeInsertions as a8, DeepMerge as a9, TestSequencerConstructor as aA, MutableArray as aa, Constructable as ab, ModuleCache as ac, EnvironmentReturn as ad, Environment as ae, UserConsoleLog as af, ParsedStack as ag, ErrorWithDiff as ah, OnServerRestartHandler as ai, CoverageProvider as aj, CoverageProviderModule as ak, CoverageReporter as al, CoverageOptions as am, ResolvedCoverageOptions as an, BaseCoverageOptions as ao, CoverageIstanbulOptions as ap, CoverageC8Options as aq, BenchmarkUserOptions as ar, Benchmark as as, BenchmarkResult as at, BenchFunction as au, BenchmarkAPI as av, MockFactory as aw, MockMap as ax, TestSequencer as ay, startVitest as az, ResolvedConfig as b, ModuleGraphData as c, Reporter as d, RawErrsMap as e, TscErrorInfo as f, CollectLines as g, RootAndTarget as h, Context as i, CSSModuleScopeStrategy as j, VitestRunMode as k, TypecheckConfig as l, RunMode as m, TaskState as n, TaskBase as o, TaskResult as p, Suite as q, Test as r, Task as s, TestFunction as t, TestOptions as u, TestAPI as v, SuiteAPI as w, HookCleanupCallback as x, SuiteHooks as y, SuiteCollector as z };
|