vitest 0.21.0 → 0.22.1
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 +61 -4
- package/dist/browser.d.ts +4 -5
- package/dist/browser.mjs +9 -9
- package/dist/{chunk-api-setup.89eb0e7a.mjs → chunk-api-setup.377c28aa.mjs} +9 -9
- package/dist/chunk-constants.71e8a211.mjs +284 -0
- package/dist/{chunk-install-pkg.6c6dc0c2.mjs → chunk-install-pkg.3aa3eae6.mjs} +3 -2
- package/dist/{chunk-defaults.8390340d.mjs → chunk-integrations-coverage.d205bd87.mjs} +23 -152
- package/dist/{chunk-integrations-globals.a798d352.mjs → chunk-integrations-globals.60af7da3.mjs} +8 -8
- package/dist/{chunk-mock-date.ea3b3121.mjs → chunk-mock-date.304e29b1.mjs} +11 -255
- package/dist/chunk-node-git.9a7e3153.mjs +78 -0
- package/dist/{chunk-runtime-chain.44b4224d.mjs → chunk-runtime-chain.be610650.mjs} +4 -3
- package/dist/{chunk-runtime-error.95e53764.mjs → chunk-runtime-error.1104e45a.mjs} +13 -12
- package/dist/{chunk-runtime-hooks.291644ec.mjs → chunk-runtime-hooks.5d7073db.mjs} +3 -3
- package/dist/{chunk-runtime-mocker.6190d6a3.mjs → chunk-runtime-mocker.49d21aa6.mjs} +19 -5
- package/dist/{chunk-runtime-rpc.fc50dcc0.mjs → chunk-runtime-rpc.57586b73.mjs} +1 -1
- package/dist/{chunk-utils-source-map.d307e4ea.mjs → chunk-utils-source-map.bbf3ad19.mjs} +2 -1
- package/dist/{chunk-vite-node-client.b59ba135.mjs → chunk-vite-node-client.cddda63d.mjs} +49 -21
- package/dist/{chunk-vite-node-debug.dbce2e1f.mjs → chunk-vite-node-debug.536c4c5b.mjs} +3 -3
- package/dist/{chunk-vite-node-externalize.80bed9b3.mjs → chunk-vite-node-externalize.c843f497.mjs} +186 -50
- package/dist/chunk-vite-node-utils.b432150c.mjs +6921 -0
- package/dist/cli-wrapper.mjs +124 -0
- package/dist/cli.mjs +16 -15
- package/dist/config.cjs +3 -0
- package/dist/config.d.ts +6 -3
- package/dist/config.mjs +2 -1
- package/dist/entry.mjs +9 -9
- package/dist/{global-644546f7.d.ts → global-fe52f84b.d.ts} +512 -177
- package/dist/{index-3f764034.d.ts → index-ea17aa0c.d.ts} +4 -52
- package/dist/index.d.ts +5 -6
- package/dist/index.mjs +7 -5
- package/dist/loader.mjs +4 -3
- package/dist/node.d.ts +3 -3
- package/dist/node.mjs +16 -15
- package/dist/suite.mjs +6 -4
- package/dist/{vendor-index.61438b77.mjs → vendor-index.29636037.mjs} +1 -61
- package/dist/{vendor-index.62ce5c33.mjs → vendor-index.2ae8040a.mjs} +0 -0
- package/dist/vendor-index.9d9196cc.mjs +61 -0
- package/dist/{vendor-index.de788b6a.mjs → vendor-index.ae96af6e.mjs} +14 -14
- package/dist/{chunk-node-git.e0dc0a7e.mjs → vendor-index.fbec8a81.mjs} +5 -73
- package/dist/worker.mjs +9 -9
- package/package.json +9 -13
- package/vitest.mjs +1 -1
- package/dist/chunk-constants.9da1ef26.mjs +0 -38
- package/dist/chunk-vite-node-utils.96438e82.mjs +0 -1114
- package/dist/mocker-5e2a8e41.d.ts +0 -3
|
@@ -1,53 +1,5 @@
|
|
|
1
|
-
import { MessagePort } from 'worker_threads';
|
|
2
|
-
import { R as ResolvedConfig, a2 as ViteNodeResolveId, a3 as FetchFunction, a4 as RawSourceMap, a as File, X as UserConsoleLog, T as TaskResultPack, v as SnapshotResult, g as Test, a5 as ModuleCacheMap, k as SuiteAPI, j as TestAPI, m as SuiteHooks } from './global-644546f7.js';
|
|
3
|
-
import { M as MockMap } from './mocker-5e2a8e41.js';
|
|
4
1
|
import { SpyImpl } from 'tinyspy';
|
|
5
|
-
|
|
6
|
-
declare type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
7
|
-
declare type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
8
|
-
declare type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
|
|
9
|
-
declare type BirpcFn<T> = PromisifyFn<T> & {
|
|
10
|
-
/**
|
|
11
|
-
* Send event without asking for response
|
|
12
|
-
*/
|
|
13
|
-
asEvent(...args: ArgumentsType<T>): void;
|
|
14
|
-
};
|
|
15
|
-
declare type BirpcReturn<RemoteFunctions> = {
|
|
16
|
-
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
interface WorkerContext {
|
|
20
|
-
workerId: number;
|
|
21
|
-
port: MessagePort;
|
|
22
|
-
config: ResolvedConfig;
|
|
23
|
-
files: string[];
|
|
24
|
-
invalidates?: string[];
|
|
25
|
-
}
|
|
26
|
-
declare type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
27
|
-
interface WorkerRPC {
|
|
28
|
-
fetch: FetchFunction;
|
|
29
|
-
resolveId: ResolveIdFunction;
|
|
30
|
-
getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
|
|
31
|
-
onFinished: (files: File[], errors?: unknown[]) => void;
|
|
32
|
-
onWorkerExit: (code?: number) => void;
|
|
33
|
-
onPathsCollected: (paths: string[]) => void;
|
|
34
|
-
onUserConsoleLog: (log: UserConsoleLog) => void;
|
|
35
|
-
onUnhandledRejection: (err: unknown) => void;
|
|
36
|
-
onCollected: (files: File[]) => void;
|
|
37
|
-
onTaskUpdate: (pack: TaskResultPack[]) => void;
|
|
38
|
-
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
39
|
-
resolveSnapshotPath: (testPath: string) => string;
|
|
40
|
-
}
|
|
41
|
-
interface WorkerGlobalState {
|
|
42
|
-
ctx: WorkerContext;
|
|
43
|
-
config: ResolvedConfig;
|
|
44
|
-
rpc: BirpcReturn<WorkerRPC>;
|
|
45
|
-
current?: Test;
|
|
46
|
-
filepath?: string;
|
|
47
|
-
moduleCache: ModuleCacheMap;
|
|
48
|
-
browserHashMap?: Map<string, string>;
|
|
49
|
-
mockMap: MockMap;
|
|
50
|
-
}
|
|
2
|
+
import { k as SuiteAPI, j as TestAPI, m as SuiteHooks, H as HookListener, q as TestContext, S as Suite, l as HookCleanupCallback, g as Test } from './global-fe52f84b.js';
|
|
51
3
|
|
|
52
4
|
interface MockResultReturn<T> {
|
|
53
5
|
type: 'return';
|
|
@@ -155,10 +107,10 @@ declare const it: TestAPI<{}>;
|
|
|
155
107
|
|
|
156
108
|
declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number) => void;
|
|
157
109
|
declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number) => void;
|
|
158
|
-
declare const beforeEach: (fn:
|
|
159
|
-
declare const afterEach: (fn:
|
|
110
|
+
declare const beforeEach: <ExtraContext = {}>(fn: HookListener<[TestContext & ExtraContext, Suite], HookCleanupCallback>, timeout?: number) => void;
|
|
111
|
+
declare const afterEach: <ExtraContext = {}>(fn: HookListener<[TestContext & ExtraContext, Suite], void>, timeout?: number) => void;
|
|
160
112
|
|
|
161
113
|
declare function createExpect(test?: Test): Vi.ExpectStatic;
|
|
162
114
|
declare const globalExpect: Vi.ExpectStatic;
|
|
163
115
|
|
|
164
|
-
export { EnhancedSpy as E, MaybeMockedDeep as M,
|
|
116
|
+
export { EnhancedSpy as E, MaybeMockedDeep as M, SpyInstance as S, MaybeMocked as a, MaybePartiallyMocked as b, MaybePartiallyMockedDeep as c, suite as d, describe as e, fn as f, beforeAll as g, afterAll as h, it as i, beforeEach as j, afterEach as k, globalExpect as l, createExpect as m, MockedFunction as n, MockedObject as o, MockInstance as p, Mock as q, MockContext as r, spyOn as s, test as t, Mocked as u, MockedClass as v };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-
|
|
2
|
-
export { E as EnhancedSpy, q as Mock, r as MockContext, p as MockInstance, u as Mocked, v as MockedClass, n as MockedFunction, o as MockedObject,
|
|
3
|
-
import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-
|
|
4
|
-
export { A as ApiConfig,
|
|
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-ea17aa0c.js';
|
|
2
|
+
export { E as EnhancedSpy, q as Mock, r as MockContext, p as MockInstance, u as Mocked, v as MockedClass, n as MockedFunction, o as MockedObject, S as SpyInstance, h as afterAll, k as afterEach, g as beforeAll, j as beforeEach, m as createExpect, e as describe, l as expect, i as it, d as suite, t as test } from './index-ea17aa0c.js';
|
|
3
|
+
import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-fe52f84b.js';
|
|
4
|
+
export { z as AfterSuiteRunMeta, A as ApiConfig, O as ArgumentsType, L as Arrayable, K as Awaitable, aa as BaseCoverageOptions, B as BuiltinEnvironment, Y as Constructable, ac as CoverageC8Options, ab as CoverageIstanbulOptions, a8 as CoverageOptions, a5 as CoverageProvider, a6 as CoverageProviderModule, a7 as CoverageReporter, Q as DeepMerge, D as DoneCallback, $ as Environment, E as EnvironmentOptions, _ as EnvironmentReturn, a3 as ErrorWithDiff, a as File, l as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, P as MergeInsertions, Z as ModuleCache, M as ModuleGraphData, X as MutableArray, N as Nullable, a4 as OnServerRestartHandler, a2 as ParsedStack, a1 as Position, b as Reporter, y as ResolveIdFunction, R as ResolvedConfig, a9 as ResolvedCoverageOptions, c as RunMode, p as RuntimeContext, r as SnapshotData, u as SnapshotMatchOptions, v as SnapshotResult, t as SnapshotStateOptions, x as SnapshotSummary, s as SnapshotUpdateState, S as Suite, k as SuiteAPI, n as SuiteCollector, o as SuiteFactory, m as SuiteHooks, h as Task, e as TaskBase, f as TaskResult, T as TaskResultPack, d as TaskState, g as Test, j as TestAPI, q as TestContext, i as TestFunction, w as UncheckedSnapshot, U as UserConfig, a0 as UserConsoleLog, V as Vitest, W as WorkerContext, G as WorkerGlobalState, C as WorkerRPC } from './global-fe52f84b.js';
|
|
5
5
|
import { TransformResult } from 'vite';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
|
8
8
|
export { assert, should } from 'chai';
|
|
9
|
-
import 'worker_threads';
|
|
10
|
-
import './mocker-5e2a8e41.js';
|
|
11
9
|
import 'tinyspy';
|
|
10
|
+
import 'worker_threads';
|
|
12
11
|
import 'fs';
|
|
13
12
|
|
|
14
13
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.
|
|
1
|
+
export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.be610650.mjs';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.5d7073db.mjs';
|
|
3
3
|
import * as chai from 'chai';
|
|
4
4
|
export { chai };
|
|
5
5
|
export { assert, should } from 'chai';
|
|
6
6
|
import 'util';
|
|
7
|
-
import './chunk-mock-date.
|
|
7
|
+
import './chunk-mock-date.304e29b1.mjs';
|
|
8
8
|
import 'path';
|
|
9
|
+
import './chunk-constants.71e8a211.mjs';
|
|
9
10
|
import 'tty';
|
|
11
|
+
import 'url';
|
|
10
12
|
import 'local-pkg';
|
|
11
13
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
14
|
+
import './chunk-runtime-rpc.57586b73.mjs';
|
|
13
15
|
import './chunk-utils-global.fa20c2f6.mjs';
|
|
14
16
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
15
17
|
import 'fs';
|
|
16
|
-
import './chunk-utils-source-map.
|
|
18
|
+
import './chunk-utils-source-map.bbf3ad19.mjs';
|
|
17
19
|
import './spy.mjs';
|
|
18
20
|
import 'tinyspy';
|
package/dist/loader.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { pathToFileURL } from 'url';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
|
-
import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.
|
|
4
|
-
import './chunk-mock-date.
|
|
3
|
+
import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.b432150c.mjs';
|
|
4
|
+
import './chunk-mock-date.304e29b1.mjs';
|
|
5
5
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
6
6
|
import 'module';
|
|
7
|
-
import 'path';
|
|
8
7
|
import 'fs';
|
|
8
|
+
import 'path';
|
|
9
9
|
import 'assert';
|
|
10
10
|
import 'util';
|
|
11
|
+
import './chunk-constants.71e8a211.mjs';
|
|
11
12
|
import 'tty';
|
|
12
13
|
import 'local-pkg';
|
|
13
14
|
|
package/dist/node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { U as UserConfig, V as Vitest,
|
|
2
|
-
export {
|
|
1
|
+
import { U as UserConfig, V as Vitest, ad as ModuleCacheMap, ae as ViteNodeRunnerOptions, af as MockMap, ag as ViteNodeRunner, ah as TestSequencer } from './global-fe52f84b.js';
|
|
2
|
+
export { ah as TestSequencer, aj as TestSequencerConstructor, V as Vitest, ai as startVitest } from './global-fe52f84b.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
|
-
import
|
|
4
|
+
import 'worker_threads';
|
|
5
5
|
import 'fs';
|
|
6
6
|
|
|
7
7
|
declare function createVitest(options: UserConfig, viteOverrides?: UserConfig$1): Promise<Vitest>;
|
package/dist/node.mjs
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
3
|
-
import './chunk-
|
|
4
|
-
import 'path';
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.c843f497.mjs';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.49d21aa6.mjs';
|
|
3
|
+
import './chunk-constants.71e8a211.mjs';
|
|
5
4
|
import 'tty';
|
|
6
|
-
import 'local-pkg';
|
|
7
|
-
import './chunk-defaults.8390340d.mjs';
|
|
8
|
-
import 'fs';
|
|
9
|
-
import 'module';
|
|
10
5
|
import 'url';
|
|
6
|
+
import 'path';
|
|
7
|
+
import './chunk-integrations-coverage.d205bd87.mjs';
|
|
8
|
+
import 'local-pkg';
|
|
9
|
+
import './chunk-mock-date.304e29b1.mjs';
|
|
11
10
|
import 'vite';
|
|
12
11
|
import 'process';
|
|
13
|
-
import '
|
|
12
|
+
import 'fs';
|
|
14
13
|
import 'os';
|
|
15
14
|
import 'util';
|
|
16
15
|
import 'stream';
|
|
17
16
|
import 'events';
|
|
18
17
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
19
|
-
import './chunk-vite-node-client.
|
|
18
|
+
import './chunk-vite-node-client.cddda63d.mjs';
|
|
19
|
+
import 'module';
|
|
20
20
|
import 'vm';
|
|
21
|
-
import './chunk-vite-node-utils.
|
|
21
|
+
import './chunk-vite-node-utils.b432150c.mjs';
|
|
22
22
|
import 'assert';
|
|
23
23
|
import 'debug';
|
|
24
|
+
import 'perf_hooks';
|
|
24
25
|
import 'worker_threads';
|
|
25
26
|
import 'tinypool';
|
|
26
|
-
import '
|
|
27
|
-
import './chunk-utils-source-map.d307e4ea.mjs';
|
|
27
|
+
import './chunk-utils-source-map.bbf3ad19.mjs';
|
|
28
28
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
29
29
|
import 'crypto';
|
|
30
|
-
import './vendor-index.
|
|
30
|
+
import './vendor-index.9d9196cc.mjs';
|
|
31
|
+
import './vendor-index.29636037.mjs';
|
|
31
32
|
import './chunk-magic-string.efe26975.mjs';
|
|
32
33
|
import 'readline';
|
|
33
|
-
import './vendor-index.
|
|
34
|
+
import './vendor-index.ae96af6e.mjs';
|
|
34
35
|
import './chunk-utils-global.fa20c2f6.mjs';
|
package/dist/suite.mjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import 'util';
|
|
2
|
-
import './chunk-mock-date.
|
|
3
|
-
export { e as clearCollectorContext, o as createSuiteHooks, f as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
+
import './chunk-mock-date.304e29b1.mjs';
|
|
3
|
+
export { e as clearCollectorContext, o as createSuiteHooks, f as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.be610650.mjs';
|
|
4
4
|
import './chunk-utils-global.fa20c2f6.mjs';
|
|
5
5
|
import 'path';
|
|
6
|
+
import './chunk-constants.71e8a211.mjs';
|
|
6
7
|
import 'tty';
|
|
8
|
+
import 'url';
|
|
7
9
|
import 'local-pkg';
|
|
8
10
|
import 'chai';
|
|
9
11
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
10
|
-
import './chunk-runtime-rpc.
|
|
12
|
+
import './chunk-runtime-rpc.57586b73.mjs';
|
|
11
13
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
12
14
|
import 'fs';
|
|
13
|
-
import './chunk-utils-source-map.
|
|
15
|
+
import './chunk-utils-source-map.bbf3ad19.mjs';
|
|
14
16
|
import './spy.mjs';
|
|
15
17
|
import 'tinyspy';
|
|
@@ -2,66 +2,6 @@ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
|
2
2
|
import assert$1 from 'assert';
|
|
3
3
|
import require$$2 from 'events';
|
|
4
4
|
|
|
5
|
-
var onetime$1 = {exports: {}};
|
|
6
|
-
|
|
7
|
-
var mimicFn$2 = {exports: {}};
|
|
8
|
-
|
|
9
|
-
const mimicFn$1 = (to, from) => {
|
|
10
|
-
for (const prop of Reflect.ownKeys(from)) {
|
|
11
|
-
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
mimicFn$2.exports = mimicFn$1;
|
|
18
|
-
// TODO: Remove this for the next major release
|
|
19
|
-
mimicFn$2.exports.default = mimicFn$1;
|
|
20
|
-
|
|
21
|
-
const mimicFn = mimicFn$2.exports;
|
|
22
|
-
|
|
23
|
-
const calledFunctions = new WeakMap();
|
|
24
|
-
|
|
25
|
-
const onetime = (function_, options = {}) => {
|
|
26
|
-
if (typeof function_ !== 'function') {
|
|
27
|
-
throw new TypeError('Expected a function');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let returnValue;
|
|
31
|
-
let callCount = 0;
|
|
32
|
-
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
33
|
-
|
|
34
|
-
const onetime = function (...arguments_) {
|
|
35
|
-
calledFunctions.set(onetime, ++callCount);
|
|
36
|
-
|
|
37
|
-
if (callCount === 1) {
|
|
38
|
-
returnValue = function_.apply(this, arguments_);
|
|
39
|
-
function_ = null;
|
|
40
|
-
} else if (options.throw === true) {
|
|
41
|
-
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return returnValue;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
mimicFn(onetime, function_);
|
|
48
|
-
calledFunctions.set(onetime, callCount);
|
|
49
|
-
|
|
50
|
-
return onetime;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
onetime$1.exports = onetime;
|
|
54
|
-
// TODO: Remove this for the next major release
|
|
55
|
-
onetime$1.exports.default = onetime;
|
|
56
|
-
|
|
57
|
-
onetime$1.exports.callCount = function_ => {
|
|
58
|
-
if (!calledFunctions.has(function_)) {
|
|
59
|
-
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return calledFunctions.get(function_);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
5
|
var signalExit = {exports: {}};
|
|
66
6
|
|
|
67
7
|
var signals$1 = {exports: {}};
|
|
@@ -332,4 +272,4 @@ if (!processOk(process$1)) {
|
|
|
332
272
|
};
|
|
333
273
|
}
|
|
334
274
|
|
|
335
|
-
export {
|
|
275
|
+
export { signalExit as s };
|
|
File without changes
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var onetime$1 = {exports: {}};
|
|
2
|
+
|
|
3
|
+
var mimicFn$2 = {exports: {}};
|
|
4
|
+
|
|
5
|
+
const mimicFn$1 = (to, from) => {
|
|
6
|
+
for (const prop of Reflect.ownKeys(from)) {
|
|
7
|
+
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
mimicFn$2.exports = mimicFn$1;
|
|
14
|
+
// TODO: Remove this for the next major release
|
|
15
|
+
mimicFn$2.exports.default = mimicFn$1;
|
|
16
|
+
|
|
17
|
+
const mimicFn = mimicFn$2.exports;
|
|
18
|
+
|
|
19
|
+
const calledFunctions = new WeakMap();
|
|
20
|
+
|
|
21
|
+
const onetime = (function_, options = {}) => {
|
|
22
|
+
if (typeof function_ !== 'function') {
|
|
23
|
+
throw new TypeError('Expected a function');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let returnValue;
|
|
27
|
+
let callCount = 0;
|
|
28
|
+
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
29
|
+
|
|
30
|
+
const onetime = function (...arguments_) {
|
|
31
|
+
calledFunctions.set(onetime, ++callCount);
|
|
32
|
+
|
|
33
|
+
if (callCount === 1) {
|
|
34
|
+
returnValue = function_.apply(this, arguments_);
|
|
35
|
+
function_ = null;
|
|
36
|
+
} else if (options.throw === true) {
|
|
37
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return returnValue;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
mimicFn(onetime, function_);
|
|
44
|
+
calledFunctions.set(onetime, callCount);
|
|
45
|
+
|
|
46
|
+
return onetime;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
onetime$1.exports = onetime;
|
|
50
|
+
// TODO: Remove this for the next major release
|
|
51
|
+
onetime$1.exports.default = onetime;
|
|
52
|
+
|
|
53
|
+
onetime$1.exports.callCount = function_ => {
|
|
54
|
+
if (!calledFunctions.has(function_)) {
|
|
55
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return calledFunctions.get(function_);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { onetime$1 as o };
|
|
@@ -2798,12 +2798,12 @@ function requireAutocompleteMultiselect$1 () {
|
|
|
2798
2798
|
}
|
|
2799
2799
|
|
|
2800
2800
|
return `
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2801
|
+
Instructions:
|
|
2802
|
+
${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
2803
|
+
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
2804
|
+
[a,b,c]/delete: Filter choices
|
|
2805
|
+
enter/return: Complete answer
|
|
2806
|
+
`;
|
|
2807
2807
|
}
|
|
2808
2808
|
|
|
2809
2809
|
return '';
|
|
@@ -2811,7 +2811,7 @@ function requireAutocompleteMultiselect$1 () {
|
|
|
2811
2811
|
|
|
2812
2812
|
renderCurrentInput() {
|
|
2813
2813
|
return `
|
|
2814
|
-
|
|
2814
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray('Enter something to filter')}\n`;
|
|
2815
2815
|
}
|
|
2816
2816
|
|
|
2817
2817
|
renderOption(cursor, v, i) {
|
|
@@ -5761,19 +5761,19 @@ function requireAutocompleteMultiselect () {
|
|
|
5761
5761
|
return this.instructions;
|
|
5762
5762
|
}
|
|
5763
5763
|
return `
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5764
|
+
Instructions:
|
|
5765
|
+
${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
5766
|
+
${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
5767
|
+
[a,b,c]/delete: Filter choices
|
|
5768
|
+
enter/return: Complete answer
|
|
5769
|
+
`;
|
|
5770
5770
|
}
|
|
5771
5771
|
return '';
|
|
5772
5772
|
}
|
|
5773
5773
|
|
|
5774
5774
|
renderCurrentInput() {
|
|
5775
5775
|
return `
|
|
5776
|
-
|
|
5776
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray('Enter something to filter')}\n`;
|
|
5777
5777
|
}
|
|
5778
5778
|
|
|
5779
5779
|
renderOption(cursor, v, i) {
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
import { y as resolve } from './chunk-mock-date.ea3b3121.mjs';
|
|
2
1
|
import { Buffer } from 'buffer';
|
|
3
2
|
import path from 'path';
|
|
4
3
|
import childProcess from 'child_process';
|
|
5
4
|
import process$1 from 'process';
|
|
6
|
-
import { m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.
|
|
7
|
-
import
|
|
5
|
+
import { m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.2ae8040a.mjs';
|
|
6
|
+
import url from 'url';
|
|
8
7
|
import require$$0, { constants } from 'os';
|
|
9
|
-
import { s as signalExit } from './vendor-index.
|
|
10
|
-
import 'tty';
|
|
11
|
-
import 'local-pkg';
|
|
12
|
-
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
13
|
-
import 'fs';
|
|
14
|
-
import 'stream';
|
|
15
|
-
import 'util';
|
|
16
|
-
import 'assert';
|
|
17
|
-
import 'events';
|
|
8
|
+
import { s as signalExit } from './vendor-index.29636037.mjs';
|
|
18
9
|
|
|
19
10
|
function stripFinalNewline(input) {
|
|
20
11
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
@@ -52,7 +43,7 @@ function npmRunPath(options = {}) {
|
|
|
52
43
|
} = options;
|
|
53
44
|
|
|
54
45
|
let previous;
|
|
55
|
-
const cwdString = cwd instanceof URL ?
|
|
46
|
+
const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
|
|
56
47
|
let cwdPath = path.resolve(cwdString);
|
|
57
48
|
const result = [];
|
|
58
49
|
|
|
@@ -1077,63 +1068,4 @@ function execa(file, args, options) {
|
|
|
1077
1068
|
return mergePromise(spawned, handlePromiseOnce);
|
|
1078
1069
|
}
|
|
1079
1070
|
|
|
1080
|
-
|
|
1081
|
-
constructor(cwd) {
|
|
1082
|
-
this.cwd = cwd;
|
|
1083
|
-
}
|
|
1084
|
-
async resolveFilesWithGitCommand(args) {
|
|
1085
|
-
let result;
|
|
1086
|
-
try {
|
|
1087
|
-
result = await execa("git", args, { cwd: this.root });
|
|
1088
|
-
} catch (e) {
|
|
1089
|
-
e.message = e.stderr;
|
|
1090
|
-
throw e;
|
|
1091
|
-
}
|
|
1092
|
-
return result.stdout.split("\n").filter((s) => s !== "").map((changedPath) => resolve(this.root, changedPath));
|
|
1093
|
-
}
|
|
1094
|
-
async findChangedFiles(options) {
|
|
1095
|
-
const root = await this.getRoot(this.cwd);
|
|
1096
|
-
if (!root)
|
|
1097
|
-
return null;
|
|
1098
|
-
this.root = root;
|
|
1099
|
-
const changedSince = options.changedSince;
|
|
1100
|
-
if (typeof changedSince === "string") {
|
|
1101
|
-
const [committed, staged2, unstaged2] = await Promise.all([
|
|
1102
|
-
this.getFilesSince(changedSince),
|
|
1103
|
-
this.getStagedFiles(),
|
|
1104
|
-
this.getUnstagedFiles()
|
|
1105
|
-
]);
|
|
1106
|
-
return [...committed, ...staged2, ...unstaged2];
|
|
1107
|
-
}
|
|
1108
|
-
const [staged, unstaged] = await Promise.all([
|
|
1109
|
-
this.getStagedFiles(),
|
|
1110
|
-
this.getUnstagedFiles()
|
|
1111
|
-
]);
|
|
1112
|
-
return [...staged, ...unstaged];
|
|
1113
|
-
}
|
|
1114
|
-
getFilesSince(hash) {
|
|
1115
|
-
return this.resolveFilesWithGitCommand(["diff", "--name-only", `${hash}...HEAD`]);
|
|
1116
|
-
}
|
|
1117
|
-
getStagedFiles() {
|
|
1118
|
-
return this.resolveFilesWithGitCommand(["diff", "--cached", "--name-only"]);
|
|
1119
|
-
}
|
|
1120
|
-
getUnstagedFiles() {
|
|
1121
|
-
return this.resolveFilesWithGitCommand([
|
|
1122
|
-
"ls-files",
|
|
1123
|
-
"--other",
|
|
1124
|
-
"--modified",
|
|
1125
|
-
"--exclude-standard"
|
|
1126
|
-
]);
|
|
1127
|
-
}
|
|
1128
|
-
async getRoot(cwd) {
|
|
1129
|
-
const options = ["rev-parse", "--show-cdup"];
|
|
1130
|
-
try {
|
|
1131
|
-
const result = await execa("git", options, { cwd });
|
|
1132
|
-
return resolve(cwd, result.stdout);
|
|
1133
|
-
} catch {
|
|
1134
|
-
return null;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
export { VitestGit };
|
|
1071
|
+
export { execa as e };
|
package/dist/worker.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.
|
|
1
|
+
import { a as resolve, c as distDir } from './chunk-constants.71e8a211.mjs';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.cddda63d.mjs';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
|
-
import
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
4
|
+
import './chunk-mock-date.304e29b1.mjs';
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.49d21aa6.mjs';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.57586b73.mjs';
|
|
7
7
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
8
|
-
import 'path';
|
|
9
8
|
import 'tty';
|
|
10
|
-
import 'local-pkg';
|
|
11
|
-
import 'module';
|
|
12
9
|
import 'url';
|
|
10
|
+
import 'path';
|
|
11
|
+
import 'module';
|
|
13
12
|
import 'vm';
|
|
14
|
-
import './chunk-vite-node-utils.
|
|
13
|
+
import './chunk-vite-node-utils.b432150c.mjs';
|
|
15
14
|
import 'fs';
|
|
16
15
|
import 'assert';
|
|
17
16
|
import 'util';
|
|
18
17
|
import 'debug';
|
|
18
|
+
import 'local-pkg';
|
|
19
19
|
import 'vite';
|
|
20
20
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
21
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"keywords": [
|
|
17
17
|
"vite",
|
|
18
18
|
"vite-node",
|
|
19
|
+
"vitest",
|
|
19
20
|
"test",
|
|
20
21
|
"jest"
|
|
21
22
|
],
|
|
@@ -65,7 +66,6 @@
|
|
|
65
66
|
"@edge-runtime/vm": "*",
|
|
66
67
|
"@vitest/browser": "*",
|
|
67
68
|
"@vitest/ui": "*",
|
|
68
|
-
"c8": "*",
|
|
69
69
|
"happy-dom": "*",
|
|
70
70
|
"jsdom": "*"
|
|
71
71
|
},
|
|
@@ -76,9 +76,6 @@
|
|
|
76
76
|
"@vitest/browser": {
|
|
77
77
|
"optional": true
|
|
78
78
|
},
|
|
79
|
-
"c8": {
|
|
80
|
-
"optional": true
|
|
81
|
-
},
|
|
82
79
|
"happy-dom": {
|
|
83
80
|
"optional": true
|
|
84
81
|
},
|
|
@@ -90,19 +87,19 @@
|
|
|
90
87
|
}
|
|
91
88
|
},
|
|
92
89
|
"dependencies": {
|
|
93
|
-
"@types/chai": "^4.3.
|
|
90
|
+
"@types/chai": "^4.3.3",
|
|
94
91
|
"@types/chai-subset": "^1.3.3",
|
|
95
92
|
"@types/node": "*",
|
|
96
93
|
"chai": "^4.3.6",
|
|
97
94
|
"debug": "^4.3.4",
|
|
98
95
|
"local-pkg": "^0.4.2",
|
|
99
96
|
"tinypool": "^0.2.4",
|
|
100
|
-
"tinyspy": "^1.0.
|
|
97
|
+
"tinyspy": "^1.0.2",
|
|
101
98
|
"vite": "^2.9.12 || ^3.0.0-0"
|
|
102
99
|
},
|
|
103
100
|
"devDependencies": {
|
|
104
101
|
"@antfu/install-pkg": "^0.1.0",
|
|
105
|
-
"@edge-runtime/vm": "1.1.0-beta.
|
|
102
|
+
"@edge-runtime/vm": "1.1.0-beta.26",
|
|
106
103
|
"@sinonjs/fake-timers": "^9.1.2",
|
|
107
104
|
"@types/diff": "^5.0.2",
|
|
108
105
|
"@types/jsdom": "^20.0.0",
|
|
@@ -110,9 +107,8 @@
|
|
|
110
107
|
"@types/natural-compare": "^1.4.1",
|
|
111
108
|
"@types/prompts": "^2.4.0",
|
|
112
109
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
113
|
-
"@vitest/ui": "0.
|
|
110
|
+
"@vitest/ui": "0.22.1",
|
|
114
111
|
"birpc": "^0.2.3",
|
|
115
|
-
"c8": "^7.12.0",
|
|
116
112
|
"cac": "^6.7.12",
|
|
117
113
|
"chai-subset": "^1.6.0",
|
|
118
114
|
"cli-truncate": "^3.1.0",
|
|
@@ -126,7 +122,7 @@
|
|
|
126
122
|
"log-update": "^5.0.1",
|
|
127
123
|
"magic-string": "^0.26.2",
|
|
128
124
|
"micromatch": "^4.0.5",
|
|
129
|
-
"mlly": "^0.5.
|
|
125
|
+
"mlly": "^0.5.12",
|
|
130
126
|
"natural-compare": "^1.4.0",
|
|
131
127
|
"p-limit": "^4.0.0",
|
|
132
128
|
"pathe": "^0.2.0",
|
|
@@ -134,11 +130,11 @@
|
|
|
134
130
|
"pkg-types": "^0.3.3",
|
|
135
131
|
"pretty-format": "^27.5.1",
|
|
136
132
|
"prompts": "^2.4.2",
|
|
137
|
-
"rollup": "^2.
|
|
133
|
+
"rollup": "^2.78.0",
|
|
138
134
|
"source-map-js": "^1.0.2",
|
|
139
135
|
"strip-ansi": "^7.0.1",
|
|
140
136
|
"typescript": "^4.7.4",
|
|
141
|
-
"vite-node": "0.
|
|
137
|
+
"vite-node": "0.22.1",
|
|
142
138
|
"ws": "^8.8.1"
|
|
143
139
|
},
|
|
144
140
|
"scripts": {
|
package/vitest.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import './dist/cli.mjs'
|
|
2
|
+
import './dist/cli-wrapper.mjs'
|