vitest 0.29.2 → 0.29.4
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 +502 -1
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +3 -4
- package/dist/child.js +15 -9
- package/dist/{chunk-api-setup.d9eccaeb.js → chunk-api-setup.ac7748ac.js} +9 -12
- package/dist/{chunk-constants.797d3ebf.js → chunk-constants.bc18a549.js} +1 -7
- package/dist/{chunk-install-pkg.aa415fd6.js → chunk-install-pkg.4121cd66.js} +12 -12
- package/dist/{chunk-integrations-globals.b56fcb06.js → chunk-integrations-globals.a473e88a.js} +8 -10
- package/dist/{chunk-integrations-run-once.9012f759.js → chunk-integrations-run-once.a2b4758b.js} +1 -1
- package/dist/{chunk-integrations-utils.233d6a3b.js → chunk-integrations-utils.d7c85bd9.js} +2 -2
- package/dist/{chunk-node-pkg.208acffb.js → chunk-node-pkg.0e36ca8e.js} +6970 -3551
- package/dist/chunk-paths.e36446b4.js +7 -0
- package/dist/chunk-runtime-inspector.b1427a10.js +20 -0
- package/dist/{chunk-runtime-mocker.a048e92d.js → chunk-runtime-mocker.344fec90.js} +6 -4
- package/dist/{chunk-runtime-rpc.971b3848.js → chunk-runtime-rpc.1b5714dc.js} +2 -2
- package/dist/{chunk-runtime-setup.992bb661.js → chunk-runtime-setup.a49dc2f9.js} +2 -2
- package/dist/{chunk-utils-global.727b6d25.js → chunk-utils-env.04ffbef7.js} +7 -4
- package/dist/{chunk-utils-import.ec15dcad.js → chunk-utils-import.39ffe9c5.js} +3 -3
- package/dist/cli-wrapper.js +1 -6
- package/dist/cli.js +15 -15
- package/dist/config.cjs +5 -0
- package/dist/config.d.ts +8 -4
- package/dist/config.js +5 -0
- package/dist/coverage.d.ts +3 -3
- package/dist/entry.js +17 -15
- package/dist/environments.d.ts +3 -3
- package/dist/index.d.ts +5 -6
- package/dist/index.js +6 -7
- package/dist/loader.js +1 -2
- package/dist/node.d.ts +4 -4
- package/dist/node.js +15 -15
- package/dist/runners.d.ts +2 -2
- package/dist/runners.js +3 -4
- package/dist/{types-7cd96283.d.ts → types-fafda418.d.ts} +107 -17
- package/dist/{chunk-magic-string.3a794426.js → vendor-magic-string.es.b3bc5745.js} +82 -1
- package/dist/worker.js +15 -9
- package/package.json +18 -8
- package/dist/chunk-utils-env.860d90c2.js +0 -6
package/dist/node.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.
|
|
2
|
-
export { V as VitestExecutor } from './chunk-runtime-mocker.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.0e36ca8e.js';
|
|
2
|
+
export { V as VitestExecutor } from './chunk-runtime-mocker.344fec90.js';
|
|
3
3
|
import 'pathe';
|
|
4
|
-
import './chunk-constants.
|
|
5
|
-
import 'node:url';
|
|
6
|
-
import './chunk-utils-env.860d90c2.js';
|
|
7
|
-
import 'std-env';
|
|
4
|
+
import './chunk-constants.bc18a549.js';
|
|
8
5
|
import './chunk-integrations-coverage.e0a6acd2.js';
|
|
9
6
|
import 'local-pkg';
|
|
10
7
|
import './chunk-env-node.affdd278.js';
|
|
11
8
|
import 'node:console';
|
|
12
9
|
import 'picocolors';
|
|
10
|
+
import './chunk-utils-env.04ffbef7.js';
|
|
11
|
+
import 'std-env';
|
|
12
|
+
import '@vitest/runner/utils';
|
|
13
|
+
import '@vitest/utils';
|
|
13
14
|
import 'vite';
|
|
14
15
|
import 'node:path';
|
|
16
|
+
import 'node:url';
|
|
15
17
|
import 'node:process';
|
|
16
18
|
import 'node:fs';
|
|
17
19
|
import 'path';
|
|
@@ -21,11 +23,8 @@ import 'stream';
|
|
|
21
23
|
import 'events';
|
|
22
24
|
import 'fs';
|
|
23
25
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
26
|
+
import 'vite-node/utils';
|
|
24
27
|
import 'vite-node/client';
|
|
25
|
-
import 'vite-node/server';
|
|
26
|
-
import './chunk-utils-global.727b6d25.js';
|
|
27
|
-
import '@vitest/runner/utils';
|
|
28
|
-
import '@vitest/utils';
|
|
29
28
|
import 'node:fs/promises';
|
|
30
29
|
import './vendor-index.2cbcdd1e.js';
|
|
31
30
|
import 'node:buffer';
|
|
@@ -38,23 +37,24 @@ import 'source-map';
|
|
|
38
37
|
import 'module';
|
|
39
38
|
import 'acorn';
|
|
40
39
|
import 'acorn-walk';
|
|
40
|
+
import './chunk-utils-base.81f83dbd.js';
|
|
41
|
+
import 'crypto';
|
|
42
|
+
import './chunk-paths.e36446b4.js';
|
|
41
43
|
import 'node:v8';
|
|
42
44
|
import './vendor-index.783e7f3e.js';
|
|
43
|
-
import './chunk-utils-base.81f83dbd.js';
|
|
44
45
|
import 'node:worker_threads';
|
|
45
46
|
import 'tinypool';
|
|
46
47
|
import 'perf_hooks';
|
|
47
48
|
import './chunk-utils-tasks.b41c8284.js';
|
|
48
|
-
import 'crypto';
|
|
49
|
-
import 'vite-node/utils';
|
|
50
49
|
import '@vitest/utils/diff';
|
|
50
|
+
import 'vite-node/server';
|
|
51
|
+
import './vendor-magic-string.es.b3bc5745.js';
|
|
51
52
|
import 'node:module';
|
|
52
53
|
import 'node:crypto';
|
|
53
|
-
import './chunk-magic-string.3a794426.js';
|
|
54
54
|
import 'strip-literal';
|
|
55
55
|
import 'readline';
|
|
56
56
|
import './vendor-index.bdee400f.js';
|
|
57
57
|
import 'node:assert';
|
|
58
58
|
import 'node:util';
|
|
59
59
|
import '@vitest/spy';
|
|
60
|
-
import './chunk-runtime-rpc.
|
|
60
|
+
import './chunk-runtime-rpc.1b5714dc.js';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, TestContext } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig } from './types-
|
|
2
|
+
import { a as ResolvedConfig } from './types-fafda418.js';
|
|
3
3
|
import '@vitest/expect';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner/types';
|
|
@@ -7,11 +7,11 @@ import '@vitest/runner/utils';
|
|
|
7
7
|
import '@vitest/utils';
|
|
8
8
|
import 'tinybench';
|
|
9
9
|
import 'vite-node/client';
|
|
10
|
-
import 'vite-node/server';
|
|
11
10
|
import 'node:worker_threads';
|
|
12
11
|
import 'vite-node';
|
|
13
12
|
import 'source-map';
|
|
14
13
|
import 'node:fs';
|
|
14
|
+
import 'vite-node/server';
|
|
15
15
|
|
|
16
16
|
declare class VitestTestRunner implements VitestRunner {
|
|
17
17
|
config: ResolvedConfig;
|
package/dist/runners.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.
|
|
3
|
-
import { g as getWorkerState } from './chunk-utils-
|
|
2
|
+
import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.39ffe9c5.js';
|
|
3
|
+
import { g as getWorkerState } from './chunk-utils-env.04ffbef7.js';
|
|
4
4
|
import { g as getFullName } from './chunk-utils-tasks.b41c8284.js';
|
|
5
5
|
import { updateTask } from '@vitest/runner';
|
|
6
6
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import 'chai';
|
|
9
9
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
10
|
-
import './chunk-runtime-rpc.
|
|
10
|
+
import './chunk-runtime-rpc.1b5714dc.js';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import './chunk-snapshot-env.a347d647.js';
|
|
13
13
|
import './chunk-utils-base.81f83dbd.js';
|
|
14
14
|
import 'util';
|
|
15
15
|
import '@vitest/spy';
|
|
16
|
-
import './chunk-utils-env.860d90c2.js';
|
|
17
16
|
import 'std-env';
|
|
18
17
|
|
|
19
18
|
class VitestTestRunner {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { MatchersObject, MatcherState } from '@vitest/expect';
|
|
2
|
-
import { UserConfig as UserConfig$1, ViteDevServer, CommonServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
|
|
3
|
-
import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
|
|
2
|
+
import { UserConfig as UserConfig$1, TransformResult as TransformResult$1, ViteDevServer, CommonServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
|
|
4
3
|
import * as _vitest_runner from '@vitest/runner';
|
|
5
|
-
import { Task as Task$1, Test as Test$2, TaskCustom } from '@vitest/runner';
|
|
4
|
+
import { Task as Task$1, Test as Test$2, TaskCustom, SequenceSetupFiles, SequenceHooks } from '@vitest/runner';
|
|
5
|
+
import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
|
|
6
6
|
import { ParsedStack, ErrorWithDiff, ChainableFunction } from '@vitest/runner/utils';
|
|
7
|
-
import { Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
7
|
+
import { Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
8
8
|
import { Task as Task$2, TaskResult, Bench, Options } from 'tinybench';
|
|
9
9
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
10
|
-
import { ViteNodeServer } from 'vite-node/server';
|
|
11
10
|
import { MessagePort } from 'node:worker_threads';
|
|
12
11
|
import { RawSourceMap, FetchResult, ViteNodeResolveId, ModuleCacheMap } from 'vite-node';
|
|
13
12
|
import { RawSourceMap as RawSourceMap$1 } from 'source-map';
|
|
14
13
|
import { Stats } from 'node:fs';
|
|
14
|
+
import { ViteNodeServer } from 'vite-node/server';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
@@ -258,6 +258,49 @@ interface ProcessPool {
|
|
|
258
258
|
close: () => Promise<void>;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
interface BrowserProvider {
|
|
262
|
+
initialize(ctx: Vitest): Awaitable$1<void>;
|
|
263
|
+
createPool(): ProcessPool;
|
|
264
|
+
testFinished?(testId: string): Awaitable$1<void>;
|
|
265
|
+
}
|
|
266
|
+
interface BrowserConfigOptions {
|
|
267
|
+
/**
|
|
268
|
+
* if running tests in the broweser should be the default
|
|
269
|
+
*
|
|
270
|
+
* @default false
|
|
271
|
+
*/
|
|
272
|
+
enabled?: boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Name of the browser
|
|
275
|
+
*
|
|
276
|
+
* @default tries to find the first available browser
|
|
277
|
+
*/
|
|
278
|
+
name?: 'firefox' | 'chrome' | 'edge' | 'safari';
|
|
279
|
+
/**
|
|
280
|
+
* browser provider
|
|
281
|
+
*
|
|
282
|
+
* @default 'webdriver'
|
|
283
|
+
*/
|
|
284
|
+
provider?: string;
|
|
285
|
+
/**
|
|
286
|
+
* enable headless mode
|
|
287
|
+
*
|
|
288
|
+
* @default process.env.CI
|
|
289
|
+
*/
|
|
290
|
+
headless?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Serve API options.
|
|
293
|
+
*
|
|
294
|
+
* The default port is 63315.
|
|
295
|
+
*/
|
|
296
|
+
api?: ApiConfig | number;
|
|
297
|
+
}
|
|
298
|
+
interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
299
|
+
enabled: boolean;
|
|
300
|
+
headless: boolean;
|
|
301
|
+
api: ApiConfig;
|
|
302
|
+
}
|
|
303
|
+
|
|
261
304
|
interface CollectingPromise {
|
|
262
305
|
promise: Promise<void>;
|
|
263
306
|
resolve: () => void;
|
|
@@ -269,9 +312,12 @@ declare class StateManager {
|
|
|
269
312
|
idMap: Map<string, Task>;
|
|
270
313
|
taskFileMap: WeakMap<Task, File>;
|
|
271
314
|
errorsSet: Set<unknown>;
|
|
315
|
+
processTimeoutCauses: Set<string>;
|
|
272
316
|
catchError(err: unknown, type: string): void;
|
|
273
317
|
clearErrors(): void;
|
|
274
318
|
getUnhandledErrors(): unknown[];
|
|
319
|
+
addProcessTimeoutCause(cause: string): void;
|
|
320
|
+
getProcessTimeoutCauses(): string[];
|
|
275
321
|
getPaths(): string[];
|
|
276
322
|
getFiles(keys?: string[]): File[];
|
|
277
323
|
getFilepaths(): string[];
|
|
@@ -365,20 +411,28 @@ declare class VitestCache {
|
|
|
365
411
|
}>;
|
|
366
412
|
}
|
|
367
413
|
|
|
414
|
+
declare class VitestServer extends ViteNodeServer {
|
|
415
|
+
private _vitestPath?;
|
|
416
|
+
private getVitestPath;
|
|
417
|
+
protected processTransformResult(result: TransformResult$1): Promise<TransformResult$1>;
|
|
418
|
+
}
|
|
419
|
+
|
|
368
420
|
declare class Vitest {
|
|
369
421
|
readonly mode: VitestRunMode;
|
|
370
422
|
config: ResolvedConfig;
|
|
371
423
|
configOverride: Partial<ResolvedConfig> | undefined;
|
|
424
|
+
browser: ViteDevServer;
|
|
372
425
|
server: ViteDevServer;
|
|
373
426
|
state: StateManager;
|
|
374
427
|
snapshot: SnapshotManager;
|
|
375
428
|
cache: VitestCache;
|
|
376
429
|
reporters: Reporter[];
|
|
377
430
|
coverageProvider: CoverageProvider | null | undefined;
|
|
431
|
+
browserProvider: BrowserProvider | undefined;
|
|
378
432
|
logger: Logger;
|
|
379
433
|
pool: ProcessPool | undefined;
|
|
380
434
|
typechecker: Typechecker | undefined;
|
|
381
|
-
vitenode:
|
|
435
|
+
vitenode: VitestServer;
|
|
382
436
|
invalidates: Set<string>;
|
|
383
437
|
changedTests: Set<string>;
|
|
384
438
|
filenamePattern?: string;
|
|
@@ -390,8 +444,10 @@ declare class Vitest {
|
|
|
390
444
|
constructor(mode: VitestRunMode);
|
|
391
445
|
private _onRestartListeners;
|
|
392
446
|
private _onSetServer;
|
|
447
|
+
initBrowserServer(options: UserConfig): Promise<void>;
|
|
393
448
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
394
449
|
initCoverageProvider(): Promise<CoverageProvider | null | undefined>;
|
|
450
|
+
initBrowserProvider(): Promise<BrowserProvider>;
|
|
395
451
|
getSerializableConfig(): ResolvedConfig;
|
|
396
452
|
typecheck(filters?: string[]): Promise<void>;
|
|
397
453
|
start(filters?: string[]): Promise<void>;
|
|
@@ -424,6 +480,8 @@ declare class Vitest {
|
|
|
424
480
|
filterFiles(testFiles: string[], filters?: string[]): string[];
|
|
425
481
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
426
482
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
483
|
+
isBrowserEnabled(): boolean;
|
|
484
|
+
shouldKeepServer(): boolean;
|
|
427
485
|
isInSourceTestFile(code: string): boolean;
|
|
428
486
|
onServerRestart(fn: OnServerRestartHandler): void;
|
|
429
487
|
onAfterSetServer(fn: OnServerRestartHandler): void;
|
|
@@ -485,12 +543,6 @@ type Awaitable<T> = T | PromiseLike<T>;
|
|
|
485
543
|
type Nullable<T> = T | null | undefined;
|
|
486
544
|
type Arrayable<T> = T | Array<T>;
|
|
487
545
|
type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
|
|
488
|
-
type MergeInsertions<T> = T extends object ? {
|
|
489
|
-
[K in keyof T]: MergeInsertions<T[K]>;
|
|
490
|
-
} : T;
|
|
491
|
-
type DeepMerge<F, S> = MergeInsertions<{
|
|
492
|
-
[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;
|
|
493
|
-
}>;
|
|
494
546
|
type MutableArray<T extends readonly any[]> = {
|
|
495
547
|
-readonly [k in keyof T]: T[k];
|
|
496
548
|
};
|
|
@@ -1075,6 +1127,7 @@ interface WorkerGlobalState {
|
|
|
1075
1127
|
rpc: BirpcReturn<RuntimeRPC>;
|
|
1076
1128
|
current?: Test$2;
|
|
1077
1129
|
filepath?: string;
|
|
1130
|
+
environmentTeardownRun?: boolean;
|
|
1078
1131
|
moduleCache: ModuleCacheMap;
|
|
1079
1132
|
mockMap: MockMap;
|
|
1080
1133
|
}
|
|
@@ -1405,8 +1458,8 @@ type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
|
|
|
1405
1458
|
|
|
1406
1459
|
type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
1407
1460
|
type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
|
|
1461
|
+
type VitestPool = 'browser' | 'threads' | 'child_process';
|
|
1408
1462
|
type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
|
|
1409
|
-
type SequenceHooks = 'stack' | 'list' | 'parallel';
|
|
1410
1463
|
type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
|
|
1411
1464
|
|
|
1412
1465
|
interface EnvironmentOptions {
|
|
@@ -1533,6 +1586,20 @@ interface InlineConfig {
|
|
|
1533
1586
|
* ]
|
|
1534
1587
|
*/
|
|
1535
1588
|
environmentMatchGlobs?: [string, VitestEnvironment][];
|
|
1589
|
+
/**
|
|
1590
|
+
* Automatically assign pool based on globs. The first match will be used.
|
|
1591
|
+
*
|
|
1592
|
+
* Format: [glob, pool-name]
|
|
1593
|
+
*
|
|
1594
|
+
* @default []
|
|
1595
|
+
* @example [
|
|
1596
|
+
* // all tests in "browser" directory will run in an actual browser
|
|
1597
|
+
* ['tests/browser/**', 'browser'],
|
|
1598
|
+
* // all other tests will run based on "threads" option, if you didn't specify other globs
|
|
1599
|
+
* // ...
|
|
1600
|
+
* ]
|
|
1601
|
+
*/
|
|
1602
|
+
poolMatchGlobs?: [string, VitestPool][];
|
|
1536
1603
|
/**
|
|
1537
1604
|
* Update snapshot
|
|
1538
1605
|
*
|
|
@@ -1713,10 +1780,12 @@ interface InlineConfig {
|
|
|
1713
1780
|
*/
|
|
1714
1781
|
ui?: boolean;
|
|
1715
1782
|
/**
|
|
1716
|
-
*
|
|
1783
|
+
* options for test in a browser environment
|
|
1717
1784
|
* @experimental
|
|
1785
|
+
*
|
|
1786
|
+
* @default false
|
|
1718
1787
|
*/
|
|
1719
|
-
browser?:
|
|
1788
|
+
browser?: BrowserConfigOptions;
|
|
1720
1789
|
/**
|
|
1721
1790
|
* Open UI automatically.
|
|
1722
1791
|
*
|
|
@@ -1825,6 +1894,13 @@ interface InlineConfig {
|
|
|
1825
1894
|
* @default false
|
|
1826
1895
|
*/
|
|
1827
1896
|
shuffle?: boolean;
|
|
1897
|
+
/**
|
|
1898
|
+
* Defines how setup files should be ordered
|
|
1899
|
+
* - 'parallel' will run all setup files in parallel
|
|
1900
|
+
* - 'list' will run all setup files in the order they are defined in the config file
|
|
1901
|
+
* @default 'parallel'
|
|
1902
|
+
*/
|
|
1903
|
+
setupFiles?: SequenceSetupFiles;
|
|
1828
1904
|
/**
|
|
1829
1905
|
* Seed for the random number generator.
|
|
1830
1906
|
* @default Date.now()
|
|
@@ -1863,6 +1939,18 @@ interface InlineConfig {
|
|
|
1863
1939
|
* Path to a custom test runner.
|
|
1864
1940
|
*/
|
|
1865
1941
|
runner?: string;
|
|
1942
|
+
/**
|
|
1943
|
+
* Debug tests by opening `node:inspector` in worker / child process.
|
|
1944
|
+
* Provides similar experience as `--inspect` Node CLI argument.
|
|
1945
|
+
* Requires `singleThread: true` OR `threads: false`.
|
|
1946
|
+
*/
|
|
1947
|
+
inspect?: boolean;
|
|
1948
|
+
/**
|
|
1949
|
+
* Debug tests by opening `node:inspector` in worker / child process and wait for debugger to connect.
|
|
1950
|
+
* Provides similar experience as `--inspect-brk` Node CLI argument.
|
|
1951
|
+
* Requires `singleThread: true` OR `threads: false`.
|
|
1952
|
+
*/
|
|
1953
|
+
inspectBrk?: boolean;
|
|
1866
1954
|
}
|
|
1867
1955
|
interface TypecheckConfig {
|
|
1868
1956
|
/**
|
|
@@ -1927,7 +2015,7 @@ interface UserConfig extends InlineConfig {
|
|
|
1927
2015
|
*/
|
|
1928
2016
|
shard?: string;
|
|
1929
2017
|
}
|
|
1930
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner'> {
|
|
2018
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner'> {
|
|
1931
2019
|
mode: VitestRunMode;
|
|
1932
2020
|
base?: string;
|
|
1933
2021
|
config?: string;
|
|
@@ -1936,6 +2024,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1936
2024
|
related?: string[];
|
|
1937
2025
|
coverage: ResolvedCoverageOptions;
|
|
1938
2026
|
snapshotOptions: SnapshotStateOptions;
|
|
2027
|
+
browser: ResolvedBrowserOptions;
|
|
1939
2028
|
reporters: (Reporter | BuiltinReporters)[];
|
|
1940
2029
|
defines: Record<string, any>;
|
|
1941
2030
|
api?: ApiConfig;
|
|
@@ -1952,6 +2041,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1952
2041
|
sequence: {
|
|
1953
2042
|
sequencer: TestSequencerConstructor;
|
|
1954
2043
|
hooks: SequenceHooks;
|
|
2044
|
+
setupFiles: SequenceSetupFiles;
|
|
1955
2045
|
shuffle?: boolean;
|
|
1956
2046
|
seed: number;
|
|
1957
2047
|
};
|
|
@@ -2166,4 +2256,4 @@ type Context = RootAndTarget & {
|
|
|
2166
2256
|
lastActivePath?: string;
|
|
2167
2257
|
};
|
|
2168
2258
|
|
|
2169
|
-
export {
|
|
2259
|
+
export { CoverageReporter as $, ApiConfig as A, BenchmarkAPI as B, CollectLineNumbers as C, Arrayable as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, ArgumentsType$1 as G, MutableArray as H, InlineConfig as I, JSDOMOptions as J, Constructable as K, ModuleCache as L, MockFactoryWithHelper as M, Nullable as N, EnvironmentReturn as O, Environment as P, UserConsoleLog as Q, RuntimeConfig as R, SnapshotResult as S, TscErrorInfo as T, UserConfig as U, VitestEnvironment as V, WorkerContext as W, OnServerRestartHandler as X, CoverageProvider as Y, ReportContext as Z, CoverageProviderModule as _, ResolvedConfig as a, CoverageOptions as a0, ResolvedCoverageOptions as a1, BaseCoverageOptions as a2, CoverageIstanbulOptions as a3, CoverageC8Options as a4, CustomProviderOptions as a5, BenchmarkUserOptions as a6, Benchmark as a7, BenchmarkResult as a8, BenchFunction as a9, MockFactory as aa, MockMap as ab, TestSequencer as ac, startVitest as ad, TestSequencerConstructor as ae, HtmlOptions as af, FileOptions as ag, CloverOptions as ah, CoberturaOptions as ai, HtmlSpaOptions as aj, LcovOptions as ak, LcovOnlyOptions as al, TeamcityOptions as am, TextOptions as an, ProjectOptions as ao, ModuleGraphData as b, Reporter as c, RawErrsMap as d, CollectLines as e, RootAndTarget as f, Context as g, BuiltinEnvironment as h, VitestPool as i, CSSModuleScopeStrategy as j, VitestRunMode as k, TypecheckConfig as l, RuntimeRPC as m, ContextTestEnvironment as n, ContextRPC as o, Vitest as p, SnapshotData as q, SnapshotUpdateState as r, SnapshotStateOptions as s, SnapshotMatchOptions as t, UncheckedSnapshot as u, SnapshotSummary as v, ResolveIdFunction as w, AfterSuiteRunMeta as x, WorkerGlobalState as y, Awaitable as z };
|
|
@@ -27,6 +27,80 @@ const td = typeof TextDecoder !== 'undefined'
|
|
|
27
27
|
return out;
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
|
+
function decode(mappings) {
|
|
31
|
+
const state = new Int32Array(5);
|
|
32
|
+
const decoded = [];
|
|
33
|
+
let index = 0;
|
|
34
|
+
do {
|
|
35
|
+
const semi = indexOf(mappings, index);
|
|
36
|
+
const line = [];
|
|
37
|
+
let sorted = true;
|
|
38
|
+
let lastCol = 0;
|
|
39
|
+
state[0] = 0;
|
|
40
|
+
for (let i = index; i < semi; i++) {
|
|
41
|
+
let seg;
|
|
42
|
+
i = decodeInteger(mappings, i, state, 0); // genColumn
|
|
43
|
+
const col = state[0];
|
|
44
|
+
if (col < lastCol)
|
|
45
|
+
sorted = false;
|
|
46
|
+
lastCol = col;
|
|
47
|
+
if (hasMoreVlq(mappings, i, semi)) {
|
|
48
|
+
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
|
49
|
+
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
|
50
|
+
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
|
51
|
+
if (hasMoreVlq(mappings, i, semi)) {
|
|
52
|
+
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
|
53
|
+
seg = [col, state[1], state[2], state[3], state[4]];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
seg = [col, state[1], state[2], state[3]];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
seg = [col];
|
|
61
|
+
}
|
|
62
|
+
line.push(seg);
|
|
63
|
+
}
|
|
64
|
+
if (!sorted)
|
|
65
|
+
sort(line);
|
|
66
|
+
decoded.push(line);
|
|
67
|
+
index = semi + 1;
|
|
68
|
+
} while (index <= mappings.length);
|
|
69
|
+
return decoded;
|
|
70
|
+
}
|
|
71
|
+
function indexOf(mappings, index) {
|
|
72
|
+
const idx = mappings.indexOf(';', index);
|
|
73
|
+
return idx === -1 ? mappings.length : idx;
|
|
74
|
+
}
|
|
75
|
+
function decodeInteger(mappings, pos, state, j) {
|
|
76
|
+
let value = 0;
|
|
77
|
+
let shift = 0;
|
|
78
|
+
let integer = 0;
|
|
79
|
+
do {
|
|
80
|
+
const c = mappings.charCodeAt(pos++);
|
|
81
|
+
integer = charToInt[c];
|
|
82
|
+
value |= (integer & 31) << shift;
|
|
83
|
+
shift += 5;
|
|
84
|
+
} while (integer & 32);
|
|
85
|
+
const shouldNegate = value & 1;
|
|
86
|
+
value >>>= 1;
|
|
87
|
+
if (shouldNegate) {
|
|
88
|
+
value = -0x80000000 | -value;
|
|
89
|
+
}
|
|
90
|
+
state[j] += value;
|
|
91
|
+
return pos;
|
|
92
|
+
}
|
|
93
|
+
function hasMoreVlq(mappings, i, length) {
|
|
94
|
+
if (i >= length)
|
|
95
|
+
return false;
|
|
96
|
+
return mappings.charCodeAt(i) !== comma;
|
|
97
|
+
}
|
|
98
|
+
function sort(line) {
|
|
99
|
+
line.sort(sortComparator);
|
|
100
|
+
}
|
|
101
|
+
function sortComparator(a, b) {
|
|
102
|
+
return a[0] - b[0];
|
|
103
|
+
}
|
|
30
104
|
function encode(decoded) {
|
|
31
105
|
const state = new Int32Array(5);
|
|
32
106
|
const bufLength = 1024 * 16;
|
|
@@ -1507,4 +1581,11 @@ class Bundle {
|
|
|
1507
1581
|
}
|
|
1508
1582
|
}
|
|
1509
1583
|
|
|
1510
|
-
|
|
1584
|
+
var magicString_es = /*#__PURE__*/Object.freeze({
|
|
1585
|
+
__proto__: null,
|
|
1586
|
+
Bundle: Bundle,
|
|
1587
|
+
SourceMap: SourceMap,
|
|
1588
|
+
'default': MagicString
|
|
1589
|
+
});
|
|
1590
|
+
|
|
1591
|
+
export { MagicString as M, decode as d, encode as e, magicString_es as m };
|
package/dist/worker.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
2
2
|
import { workerId } from 'tinypool';
|
|
3
|
-
import { g as getWorkerState } from './chunk-utils-
|
|
4
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.
|
|
5
|
-
import {
|
|
3
|
+
import { g as getWorkerState } from './chunk-utils-env.04ffbef7.js';
|
|
4
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.344fec90.js';
|
|
5
|
+
import { s as setupInspect } from './chunk-runtime-inspector.b1427a10.js';
|
|
6
|
+
import { a as rpcDone } from './chunk-runtime-rpc.1b5714dc.js';
|
|
6
7
|
import 'pathe';
|
|
7
|
-
import './chunk-utils-env.860d90c2.js';
|
|
8
8
|
import 'std-env';
|
|
9
9
|
import '@vitest/runner/utils';
|
|
10
10
|
import '@vitest/utils';
|
|
@@ -20,9 +20,10 @@ import 'node:process';
|
|
|
20
20
|
import 'node:path';
|
|
21
21
|
import 'node:v8';
|
|
22
22
|
import 'node:util';
|
|
23
|
-
import './chunk-
|
|
23
|
+
import './chunk-paths.e36446b4.js';
|
|
24
24
|
import './chunk-utils-base.81f83dbd.js';
|
|
25
25
|
import '@vitest/spy';
|
|
26
|
+
import 'node:inspector';
|
|
26
27
|
|
|
27
28
|
function init(ctx) {
|
|
28
29
|
if (typeof __vitest_worker__ !== "undefined" && ctx.config.threads && ctx.config.isolate)
|
|
@@ -58,10 +59,15 @@ function init(ctx) {
|
|
|
58
59
|
ctx.files.forEach((i) => moduleCache.delete(i));
|
|
59
60
|
}
|
|
60
61
|
async function run(ctx) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const inspectorCleanup = setupInspect(ctx.config);
|
|
63
|
+
try {
|
|
64
|
+
init(ctx);
|
|
65
|
+
const { run: run2, executor } = await startViteNode(ctx);
|
|
66
|
+
await run2(ctx.files, ctx.config, ctx.environment, executor);
|
|
67
|
+
await rpcDone();
|
|
68
|
+
} finally {
|
|
69
|
+
inspectorCleanup();
|
|
70
|
+
}
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
export { run };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.4",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -108,6 +108,12 @@
|
|
|
108
108
|
"jsdom": {
|
|
109
109
|
"optional": true
|
|
110
110
|
},
|
|
111
|
+
"webdriverio": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"safaridriver": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
111
117
|
"@edge-runtime/vm": {
|
|
112
118
|
"optional": true
|
|
113
119
|
}
|
|
@@ -128,17 +134,18 @@
|
|
|
128
134
|
"std-env": "^3.3.1",
|
|
129
135
|
"strip-literal": "^1.0.0",
|
|
130
136
|
"tinybench": "^2.3.1",
|
|
131
|
-
"tinypool": "^0.
|
|
137
|
+
"tinypool": "^0.4.0",
|
|
132
138
|
"tinyspy": "^1.0.2",
|
|
133
139
|
"vite": "^3.0.0 || ^4.0.0",
|
|
134
140
|
"why-is-node-running": "^2.2.2",
|
|
135
|
-
"@vitest/
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"@vitest/
|
|
139
|
-
"@vitest/
|
|
141
|
+
"@vitest/expect": "0.29.4",
|
|
142
|
+
"@vitest/runner": "0.29.4",
|
|
143
|
+
"vite-node": "0.29.4",
|
|
144
|
+
"@vitest/utils": "0.29.4",
|
|
145
|
+
"@vitest/spy": "0.29.4"
|
|
140
146
|
},
|
|
141
147
|
"devDependencies": {
|
|
148
|
+
"@ampproject/remapping": "^2.2.0",
|
|
142
149
|
"@antfu/install-pkg": "^0.1.1",
|
|
143
150
|
"@edge-runtime/vm": "2.0.2",
|
|
144
151
|
"@sinonjs/fake-timers": "^10.0.2",
|
|
@@ -173,9 +180,12 @@
|
|
|
173
180
|
"pretty-format": "^27.5.1",
|
|
174
181
|
"prompts": "^2.4.2",
|
|
175
182
|
"rollup": "^2.79.1",
|
|
183
|
+
"safaridriver": "^0.0.4",
|
|
176
184
|
"strip-ansi": "^7.0.1",
|
|
177
185
|
"typescript": "^4.9.4",
|
|
178
|
-
"
|
|
186
|
+
"webdriverio": "^8.5.5",
|
|
187
|
+
"ws": "^8.12.0",
|
|
188
|
+
"x-default-browser": "^0.5.2"
|
|
179
189
|
},
|
|
180
190
|
"scripts": {
|
|
181
191
|
"build": "rimraf dist && rollup -c",
|