vitest 0.25.6 → 0.25.8
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 +29 -29
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +4 -4
- package/dist/{chunk-api-setup.5669c9a4.js → chunk-api-setup.dc71e384.js} +1 -1
- package/dist/{chunk-integrations-globals.57158eb5.js → chunk-integrations-globals.4d261bb8.js} +2 -2
- package/dist/{chunk-magic-string.ffe2b171.js → chunk-magic-string.3a794426.js} +75 -39
- package/dist/{chunk-runtime-chain.dd978482.js → chunk-runtime-chain.f86e5250.js} +1 -1
- package/dist/{chunk-runtime-mocker.bf08ae09.js → chunk-runtime-mocker.99b910d0.js} +1 -1
- package/dist/{chunk-runtime-setup.bd2deed4.js → chunk-runtime-setup.5398e2c4.js} +7 -7
- package/dist/{chunk-runtime-test-state.0037e2e0.js → chunk-runtime-test-state.3f86f48f.js} +1 -1
- package/dist/{chunk-vite-node-externalize.328ed604.js → chunk-vite-node-externalize.b9495318.js} +18 -11
- package/dist/{chunk-vite-node-source-map.2b1f492a.js → chunk-vite-node-source-map.b4ea5792.js} +4 -3
- package/dist/cli.js +3 -3
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +1 -1
- package/dist/entry.js +3 -3
- package/dist/environments.d.ts +1 -1
- package/dist/{index-81973d31.d.ts → index-5aad25c1.d.ts} +20 -20
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/node.d.ts +3 -3
- package/dist/node.js +4 -4
- package/dist/suite.js +1 -1
- package/dist/{types-1cf24598.d.ts → types-71ccd11d.d.ts} +67 -65
- package/dist/worker.js +2 -2
- package/package.json +15 -15
package/LICENSE.md
CHANGED
|
@@ -58,6 +58,35 @@ Repository: git+https://github.com/antfu/install-pkg.git
|
|
|
58
58
|
|
|
59
59
|
---------------------------------------
|
|
60
60
|
|
|
61
|
+
## @jridgewell/sourcemap-codec
|
|
62
|
+
License: MIT
|
|
63
|
+
By: Rich Harris
|
|
64
|
+
Repository: git+https://github.com/jridgewell/sourcemap-codec.git
|
|
65
|
+
|
|
66
|
+
> The MIT License
|
|
67
|
+
>
|
|
68
|
+
> Copyright (c) 2015 Rich Harris
|
|
69
|
+
>
|
|
70
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
71
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
72
|
+
> in the Software without restriction, including without limitation the rights
|
|
73
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
74
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
75
|
+
> furnished to do so, subject to the following conditions:
|
|
76
|
+
>
|
|
77
|
+
> The above copyright notice and this permission notice shall be included in
|
|
78
|
+
> all copies or substantial portions of the Software.
|
|
79
|
+
>
|
|
80
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
81
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
82
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
83
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
84
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
85
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
86
|
+
> THE SOFTWARE.
|
|
87
|
+
|
|
88
|
+
---------------------------------------
|
|
89
|
+
|
|
61
90
|
## @nodelib/fs.scandir
|
|
62
91
|
License: MIT
|
|
63
92
|
Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir
|
|
@@ -2115,35 +2144,6 @@ Repository: https://github.com/evanw/node-source-map-support
|
|
|
2115
2144
|
|
|
2116
2145
|
---------------------------------------
|
|
2117
2146
|
|
|
2118
|
-
## sourcemap-codec
|
|
2119
|
-
License: MIT
|
|
2120
|
-
By: Rich Harris
|
|
2121
|
-
Repository: https://github.com/Rich-Harris/sourcemap-codec
|
|
2122
|
-
|
|
2123
|
-
> The MIT License
|
|
2124
|
-
>
|
|
2125
|
-
> Copyright (c) 2015 Rich Harris
|
|
2126
|
-
>
|
|
2127
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2128
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
2129
|
-
> in the Software without restriction, including without limitation the rights
|
|
2130
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2131
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
2132
|
-
> furnished to do so, subject to the following conditions:
|
|
2133
|
-
>
|
|
2134
|
-
> The above copyright notice and this permission notice shall be included in
|
|
2135
|
-
> all copies or substantial portions of the Software.
|
|
2136
|
-
>
|
|
2137
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2138
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2139
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2140
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2141
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2142
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2143
|
-
> THE SOFTWARE.
|
|
2144
|
-
|
|
2145
|
-
---------------------------------------
|
|
2146
|
-
|
|
2147
2147
|
## string-width
|
|
2148
2148
|
License: MIT
|
|
2149
2149
|
By: Sindre Sorhus
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-
|
|
2
|
-
import { b as ResolvedConfig } from './types-
|
|
3
|
-
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-
|
|
1
|
+
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-5aad25c1.js';
|
|
2
|
+
import { b as ResolvedConfig } from './types-71ccd11d.js';
|
|
3
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-71ccd11d.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,7 +1,7 @@
|
|
|
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
|
-
import { e as dist } from './chunk-runtime-test-state.
|
|
3
|
-
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-runtime-test-state.
|
|
4
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.
|
|
1
|
+
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.f86e5250.js';
|
|
2
|
+
import { e as dist } from './chunk-runtime-test-state.3f86f48f.js';
|
|
3
|
+
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-runtime-test-state.3f86f48f.js';
|
|
4
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.5398e2c4.js';
|
|
5
5
|
import * as chai from 'chai';
|
|
6
6
|
export { chai };
|
|
7
7
|
export { assert, should } from 'chai';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-source-map.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-source-map.b4ea5792.js';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
package/dist/{chunk-integrations-globals.57158eb5.js → chunk-integrations-globals.4d261bb8.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { m as globalApis } from './chunk-utils-env.03f840f2.js';
|
|
2
|
-
import { i as index } from './chunk-runtime-test-state.
|
|
2
|
+
import { i as index } from './chunk-runtime-test-state.3f86f48f.js';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|
|
6
|
-
import './chunk-runtime-chain.
|
|
6
|
+
import './chunk-runtime-chain.f86e5250.js';
|
|
7
7
|
import 'util';
|
|
8
8
|
import 'chai';
|
|
9
9
|
import './chunk-typecheck-constants.ed987901.js';
|
|
@@ -1,53 +1,89 @@
|
|
|
1
|
-
|
|
1
|
+
const comma = ','.charCodeAt(0);
|
|
2
|
+
const semicolon = ';'.charCodeAt(0);
|
|
3
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
4
|
+
const intToChar = new Uint8Array(64); // 64 possible chars.
|
|
5
|
+
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
|
6
|
+
for (let i = 0; i < chars.length; i++) {
|
|
7
|
+
const c = chars.charCodeAt(i);
|
|
8
|
+
intToChar[i] = c;
|
|
9
|
+
charToInt[c] = i;
|
|
10
|
+
}
|
|
11
|
+
// Provide a fallback for older environments.
|
|
12
|
+
const td = typeof TextDecoder !== 'undefined'
|
|
13
|
+
? /* #__PURE__ */ new TextDecoder()
|
|
14
|
+
: typeof Buffer !== 'undefined'
|
|
15
|
+
? {
|
|
16
|
+
decode(buf) {
|
|
17
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
18
|
+
return out.toString();
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
: {
|
|
22
|
+
decode(buf) {
|
|
23
|
+
let out = '';
|
|
24
|
+
for (let i = 0; i < buf.length; i++) {
|
|
25
|
+
out += String.fromCharCode(buf[i]);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
2
30
|
function encode(decoded) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
31
|
+
const state = new Int32Array(5);
|
|
32
|
+
const bufLength = 1024 * 16;
|
|
33
|
+
const subLength = bufLength - 36;
|
|
34
|
+
const buf = new Uint8Array(bufLength);
|
|
35
|
+
const sub = buf.subarray(0, subLength);
|
|
36
|
+
let pos = 0;
|
|
37
|
+
let out = '';
|
|
38
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
39
|
+
const line = decoded[i];
|
|
40
|
+
if (i > 0) {
|
|
41
|
+
if (pos === bufLength) {
|
|
42
|
+
out += td.decode(buf);
|
|
43
|
+
pos = 0;
|
|
44
|
+
}
|
|
45
|
+
buf[pos++] = semicolon;
|
|
46
|
+
}
|
|
12
47
|
if (line.length === 0)
|
|
13
48
|
continue;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
encodeInteger(segment[2] - sourceCodeLine) +
|
|
24
|
-
encodeInteger(segment[3] - sourceCodeColumn);
|
|
25
|
-
sourceFileIndex = segment[1];
|
|
26
|
-
sourceCodeLine = segment[2];
|
|
27
|
-
sourceCodeColumn = segment[3];
|
|
28
|
-
}
|
|
29
|
-
if (segment.length === 5) {
|
|
30
|
-
segmentMappings += encodeInteger(segment[4] - nameIndex);
|
|
31
|
-
nameIndex = segment[4];
|
|
49
|
+
state[0] = 0;
|
|
50
|
+
for (let j = 0; j < line.length; j++) {
|
|
51
|
+
const segment = line[j];
|
|
52
|
+
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
|
53
|
+
// may push a comma.
|
|
54
|
+
if (pos > subLength) {
|
|
55
|
+
out += td.decode(sub);
|
|
56
|
+
buf.copyWithin(0, subLength, pos);
|
|
57
|
+
pos -= subLength;
|
|
32
58
|
}
|
|
33
|
-
|
|
59
|
+
if (j > 0)
|
|
60
|
+
buf[pos++] = comma;
|
|
61
|
+
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
|
62
|
+
if (segment.length === 1)
|
|
63
|
+
continue;
|
|
64
|
+
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
|
65
|
+
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
|
66
|
+
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
|
67
|
+
if (segment.length === 4)
|
|
68
|
+
continue;
|
|
69
|
+
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
|
34
70
|
}
|
|
35
|
-
mappings += lineMappings.join(',');
|
|
36
71
|
}
|
|
37
|
-
return
|
|
72
|
+
return out + td.decode(buf.subarray(0, pos));
|
|
38
73
|
}
|
|
39
|
-
function encodeInteger(
|
|
40
|
-
|
|
74
|
+
function encodeInteger(buf, pos, state, segment, j) {
|
|
75
|
+
const next = segment[j];
|
|
76
|
+
let num = next - state[j];
|
|
77
|
+
state[j] = next;
|
|
41
78
|
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
42
79
|
do {
|
|
43
|
-
|
|
80
|
+
let clamped = num & 0b011111;
|
|
44
81
|
num >>>= 5;
|
|
45
|
-
if (num > 0)
|
|
46
|
-
clamped |=
|
|
47
|
-
|
|
48
|
-
result += chars[clamped];
|
|
82
|
+
if (num > 0)
|
|
83
|
+
clamped |= 0b100000;
|
|
84
|
+
buf[pos++] = intToChar[clamped];
|
|
49
85
|
} while (num > 0);
|
|
50
|
-
return
|
|
86
|
+
return pos;
|
|
51
87
|
}
|
|
52
88
|
|
|
53
89
|
class BitSet {
|
|
@@ -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.3a794426.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 snaps = snapshots.filter((i) => i.file === file);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-source-map.
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-source-map.b4ea5792.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
3
|
import { g as getWorkerState, J as mergeSlashes, s as slash, x as getType, K as getAllMockableProperties } from './chunk-typecheck-constants.ed987901.js';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
2
|
import { s as someTasksAreOnly, i as interpretTaskModes, t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.befed097.js';
|
|
3
|
-
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-runtime-test-state.
|
|
3
|
+
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-runtime-test-state.3f86f48f.js';
|
|
4
4
|
import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, q as hasTests, u as hasFailed, v as createDefer, e as getFullName } from './chunk-typecheck-constants.ed987901.js';
|
|
5
|
-
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, G as GLOBAL_EXPECT, p as getState } from './chunk-runtime-chain.
|
|
5
|
+
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, G as GLOBAL_EXPECT, p as getState } from './chunk-runtime-chain.f86e5250.js';
|
|
6
6
|
import { r as rpc } from './chunk-runtime-rpc.42aebbb9.js';
|
|
7
7
|
import { p as processError } from './chunk-runtime-error.616e92ca.js';
|
|
8
8
|
import { s as sourceMapSupport } from './vendor-source-map-support.1ce17397.js';
|
|
@@ -46,7 +46,7 @@ async function setupGlobalEnv(config) {
|
|
|
46
46
|
await setupConsoleLogSpy();
|
|
47
47
|
}
|
|
48
48
|
if (config.globals)
|
|
49
|
-
(await import('./chunk-integrations-globals.
|
|
49
|
+
(await import('./chunk-integrations-globals.4d261bb8.js')).registerApiGlobally();
|
|
50
50
|
}
|
|
51
51
|
function setupDefines(defines) {
|
|
52
52
|
for (const key in defines)
|
|
@@ -346,7 +346,7 @@ const callCleanupHooks = async (cleanups) => {
|
|
|
346
346
|
async function runTest(test) {
|
|
347
347
|
var _a, _b, _c;
|
|
348
348
|
if (test.mode !== "run") {
|
|
349
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
349
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.f86e5250.js').then(function (n) { return n.r; });
|
|
350
350
|
getSnapshotClient().skipTestSnapshots(test);
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
@@ -363,7 +363,7 @@ async function runTest(test) {
|
|
|
363
363
|
clearModuleMocks();
|
|
364
364
|
setCurrentTest(test);
|
|
365
365
|
if (isNode) {
|
|
366
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
366
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.f86e5250.js').then(function (n) { return n.r; });
|
|
367
367
|
await getSnapshotClient().setTest(test);
|
|
368
368
|
}
|
|
369
369
|
const workerState = getWorkerState();
|
|
@@ -426,7 +426,7 @@ async function runTest(test) {
|
|
|
426
426
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
427
427
|
setCurrentTest(void 0);
|
|
428
428
|
if (isNode) {
|
|
429
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
429
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.f86e5250.js').then(function (n) { return n.r; });
|
|
430
430
|
getSnapshotClient().clearTest();
|
|
431
431
|
}
|
|
432
432
|
test.result.duration = now() - start;
|
|
@@ -632,7 +632,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
632
632
|
async function startTestsNode(paths, config) {
|
|
633
633
|
const files = await collectTests(paths, config);
|
|
634
634
|
rpc().onCollected(files);
|
|
635
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
635
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.f86e5250.js').then(function (n) { return n.r; });
|
|
636
636
|
getSnapshotClient().clear();
|
|
637
637
|
await runFiles(files, config);
|
|
638
638
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|
|
@@ -1,4 +1,4 @@
|
|
|
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.
|
|
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.f86e5250.js';
|
|
2
2
|
import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-typecheck-constants.ed987901.js';
|
|
3
3
|
import { p as parseStacktrace } from './chunk-utils-source-map.29ff1088.js';
|
|
4
4
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
package/dist/{chunk-vite-node-externalize.328ed604.js → chunk-vite-node-externalize.b9495318.js}
RENAMED
|
@@ -12,7 +12,7 @@ import util$2 from 'util';
|
|
|
12
12
|
import require$$0$1 from 'stream';
|
|
13
13
|
import require$$2 from 'events';
|
|
14
14
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
15
|
-
import { w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-source-map.
|
|
15
|
+
import { w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-source-map.b4ea5792.js';
|
|
16
16
|
import { performance } from 'perf_hooks';
|
|
17
17
|
import createDebug from 'debug';
|
|
18
18
|
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, n as normalizeModuleId, b as toFilePath } from './chunk-vite-node-utils.0e4a6a88.js';
|
|
@@ -30,12 +30,12 @@ import { resolveModule } from 'local-pkg';
|
|
|
30
30
|
import { createHash } from 'crypto';
|
|
31
31
|
import { o as onetime } from './vendor-index.9c919048.js';
|
|
32
32
|
import { s as signalExit } from './vendor-index.e1d4cf84.js';
|
|
33
|
-
import MagicString from './chunk-magic-string.
|
|
33
|
+
import MagicString from './chunk-magic-string.3a794426.js';
|
|
34
34
|
import { stripLiteral } from 'strip-literal';
|
|
35
35
|
import require$$0$2 from 'readline';
|
|
36
36
|
import { p as prompts } from './vendor-index.9f20a9be.js';
|
|
37
37
|
|
|
38
|
-
var version$1 = "0.25.
|
|
38
|
+
var version$1 = "0.25.8";
|
|
39
39
|
|
|
40
40
|
class EndError extends Error {
|
|
41
41
|
constructor(value) {
|
|
@@ -8727,7 +8727,7 @@ function escapeXML(value) {
|
|
|
8727
8727
|
);
|
|
8728
8728
|
}
|
|
8729
8729
|
function executionTime(durationMS) {
|
|
8730
|
-
return (durationMS / 1e3).toLocaleString(
|
|
8730
|
+
return (durationMS / 1e3).toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 10 });
|
|
8731
8731
|
}
|
|
8732
8732
|
function getDuration(task) {
|
|
8733
8733
|
var _a;
|
|
@@ -9351,7 +9351,7 @@ const coverageConfigDefaults = {
|
|
|
9351
9351
|
exclude: defaultCoverageExcludes,
|
|
9352
9352
|
reporter: ["text", "html", "clover", "json"],
|
|
9353
9353
|
allowExternal: false,
|
|
9354
|
-
extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
9354
|
+
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
9355
9355
|
};
|
|
9356
9356
|
const fakeTimersDefaults = {
|
|
9357
9357
|
loopLimit: 1e4,
|
|
@@ -10207,7 +10207,7 @@ createLogUpdate(process$1.stdout);
|
|
|
10207
10207
|
|
|
10208
10208
|
createLogUpdate(process$1.stderr);
|
|
10209
10209
|
|
|
10210
|
-
var version = "0.25.
|
|
10210
|
+
var version = "0.25.8";
|
|
10211
10211
|
|
|
10212
10212
|
function fileFromParsedStack(stack) {
|
|
10213
10213
|
var _a, _b;
|
|
@@ -10252,7 +10252,7 @@ async function printError(error, ctx, options = {}) {
|
|
|
10252
10252
|
}
|
|
10253
10253
|
});
|
|
10254
10254
|
}
|
|
10255
|
-
if (e.cause && "name" in e.cause) {
|
|
10255
|
+
if (typeof e.cause === "object" && e.cause && "name" in e.cause) {
|
|
10256
10256
|
e.cause.name = `Caused by: ${e.cause.name}`;
|
|
10257
10257
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
10258
10258
|
}
|
|
@@ -10519,6 +10519,7 @@ class Vitest {
|
|
|
10519
10519
|
this.restartsCount = 0;
|
|
10520
10520
|
this.runner = void 0;
|
|
10521
10521
|
this._onRestartListeners = [];
|
|
10522
|
+
this._onSetServer = [];
|
|
10522
10523
|
this.unregisterWatcher = noop$1;
|
|
10523
10524
|
this.logger = new Logger(this);
|
|
10524
10525
|
}
|
|
@@ -10571,6 +10572,7 @@ class Vitest {
|
|
|
10571
10572
|
await this.cache.results.readFromCache();
|
|
10572
10573
|
} catch {
|
|
10573
10574
|
}
|
|
10575
|
+
await Promise.all(this._onSetServer.map((fn) => fn()));
|
|
10574
10576
|
}
|
|
10575
10577
|
async initCoverageProvider() {
|
|
10576
10578
|
if (this.coverageProvider !== void 0)
|
|
@@ -10973,6 +10975,9 @@ class Vitest {
|
|
|
10973
10975
|
onServerRestart(fn) {
|
|
10974
10976
|
this._onRestartListeners.push(fn);
|
|
10975
10977
|
}
|
|
10978
|
+
onAfterSetServer(fn) {
|
|
10979
|
+
this._onSetServer.push(fn);
|
|
10980
|
+
}
|
|
10976
10981
|
}
|
|
10977
10982
|
|
|
10978
10983
|
function generateCssFilenameHash(filepath) {
|
|
@@ -11323,7 +11328,8 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11323
11328
|
open = "/";
|
|
11324
11329
|
const config = {
|
|
11325
11330
|
esbuild: {
|
|
11326
|
-
sourcemap: "external"
|
|
11331
|
+
sourcemap: "external",
|
|
11332
|
+
legalComments: "inline"
|
|
11327
11333
|
},
|
|
11328
11334
|
resolve: {
|
|
11329
11335
|
mainFields: [],
|
|
@@ -11386,7 +11392,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11386
11392
|
try {
|
|
11387
11393
|
await ctx.setServer(options, server);
|
|
11388
11394
|
if (options.api && options.watch)
|
|
11389
|
-
(await import('./chunk-api-setup.
|
|
11395
|
+
(await import('./chunk-api-setup.dc71e384.js')).setup(ctx);
|
|
11390
11396
|
} catch (err) {
|
|
11391
11397
|
ctx.logger.printError(err, true);
|
|
11392
11398
|
process.exit(1);
|
|
@@ -11554,8 +11560,9 @@ async function startVitest(mode, cliFilters, options, viteOverrides) {
|
|
|
11554
11560
|
ctx.report("onServerRestart", reason);
|
|
11555
11561
|
if (process.env.VITEST_CLI_WRAPPER)
|
|
11556
11562
|
process.exit(EXIT_CODE_RESTART);
|
|
11557
|
-
|
|
11558
|
-
|
|
11563
|
+
});
|
|
11564
|
+
ctx.onAfterSetServer(() => {
|
|
11565
|
+
ctx.start(cliFilters);
|
|
11559
11566
|
});
|
|
11560
11567
|
try {
|
|
11561
11568
|
await ctx.start(cliFilters);
|
package/dist/{chunk-vite-node-source-map.2b1f492a.js → chunk-vite-node-source-map.b4ea5792.js}
RENAMED
|
@@ -168,10 +168,11 @@ class ViteNodeRunner {
|
|
|
168
168
|
return mod.promise;
|
|
169
169
|
const promise = this.directRequest(id, fsPath, callstack);
|
|
170
170
|
Object.assign(mod, { promise, evaluated: false });
|
|
171
|
-
|
|
171
|
+
try {
|
|
172
|
+
return await promise;
|
|
173
|
+
} finally {
|
|
172
174
|
mod.evaluated = true;
|
|
173
|
-
}
|
|
174
|
-
return await promise;
|
|
175
|
+
}
|
|
175
176
|
}
|
|
176
177
|
async directRequest(id, fsPath, _callstack) {
|
|
177
178
|
const callstack = [..._callstack, fsPath];
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as picocolors, n as normalize } from './chunk-utils-env.03f840f2.js';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.b9495318.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
6
6
|
import 'path';
|
|
@@ -16,7 +16,7 @@ import 'os';
|
|
|
16
16
|
import 'util';
|
|
17
17
|
import 'stream';
|
|
18
18
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
19
|
-
import './chunk-vite-node-source-map.
|
|
19
|
+
import './chunk-vite-node-source-map.b4ea5792.js';
|
|
20
20
|
import 'module';
|
|
21
21
|
import 'vm';
|
|
22
22
|
import './chunk-vite-node-utils.0e4a6a88.js';
|
|
@@ -38,7 +38,7 @@ import './chunk-utils-timers.793fd179.js';
|
|
|
38
38
|
import './chunk-utils-source-map.29ff1088.js';
|
|
39
39
|
import 'crypto';
|
|
40
40
|
import './vendor-index.9c919048.js';
|
|
41
|
-
import './chunk-magic-string.
|
|
41
|
+
import './chunk-magic-string.3a794426.js';
|
|
42
42
|
import 'strip-literal';
|
|
43
43
|
import 'readline';
|
|
44
44
|
import './vendor-index.9f20a9be.js';
|
package/dist/config.cjs
CHANGED
|
@@ -28,7 +28,7 @@ const coverageConfigDefaults = {
|
|
|
28
28
|
exclude: defaultCoverageExcludes,
|
|
29
29
|
reporter: ["text", "html", "clover", "json"],
|
|
30
30
|
allowExternal: false,
|
|
31
|
-
extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
31
|
+
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
32
32
|
};
|
|
33
33
|
const fakeTimersDefaults = {
|
|
34
34
|
loopLimit: 1e4,
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv } from 'vite';
|
|
3
|
-
import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-
|
|
3
|
+
import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-71ccd11d.js';
|
|
4
4
|
import 'tinybench';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'worker_threads';
|
|
@@ -51,8 +51,8 @@ interface UserConfig extends UserConfig$2 {
|
|
|
51
51
|
test?: UserConfig$2['test'];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
55
|
+
type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
56
56
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
57
57
|
|
|
58
58
|
export { UserConfig, UserConfigExport, UserConfigFn, configDefaults, defaultExclude, defaultInclude, defineConfig };
|
package/dist/config.js
CHANGED
|
@@ -24,7 +24,7 @@ const coverageConfigDefaults = {
|
|
|
24
24
|
exclude: defaultCoverageExcludes,
|
|
25
25
|
reporter: ["text", "html", "clover", "json"],
|
|
26
26
|
allowExternal: false,
|
|
27
|
-
extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
27
|
+
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
28
28
|
};
|
|
29
29
|
const fakeTimersDefaults = {
|
|
30
30
|
loopLimit: 1e4,
|
package/dist/entry.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
2
|
import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.ed987901.js';
|
|
3
|
-
import { v as vi } from './chunk-runtime-test-state.
|
|
3
|
+
import { v as vi } from './chunk-runtime-test-state.3f86f48f.js';
|
|
4
4
|
import { a as envs } from './chunk-env-node.67948209.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.5398e2c4.js';
|
|
6
6
|
import 'path';
|
|
7
7
|
import './chunk-utils-env.03f840f2.js';
|
|
8
8
|
import 'tty';
|
|
9
9
|
import 'url';
|
|
10
10
|
import 'local-pkg';
|
|
11
|
-
import './chunk-runtime-chain.
|
|
11
|
+
import './chunk-runtime-chain.f86e5250.js';
|
|
12
12
|
import 'util';
|
|
13
13
|
import 'chai';
|
|
14
14
|
import './vendor-_commonjsHelpers.addc3445.js';
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpyImpl } from 'tinyspy';
|
|
2
|
-
import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-
|
|
2
|
+
import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-71ccd11d.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;
|
|
@@ -151,7 +151,7 @@ interface MockResultThrow {
|
|
|
151
151
|
type: 'throw';
|
|
152
152
|
value: any;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
|
|
155
155
|
interface MockContext<TArgs, TReturns> {
|
|
156
156
|
calls: TArgs[];
|
|
157
157
|
instances: TReturns[];
|
|
@@ -159,14 +159,14 @@ interface MockContext<TArgs, TReturns> {
|
|
|
159
159
|
results: MockResult<TReturns>[];
|
|
160
160
|
lastCall: TArgs | undefined;
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
type Procedure = (...args: any[]) => any;
|
|
163
|
+
type Methods<T> = {
|
|
164
164
|
[K in keyof T]: T[K] extends Procedure ? K : never;
|
|
165
165
|
}[keyof T] & (string | symbol);
|
|
166
|
-
|
|
166
|
+
type Properties<T> = {
|
|
167
167
|
[K in keyof T]: T[K] extends Procedure ? never : K;
|
|
168
168
|
}[keyof T] & (string | symbol);
|
|
169
|
-
|
|
169
|
+
type Classes<T> = {
|
|
170
170
|
[K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
|
|
171
171
|
}[keyof T] & (string | symbol);
|
|
172
172
|
interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
|
|
@@ -197,41 +197,41 @@ interface PartialMock<TArgs extends any[] = any, TReturns = any> extends SpyInst
|
|
|
197
197
|
new (...args: TArgs): TReturns;
|
|
198
198
|
(...args: TArgs): TReturns;
|
|
199
199
|
}
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
type MaybeMockedConstructor<T> = T extends new (...args: Array<any>) => infer R ? Mock<ConstructorParameters<T>, R> : T;
|
|
201
|
+
type MockedFunction<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & {
|
|
202
202
|
[K in keyof T]: T[K];
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
type PartiallyMockedFunction<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & {
|
|
205
205
|
[K in keyof T]: T[K];
|
|
206
206
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
type MockedFunctionDeep<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
|
|
208
|
+
type PartiallyMockedFunctionDeep<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
|
|
209
|
+
type MockedObject<T> = MaybeMockedConstructor<T> & {
|
|
210
210
|
[K in Methods<T>]: T[K] extends Procedure ? MockedFunction<T[K]> : T[K];
|
|
211
211
|
} & {
|
|
212
212
|
[K in Properties<T>]: T[K];
|
|
213
213
|
};
|
|
214
|
-
|
|
214
|
+
type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
|
|
215
215
|
[K in Methods<T>]: T[K] extends Procedure ? MockedFunctionDeep<T[K]> : T[K];
|
|
216
216
|
} & {
|
|
217
217
|
[K in Properties<T>]: MaybeMockedDeep<T[K]>;
|
|
218
218
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
type MaybeMockedDeep<T> = T extends Procedure ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
|
220
|
+
type MaybePartiallyMockedDeep<T> = T extends Procedure ? PartiallyMockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
|
221
|
+
type MaybeMocked<T> = T extends Procedure ? MockedFunction<T> : T extends object ? MockedObject<T> : T;
|
|
222
|
+
type MaybePartiallyMocked<T> = T extends Procedure ? PartiallyMockedFunction<T> : T extends object ? MockedObject<T> : T;
|
|
223
223
|
interface Constructable {
|
|
224
224
|
new (...args: any[]): any;
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
type MockedClass<T extends Constructable> = MockInstance<T extends new (...args: infer P) => any ? P : never, InstanceType<T>> & {
|
|
227
227
|
prototype: T extends {
|
|
228
228
|
prototype: any;
|
|
229
229
|
} ? Mocked<T['prototype']> : never;
|
|
230
230
|
} & T;
|
|
231
|
-
|
|
231
|
+
type Mocked<T> = {
|
|
232
232
|
[P in keyof T]: T[P] extends (...args: infer Args) => infer Returns ? MockInstance<Args, Returns> : T[P] extends Constructable ? MockedClass<T[P]> : T[P];
|
|
233
233
|
} & T;
|
|
234
|
-
|
|
234
|
+
type EnhancedSpy<TArgs extends any[] = any[], TReturns = any> = SpyInstance<TArgs, TReturns> & SpyImpl<TArgs, TReturns>;
|
|
235
235
|
declare function spyOn<T, S extends Properties<Required<T>>>(obj: T, methodName: S, accessType: 'get'): SpyInstance<[], T[S]>;
|
|
236
236
|
declare function spyOn<T, G extends Properties<Required<T>>>(obj: T, methodName: G, accessType: 'set'): SpyInstance<[T[G]], void>;
|
|
237
237
|
declare function spyOn<T, M extends (Methods<Required<T>> | Classes<Required<T>>)>(obj: T, methodName: M): Required<T>[M] extends (...args: infer A) => infer R | (new (...args: infer A) => infer R) ? SpyInstance<A, R> : never;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-
|
|
2
|
-
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-
|
|
3
|
-
import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-
|
|
4
|
-
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-
|
|
1
|
+
import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-5aad25c1.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-5aad25c1.js';
|
|
3
|
+
import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-71ccd11d.js';
|
|
4
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-71ccd11d.js';
|
|
5
5
|
import { TransformResult } from 'vite';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-runtime-test-state.
|
|
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-runtime-test-state.
|
|
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.f86e5250.js';
|
|
2
|
+
import { e as dist } from './chunk-runtime-test-state.3f86f48f.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-runtime-test-state.3f86f48f.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as ModuleCacheMap, ay as ViteNodeRunnerOptions, az as MockMap, aA as ViteNodeRunner, aB as TestSequencer } from './types-
|
|
2
|
-
export { aB as TestSequencer, aD as TestSequencerConstructor, N as Vitest, aC as startVitest } from './types-
|
|
1
|
+
import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as ModuleCacheMap, ay as ViteNodeRunnerOptions, az as MockMap, aA as ViteNodeRunner, aB as TestSequencer } from './types-71ccd11d.js';
|
|
2
|
+
export { aB as TestSequencer, aD as TestSequencerConstructor, N as Vitest, aC as startVitest } from './types-71ccd11d.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
4
|
import 'tinybench';
|
|
5
5
|
import 'fs';
|
|
@@ -9,7 +9,7 @@ declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOver
|
|
|
9
9
|
|
|
10
10
|
declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type Key = string | symbol;
|
|
13
13
|
interface ViteRunnerRequest {
|
|
14
14
|
(dep: string): any;
|
|
15
15
|
callstack: string[];
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.b9495318.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.99b910d0.js';
|
|
3
3
|
import './chunk-utils-env.03f840f2.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
@@ -17,7 +17,7 @@ import 'util';
|
|
|
17
17
|
import 'stream';
|
|
18
18
|
import 'events';
|
|
19
19
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
20
|
-
import './chunk-vite-node-source-map.
|
|
20
|
+
import './chunk-vite-node-source-map.b4ea5792.js';
|
|
21
21
|
import 'module';
|
|
22
22
|
import 'vm';
|
|
23
23
|
import './chunk-vite-node-utils.0e4a6a88.js';
|
|
@@ -39,7 +39,7 @@ import './chunk-utils-timers.793fd179.js';
|
|
|
39
39
|
import './chunk-utils-source-map.29ff1088.js';
|
|
40
40
|
import 'crypto';
|
|
41
41
|
import './vendor-index.9c919048.js';
|
|
42
|
-
import './chunk-magic-string.
|
|
42
|
+
import './chunk-magic-string.3a794426.js';
|
|
43
43
|
import 'strip-literal';
|
|
44
44
|
import 'readline';
|
|
45
45
|
import './vendor-index.9f20a9be.js';
|
package/dist/suite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'util';
|
|
2
2
|
import 'chai';
|
|
3
3
|
import './chunk-typecheck-constants.ed987901.js';
|
|
4
|
-
export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
4
|
+
export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.f86e5250.js';
|
|
5
5
|
import 'path';
|
|
6
6
|
import './chunk-utils-env.03f840f2.js';
|
|
7
7
|
import 'tty';
|
|
@@ -211,6 +211,7 @@ interface CustomEventMap {
|
|
|
211
211
|
|
|
212
212
|
interface InvalidatePayload {
|
|
213
213
|
path: string
|
|
214
|
+
message: string | undefined
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
type InferCustomEventPayload<T extends string> =
|
|
@@ -228,22 +229,21 @@ interface ViteHotContext {
|
|
|
228
229
|
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
229
230
|
accept(
|
|
230
231
|
deps: readonly string[],
|
|
231
|
-
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
232
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
|
232
233
|
): void
|
|
233
234
|
|
|
234
|
-
acceptExports(exportNames: string | readonly string[]): void
|
|
235
235
|
acceptExports(
|
|
236
236
|
exportNames: string | readonly string[],
|
|
237
|
-
cb
|
|
237
|
+
cb?: (mod: ModuleNamespace | undefined) => void,
|
|
238
238
|
): void
|
|
239
239
|
|
|
240
240
|
dispose(cb: (data: any) => void): void
|
|
241
|
-
|
|
242
|
-
invalidate(): void
|
|
241
|
+
prune(cb: (data: any) => void): void
|
|
242
|
+
invalidate(message?: string): void
|
|
243
243
|
|
|
244
244
|
on<T extends string>(
|
|
245
245
|
event: T,
|
|
246
|
-
cb: (payload: InferCustomEventPayload<T>) => void
|
|
246
|
+
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
247
247
|
): void
|
|
248
248
|
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
|
249
249
|
}
|
|
@@ -324,10 +324,10 @@ interface FetchResult {
|
|
|
324
324
|
externalize?: string;
|
|
325
325
|
map?: RawSourceMap;
|
|
326
326
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
|
|
328
|
+
type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
329
|
+
type ResolveIdFunction$1 = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
330
|
+
type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
|
|
331
331
|
interface ModuleCache$1 {
|
|
332
332
|
promise?: Promise<any>;
|
|
333
333
|
exports?: any;
|
|
@@ -470,7 +470,7 @@ interface ErrorsCache {
|
|
|
470
470
|
files: File[];
|
|
471
471
|
sourceErrors: TypeCheckError[];
|
|
472
472
|
}
|
|
473
|
-
|
|
473
|
+
type Callback<Args extends Array<any> = []> = (...args: Args) => Awaitable<void>;
|
|
474
474
|
declare class Typechecker {
|
|
475
475
|
protected ctx: Vitest;
|
|
476
476
|
protected files: string[];
|
|
@@ -503,7 +503,7 @@ declare class Typechecker {
|
|
|
503
503
|
getTestFiles(): File[];
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
|
|
506
|
+
type RunWithFiles = (files: string[], invalidates?: string[]) => Promise<void>;
|
|
507
507
|
interface WorkerPool {
|
|
508
508
|
runTests: RunWithFiles;
|
|
509
509
|
close: () => Promise<void>;
|
|
@@ -596,7 +596,7 @@ interface CliOptions extends UserConfig {
|
|
|
596
596
|
*/
|
|
597
597
|
declare function startVitest(mode: VitestRunMode, cliFilters: string[], options: CliOptions, viteOverrides?: UserConfig$1): Promise<Vitest | undefined>;
|
|
598
598
|
|
|
599
|
-
|
|
599
|
+
type FileStatsCache = Pick<Stats, 'size'>;
|
|
600
600
|
declare class FilesStatsCache {
|
|
601
601
|
cache: Map<string, FileStatsCache>;
|
|
602
602
|
getStats(fsPath: string): FileStatsCache | undefined;
|
|
@@ -641,6 +641,7 @@ declare class Vitest {
|
|
|
641
641
|
runner: ViteNodeRunner;
|
|
642
642
|
constructor(mode: VitestRunMode);
|
|
643
643
|
private _onRestartListeners;
|
|
644
|
+
private _onSetServer;
|
|
644
645
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
645
646
|
initCoverageProvider(): Promise<CoverageProvider | null | undefined>;
|
|
646
647
|
getSerializableConfig(): ResolvedConfig;
|
|
@@ -672,9 +673,10 @@ declare class Vitest {
|
|
|
672
673
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
673
674
|
isInSourceTestFile(code: string): boolean;
|
|
674
675
|
onServerRestart(fn: OnServerRestartHandler): void;
|
|
676
|
+
onAfterSetServer(fn: OnServerRestartHandler): void;
|
|
675
677
|
}
|
|
676
678
|
|
|
677
|
-
|
|
679
|
+
type MockMap = Map<string, Record<string, string | null | (() => unknown)>>;
|
|
678
680
|
|
|
679
681
|
interface TestSequencer {
|
|
680
682
|
/**
|
|
@@ -850,7 +852,7 @@ declare const BenchmarkReportsMap: {
|
|
|
850
852
|
verbose: typeof VerboseReporter;
|
|
851
853
|
json: typeof JsonReporter;
|
|
852
854
|
};
|
|
853
|
-
|
|
855
|
+
type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
854
856
|
|
|
855
857
|
declare const ReportersMap: {
|
|
856
858
|
default: typeof DefaultReporter;
|
|
@@ -861,7 +863,7 @@ declare const ReportersMap: {
|
|
|
861
863
|
'tap-flat': typeof TapFlatReporter;
|
|
862
864
|
junit: typeof JUnitReporter;
|
|
863
865
|
};
|
|
864
|
-
|
|
866
|
+
type BuiltinReporters = keyof typeof ReportersMap;
|
|
865
867
|
|
|
866
868
|
interface RollupError extends RollupLogProps {
|
|
867
869
|
parserError?: Error;
|
|
@@ -1068,17 +1070,17 @@ interface AcornNode {
|
|
|
1068
1070
|
type: string;
|
|
1069
1071
|
}
|
|
1070
1072
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1073
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
1074
|
+
type Nullable<T> = T | null | undefined;
|
|
1075
|
+
type Arrayable<T> = T | Array<T>;
|
|
1076
|
+
type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
|
|
1077
|
+
type MergeInsertions<T> = T extends object ? {
|
|
1076
1078
|
[K in keyof T]: MergeInsertions<T[K]>;
|
|
1077
1079
|
} : T;
|
|
1078
|
-
|
|
1080
|
+
type DeepMerge<F, S> = MergeInsertions<{
|
|
1079
1081
|
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
1080
1082
|
}>;
|
|
1081
|
-
|
|
1083
|
+
type MutableArray<T extends readonly any[]> = {
|
|
1082
1084
|
-readonly [k in keyof T]: T[k];
|
|
1083
1085
|
};
|
|
1084
1086
|
interface Constructable {
|
|
@@ -1133,7 +1135,7 @@ interface ModuleGraphData {
|
|
|
1133
1135
|
externalized: string[];
|
|
1134
1136
|
inlined: string[];
|
|
1135
1137
|
}
|
|
1136
|
-
|
|
1138
|
+
type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
|
|
1137
1139
|
|
|
1138
1140
|
declare type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
1139
1141
|
declare type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
@@ -1148,7 +1150,7 @@ declare type BirpcReturn<RemoteFunctions> = {
|
|
|
1148
1150
|
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
1149
1151
|
};
|
|
1150
1152
|
|
|
1151
|
-
|
|
1153
|
+
type ChainableFunction<T extends string, Args extends any[], R = any, E = {}> = {
|
|
1152
1154
|
(...args: Args): R;
|
|
1153
1155
|
} & {
|
|
1154
1156
|
[x in T]: ChainableFunction<T, Args, R, E>;
|
|
@@ -1196,8 +1198,8 @@ interface BenchmarkResult extends TaskResult$1 {
|
|
|
1196
1198
|
name: string;
|
|
1197
1199
|
rank: number;
|
|
1198
1200
|
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
+
type BenchFunction = (this: Bench) => Promise<void> | void;
|
|
1202
|
+
type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
|
|
1201
1203
|
name: string,
|
|
1202
1204
|
fn?: BenchFunction,
|
|
1203
1205
|
options?: Options
|
|
@@ -1206,8 +1208,8 @@ declare type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
|
|
|
1206
1208
|
runIf(condition: any): BenchmarkAPI;
|
|
1207
1209
|
};
|
|
1208
1210
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
+
type RunMode = 'run' | 'skip' | 'only' | 'todo';
|
|
1212
|
+
type TaskState = RunMode | 'pass' | 'fail';
|
|
1211
1213
|
interface TaskBase {
|
|
1212
1214
|
id: string;
|
|
1213
1215
|
name: string;
|
|
@@ -1231,7 +1233,7 @@ interface TaskResult {
|
|
|
1231
1233
|
benchmark?: BenchmarkResult;
|
|
1232
1234
|
retryCount?: number;
|
|
1233
1235
|
}
|
|
1234
|
-
|
|
1236
|
+
type TaskResultPack = [id: string, result: TaskResult | undefined];
|
|
1235
1237
|
interface Suite extends TaskBase {
|
|
1236
1238
|
type: 'suite';
|
|
1237
1239
|
tasks: Task[];
|
|
@@ -1254,10 +1256,10 @@ interface Test<ExtraContext = {}> extends TaskBase {
|
|
|
1254
1256
|
interface TypeCheck extends TaskBase {
|
|
1255
1257
|
type: 'typecheck';
|
|
1256
1258
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1259
|
+
type Task = Test | Suite | File | Benchmark | TypeCheck;
|
|
1260
|
+
type DoneCallback = (error?: any) => void;
|
|
1261
|
+
type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<any> | void;
|
|
1262
|
+
type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
|
|
1261
1263
|
1: [T[0]];
|
|
1262
1264
|
2: [T[0], T[1]];
|
|
1263
1265
|
3: [T[0], T[1], T[2]];
|
|
@@ -1281,7 +1283,7 @@ interface TestEachFunction {
|
|
|
1281
1283
|
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1282
1284
|
(...args: [TemplateStringsArray, ...any]): (name: string, fn: (...args: any[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1283
1285
|
}
|
|
1284
|
-
|
|
1286
|
+
type ChainableTestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
|
1285
1287
|
name: string,
|
|
1286
1288
|
fn?: TestFunction<ExtraContext>,
|
|
1287
1289
|
options?: number | TestOptions
|
|
@@ -1302,12 +1304,12 @@ interface TestOptions {
|
|
|
1302
1304
|
*/
|
|
1303
1305
|
retry?: number;
|
|
1304
1306
|
}
|
|
1305
|
-
|
|
1307
|
+
type TestAPI<ExtraContext = {}> = ChainableTestAPI<ExtraContext> & {
|
|
1306
1308
|
each: TestEachFunction;
|
|
1307
1309
|
skipIf(condition: any): ChainableTestAPI<ExtraContext>;
|
|
1308
1310
|
runIf(condition: any): ChainableTestAPI<ExtraContext>;
|
|
1309
1311
|
};
|
|
1310
|
-
|
|
1312
|
+
type ChainableSuiteAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'shuffle', [
|
|
1311
1313
|
name: string,
|
|
1312
1314
|
factory?: SuiteFactory<ExtraContext>,
|
|
1313
1315
|
options?: number | TestOptions
|
|
@@ -1315,13 +1317,13 @@ declare type ChainableSuiteAPI<ExtraContext = {}> = ChainableFunction<'concurren
|
|
|
1315
1317
|
each: TestEachFunction;
|
|
1316
1318
|
<T extends ExtraContext>(name: string, factory?: SuiteFactory<T>): SuiteCollector<T>;
|
|
1317
1319
|
}>;
|
|
1318
|
-
|
|
1320
|
+
type SuiteAPI<ExtraContext = {}> = ChainableSuiteAPI<ExtraContext> & {
|
|
1319
1321
|
each: SuiteEachFunction;
|
|
1320
1322
|
skipIf(condition: any): ChainableSuiteAPI<ExtraContext>;
|
|
1321
1323
|
runIf(condition: any): ChainableSuiteAPI<ExtraContext>;
|
|
1322
1324
|
};
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
+
type HookListener<T extends any[], Return = void> = (...args: T) => Awaitable<Return>;
|
|
1326
|
+
type HookCleanupCallback = (() => Awaitable<unknown>) | void;
|
|
1325
1327
|
interface SuiteHooks<ExtraContext = {}> {
|
|
1326
1328
|
beforeAll: HookListener<[Suite | File], HookCleanupCallback>[];
|
|
1327
1329
|
afterAll: HookListener<[Suite | File]>[];
|
|
@@ -1339,7 +1341,7 @@ interface SuiteCollector<ExtraContext = {}> {
|
|
|
1339
1341
|
clear: () => void;
|
|
1340
1342
|
on: <T extends keyof SuiteHooks<ExtraContext>>(name: T, ...fn: SuiteHooks<ExtraContext>[T]) => void;
|
|
1341
1343
|
}
|
|
1342
|
-
|
|
1344
|
+
type SuiteFactory<ExtraContext = {}> = (test: (name: string, fn: TestFunction<ExtraContext>) => void) => Awaitable<void>;
|
|
1343
1345
|
interface RuntimeContext {
|
|
1344
1346
|
tasks: (SuiteCollector | Test)[];
|
|
1345
1347
|
currentSuite: SuiteCollector | null;
|
|
@@ -1358,10 +1360,10 @@ interface TestContext {
|
|
|
1358
1360
|
*/
|
|
1359
1361
|
onTestFailed: (fn: OnTestFailedHandler) => void;
|
|
1360
1362
|
}
|
|
1361
|
-
|
|
1363
|
+
type OnTestFailedHandler = (result: TaskResult) => Awaitable<void>;
|
|
1362
1364
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
+
type SnapshotData = Record<string, string>;
|
|
1366
|
+
type SnapshotUpdateState = 'all' | 'new' | 'none';
|
|
1365
1367
|
interface SnapshotStateOptions {
|
|
1366
1368
|
updateSnapshot: SnapshotUpdateState;
|
|
1367
1369
|
expand?: boolean;
|
|
@@ -1414,7 +1416,7 @@ interface WorkerContext {
|
|
|
1414
1416
|
files: string[];
|
|
1415
1417
|
invalidates?: string[];
|
|
1416
1418
|
}
|
|
1417
|
-
|
|
1419
|
+
type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
1418
1420
|
interface AfterSuiteRunMeta {
|
|
1419
1421
|
coverage?: unknown;
|
|
1420
1422
|
}
|
|
@@ -1464,15 +1466,15 @@ interface CoverageProviderModule {
|
|
|
1464
1466
|
*/
|
|
1465
1467
|
takeCoverage?(): unknown | Promise<unknown>;
|
|
1466
1468
|
}
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
+
type CoverageReporter = 'clover' | 'cobertura' | 'html-spa' | 'html' | 'json-summary' | 'json' | 'lcov' | 'lcovonly' | 'none' | 'teamcity' | 'text-lcov' | 'text-summary' | 'text';
|
|
1470
|
+
type CoverageOptions = BaseCoverageOptions & {
|
|
1469
1471
|
provider?: null | CoverageProviderModule;
|
|
1470
1472
|
} | CoverageC8Options & {
|
|
1471
1473
|
provider?: 'c8';
|
|
1472
1474
|
} | CoverageIstanbulOptions & {
|
|
1473
1475
|
provider?: 'istanbul';
|
|
1474
1476
|
};
|
|
1475
|
-
|
|
1477
|
+
type ResolvedCoverageOptions = {
|
|
1476
1478
|
tempDirectory: string;
|
|
1477
1479
|
} & Required<CoverageOptions>;
|
|
1478
1480
|
interface BaseCoverageOptions {
|
|
@@ -1704,11 +1706,11 @@ interface Reporter {
|
|
|
1704
1706
|
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
|
|
1705
1707
|
}
|
|
1706
1708
|
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1709
|
+
type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
1710
|
+
type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
|
|
1711
|
+
type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
|
|
1712
|
+
type SequenceHooks = 'stack' | 'list' | 'parallel';
|
|
1713
|
+
type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
|
|
1712
1714
|
|
|
1713
1715
|
interface EnvironmentOptions {
|
|
1714
1716
|
/**
|
|
@@ -1717,7 +1719,7 @@ interface EnvironmentOptions {
|
|
|
1717
1719
|
jsdom?: JSDOMOptions;
|
|
1718
1720
|
[x: string]: unknown;
|
|
1719
1721
|
}
|
|
1720
|
-
|
|
1722
|
+
type VitestRunMode = 'test' | 'benchmark' | 'typecheck';
|
|
1721
1723
|
interface InlineConfig {
|
|
1722
1724
|
/**
|
|
1723
1725
|
* Benchmark options.
|
|
@@ -2188,13 +2190,13 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2188
2190
|
};
|
|
2189
2191
|
typecheck: TypecheckConfig;
|
|
2190
2192
|
}
|
|
2191
|
-
|
|
2193
|
+
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
2192
2194
|
sequence?: {
|
|
2193
2195
|
hooks?: SequenceHooks;
|
|
2194
2196
|
};
|
|
2195
2197
|
};
|
|
2196
2198
|
|
|
2197
|
-
|
|
2199
|
+
type VitestInlineConfig = InlineConfig;
|
|
2198
2200
|
declare module 'vite' {
|
|
2199
2201
|
interface UserConfig {
|
|
2200
2202
|
/**
|
|
@@ -2204,7 +2206,7 @@ declare module 'vite' {
|
|
|
2204
2206
|
}
|
|
2205
2207
|
}
|
|
2206
2208
|
|
|
2207
|
-
|
|
2209
|
+
type Formatter = (input: string | number | null | undefined) => string;
|
|
2208
2210
|
|
|
2209
2211
|
interface MatcherHintOptions {
|
|
2210
2212
|
comment?: string;
|
|
@@ -2320,7 +2322,7 @@ declare class SnapshotState {
|
|
|
2320
2322
|
pack(): Promise<SnapshotResult>;
|
|
2321
2323
|
}
|
|
2322
2324
|
|
|
2323
|
-
|
|
2325
|
+
type Tester = (a: any, b: any) => boolean | undefined;
|
|
2324
2326
|
interface MatcherState {
|
|
2325
2327
|
assertionCalls: number;
|
|
2326
2328
|
currentTestName?: string;
|
|
@@ -2349,14 +2351,14 @@ interface SyncExpectationResult {
|
|
|
2349
2351
|
actual?: any;
|
|
2350
2352
|
expected?: any;
|
|
2351
2353
|
}
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
+
type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
|
2355
|
+
type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
|
2354
2356
|
interface RawMatcherFn<T extends MatcherState = MatcherState> {
|
|
2355
2357
|
(this: T, received: any, expected: any, options?: any): ExpectationResult;
|
|
2356
2358
|
}
|
|
2357
|
-
|
|
2359
|
+
type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;
|
|
2358
2360
|
|
|
2359
|
-
|
|
2361
|
+
type Promisify<O> = {
|
|
2360
2362
|
[K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
|
|
2361
2363
|
};
|
|
2362
2364
|
declare global {
|
|
@@ -2455,7 +2457,7 @@ declare global {
|
|
|
2455
2457
|
}
|
|
2456
2458
|
}
|
|
2457
2459
|
|
|
2458
|
-
|
|
2460
|
+
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
2459
2461
|
interface TscErrorInfo {
|
|
2460
2462
|
filePath: string;
|
|
2461
2463
|
errCode: number;
|
|
@@ -2468,14 +2470,14 @@ interface CollectLineNumbers {
|
|
|
2468
2470
|
next: number;
|
|
2469
2471
|
prev?: number;
|
|
2470
2472
|
}
|
|
2471
|
-
|
|
2473
|
+
type CollectLines = {
|
|
2472
2474
|
[key in keyof CollectLineNumbers]: string;
|
|
2473
2475
|
};
|
|
2474
2476
|
interface RootAndTarget {
|
|
2475
2477
|
root: string;
|
|
2476
2478
|
targetAbsPath: string;
|
|
2477
2479
|
}
|
|
2478
|
-
|
|
2480
|
+
type Context = RootAndTarget & {
|
|
2479
2481
|
rawErrsMap: RawErrsMap;
|
|
2480
2482
|
openedDirs: Set<string>;
|
|
2481
2483
|
lastActivePath?: string;
|
package/dist/worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { b as resolve, e as distDir } from './chunk-utils-env.03f840f2.js';
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-source-map.
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-source-map.b4ea5792.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { g as getWorkerState } from './chunk-typecheck-constants.ed987901.js';
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.99b910d0.js';
|
|
6
6
|
import { r as rpc } from './chunk-runtime-rpc.42aebbb9.js';
|
|
7
7
|
import { p as processError } from './chunk-runtime-error.616e92ca.js';
|
|
8
8
|
import 'tty';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.8",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@types/chai": "^4.3.
|
|
103
|
+
"@types/chai": "^4.3.4",
|
|
104
104
|
"@types/chai-subset": "^1.3.3",
|
|
105
105
|
"@types/node": "*",
|
|
106
|
-
"acorn": "^8.8.
|
|
106
|
+
"acorn": "^8.8.1",
|
|
107
107
|
"acorn-walk": "^8.2.0",
|
|
108
|
-
"chai": "^4.3.
|
|
108
|
+
"chai": "^4.3.7",
|
|
109
109
|
"debug": "^4.3.4",
|
|
110
110
|
"local-pkg": "^0.4.2",
|
|
111
111
|
"source-map": "^0.6.1",
|
|
@@ -113,19 +113,18 @@
|
|
|
113
113
|
"tinybench": "^2.3.1",
|
|
114
114
|
"tinypool": "^0.3.0",
|
|
115
115
|
"tinyspy": "^1.0.2",
|
|
116
|
-
"vite": "^3.0.0"
|
|
116
|
+
"vite": "^3.0.0 || ^4.0.0"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@antfu/install-pkg": "^0.1.1",
|
|
120
|
-
"@edge-runtime/vm": "2.0.
|
|
120
|
+
"@edge-runtime/vm": "2.0.2",
|
|
121
121
|
"@sinonjs/fake-timers": "^10.0.0",
|
|
122
122
|
"@types/diff": "^5.0.2",
|
|
123
|
-
"@types/jsdom": "^20.0.
|
|
123
|
+
"@types/jsdom": "^20.0.1",
|
|
124
124
|
"@types/micromatch": "^4.0.2",
|
|
125
125
|
"@types/natural-compare": "^1.4.1",
|
|
126
|
-
"@types/prompts": "^2.4.
|
|
126
|
+
"@types/prompts": "^2.4.2",
|
|
127
127
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
128
|
-
"@vitest/ui": "0.25.6",
|
|
129
128
|
"birpc": "^0.2.3",
|
|
130
129
|
"cac": "^6.7.14",
|
|
131
130
|
"chai-subset": "^1.6.0",
|
|
@@ -138,10 +137,10 @@
|
|
|
138
137
|
"find-up": "^6.3.0",
|
|
139
138
|
"flatted": "^3.2.7",
|
|
140
139
|
"get-tsconfig": "^4.2.0",
|
|
141
|
-
"happy-dom": "^7.
|
|
142
|
-
"jsdom": "^20.0.
|
|
140
|
+
"happy-dom": "^7.8.1",
|
|
141
|
+
"jsdom": "^20.0.3",
|
|
143
142
|
"log-update": "^5.0.1",
|
|
144
|
-
"magic-string": "^0.
|
|
143
|
+
"magic-string": "^0.27.0",
|
|
145
144
|
"micromatch": "^4.0.5",
|
|
146
145
|
"mlly": "^1.0.0",
|
|
147
146
|
"natural-compare": "^1.4.0",
|
|
@@ -153,9 +152,10 @@
|
|
|
153
152
|
"prompts": "^2.4.2",
|
|
154
153
|
"rollup": "^2.79.1",
|
|
155
154
|
"strip-ansi": "^7.0.1",
|
|
156
|
-
"typescript": "^4.
|
|
157
|
-
"
|
|
158
|
-
"
|
|
155
|
+
"typescript": "^4.9.4",
|
|
156
|
+
"ws": "^8.11.0",
|
|
157
|
+
"@vitest/ui": "0.25.8",
|
|
158
|
+
"vite-node": "0.25.8"
|
|
159
159
|
},
|
|
160
160
|
"scripts": {
|
|
161
161
|
"build": "rimraf dist && rollup -c",
|