vitest 0.25.2 → 0.25.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 +47 -2
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +10 -9
- package/dist/{chunk-api-setup.c5a9009c.js → chunk-api-setup.1c8923c4.js} +4 -2
- package/dist/{chunk-integrations-globals.06c8d418.js → chunk-integrations-globals.789c69e2.js} +7 -7
- package/dist/{chunk-runtime-chain.a0b441dc.js → chunk-runtime-chain.315721df.js} +25 -9
- package/dist/{chunk-runtime-error.6287172c.js → chunk-runtime-error.95c286d7.js} +2 -2
- package/dist/{chunk-runtime-mocker.a5151f99.js → chunk-runtime-mocker.cdc0ec57.js} +35 -19
- package/dist/{chunk-runtime-rpc.1e7530d3.js → chunk-runtime-rpc.b368762d.js} +2 -2
- package/dist/chunk-runtime-setup.80b27439.js +659 -0
- package/dist/{chunk-runtime-test-state.3cbc4575.js → chunk-runtime-test-state.7c288e2d.js} +78 -39
- package/dist/{chunk-typecheck-constants.4891f22f.js → chunk-typecheck-constants.ed987901.js} +12 -2
- package/dist/{chunk-utils-source-map.c6dfbbc1.js → chunk-utils-source-map.29ff1088.js} +3 -1
- package/dist/{chunk-utils-timers.06f993db.js → chunk-utils-timers.b81cda77.js} +2 -0
- package/dist/{chunk-vite-node-externalize.72a4d20b.js → chunk-vite-node-externalize.ddcbafa3.js} +59 -29
- package/dist/{chunk-vite-node-client.85cc7113.js → chunk-vite-node-source-map.61c5ea66.js} +37 -11
- package/dist/{chunk-vite-node-utils.8f0b4a12.js → chunk-vite-node-utils.abe05c5c.js} +105 -120
- package/dist/cli.js +14 -10
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.js +2 -1
- package/dist/entry.js +9 -8
- package/dist/environments.d.ts +1 -1
- package/dist/{index-2f5b6168.d.ts → index-81973d31.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/dist/loader.js +2 -2
- package/dist/node.d.ts +5 -4
- package/dist/node.js +9 -8
- package/dist/suite.js +6 -6
- package/dist/{types-f302dae9.d.ts → types-1cf24598.d.ts} +71 -24
- package/dist/{chunk-runtime-setup.419ccdd8.js → vendor-source-map-support.1ce17397.js} +1 -657
- package/dist/worker.js +9 -7
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
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.315721df.js';
|
|
2
|
+
import { e as dist } from './chunk-runtime-test-state.7c288e2d.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.7c288e2d.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-typecheck-constants.
|
|
8
|
+
import './chunk-typecheck-constants.ed987901.js';
|
|
9
9
|
import 'path';
|
|
10
10
|
import './chunk-utils-env.03f840f2.js';
|
|
11
11
|
import 'tty';
|
|
12
12
|
import 'url';
|
|
13
13
|
import 'local-pkg';
|
|
14
14
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
15
|
-
import './chunk-runtime-rpc.
|
|
16
|
-
import './chunk-utils-timers.
|
|
15
|
+
import './chunk-runtime-rpc.b368762d.js';
|
|
16
|
+
import './chunk-utils-timers.b81cda77.js';
|
|
17
17
|
import 'fs';
|
|
18
|
-
import './chunk-utils-source-map.
|
|
18
|
+
import './chunk-utils-source-map.29ff1088.js';
|
|
19
19
|
import './spy.js';
|
|
20
20
|
import 'tinyspy';
|
|
21
21
|
|
package/dist/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { pathToFileURL } from 'url';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
|
-
import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.
|
|
4
|
-
import { g as getWorkerState } from './chunk-typecheck-constants.
|
|
3
|
+
import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.abe05c5c.js';
|
|
4
|
+
import { g as getWorkerState } from './chunk-typecheck-constants.ed987901.js';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import './chunk-utils-env.03f840f2.js';
|
|
7
7
|
import 'tty';
|
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-1cf24598.js';
|
|
2
|
+
export { aB as TestSequencer, aD as TestSequencerConstructor, N as Vitest, aC as startVitest } from './types-1cf24598.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
4
|
import 'tinybench';
|
|
5
5
|
import 'fs';
|
|
@@ -20,6 +20,7 @@ declare class VitestMocker {
|
|
|
20
20
|
private request;
|
|
21
21
|
private static pendingIds;
|
|
22
22
|
private static spyModule?;
|
|
23
|
+
private resolveCache;
|
|
23
24
|
constructor(options: ExecuteOptions, moduleCache: ModuleCacheMap, request: ViteRunnerRequest);
|
|
24
25
|
private get root();
|
|
25
26
|
private get base();
|
|
@@ -36,9 +37,9 @@ declare class VitestMocker {
|
|
|
36
37
|
normalizePath(path: string): string;
|
|
37
38
|
getFsPath(path: string, external: string | null): string;
|
|
38
39
|
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
39
|
-
mockObject(object: Record<
|
|
40
|
+
mockObject(object: Record<Key, any>, mockExports?: Record<Key, any>): Record<Key, any>;
|
|
40
41
|
unmockPath(path: string): void;
|
|
41
|
-
mockPath(path: string, external: string | null, factory?: () => any): void;
|
|
42
|
+
mockPath(originalId: string, path: string, external: string | null, factory?: () => any): void;
|
|
42
43
|
importActual<T>(id: string, importer: string): Promise<T>;
|
|
43
44
|
importMock(id: string, importer: string): Promise<any>;
|
|
44
45
|
private ensureSpy;
|
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.ddcbafa3.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.cdc0ec57.js';
|
|
3
3
|
import './chunk-utils-env.03f840f2.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
@@ -8,7 +8,7 @@ import './chunk-integrations-coverage.befed097.js';
|
|
|
8
8
|
import 'local-pkg';
|
|
9
9
|
import './chunk-env-node.67948209.js';
|
|
10
10
|
import 'console';
|
|
11
|
-
import './chunk-typecheck-constants.
|
|
11
|
+
import './chunk-typecheck-constants.ed987901.js';
|
|
12
12
|
import 'vite';
|
|
13
13
|
import 'process';
|
|
14
14
|
import 'fs';
|
|
@@ -17,25 +17,26 @@ import 'util';
|
|
|
17
17
|
import 'stream';
|
|
18
18
|
import 'events';
|
|
19
19
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
20
|
-
import './chunk-vite-node-
|
|
20
|
+
import './chunk-vite-node-source-map.61c5ea66.js';
|
|
21
21
|
import 'module';
|
|
22
22
|
import 'vm';
|
|
23
|
-
import './chunk-vite-node-utils.
|
|
23
|
+
import './chunk-vite-node-utils.abe05c5c.js';
|
|
24
24
|
import 'acorn';
|
|
25
25
|
import 'assert';
|
|
26
26
|
import 'debug';
|
|
27
|
+
import './vendor-source-map-support.1ce17397.js';
|
|
28
|
+
import 'source-map';
|
|
27
29
|
import 'perf_hooks';
|
|
28
30
|
import 'fs/promises';
|
|
29
31
|
import './vendor-index.737c3cff.js';
|
|
30
32
|
import 'buffer';
|
|
31
33
|
import 'child_process';
|
|
32
34
|
import './vendor-index.e1d4cf84.js';
|
|
33
|
-
import 'source-map';
|
|
34
35
|
import 'acorn-walk';
|
|
35
36
|
import 'worker_threads';
|
|
36
37
|
import 'tinypool';
|
|
37
|
-
import './chunk-utils-timers.
|
|
38
|
-
import './chunk-utils-source-map.
|
|
38
|
+
import './chunk-utils-timers.b81cda77.js';
|
|
39
|
+
import './chunk-utils-source-map.29ff1088.js';
|
|
39
40
|
import 'crypto';
|
|
40
41
|
import './vendor-index.9c919048.js';
|
|
41
42
|
import './chunk-magic-string.ffe2b171.js';
|
package/dist/suite.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import 'util';
|
|
2
|
-
import '
|
|
3
|
-
|
|
2
|
+
import 'chai';
|
|
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.315721df.js';
|
|
4
5
|
import 'path';
|
|
5
6
|
import './chunk-utils-env.03f840f2.js';
|
|
6
7
|
import 'tty';
|
|
7
8
|
import 'url';
|
|
8
9
|
import 'local-pkg';
|
|
9
|
-
import 'chai';
|
|
10
10
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
11
|
-
import './chunk-runtime-rpc.
|
|
12
|
-
import './chunk-utils-timers.
|
|
11
|
+
import './chunk-runtime-rpc.b368762d.js';
|
|
12
|
+
import './chunk-utils-timers.b81cda77.js';
|
|
13
13
|
import 'fs';
|
|
14
|
-
import './chunk-utils-source-map.
|
|
14
|
+
import './chunk-utils-source-map.29ff1088.js';
|
|
15
15
|
import './spy.js';
|
|
16
16
|
import 'tinyspy';
|
|
@@ -267,7 +267,7 @@ declare class ModuleCacheMap extends Map<string, ModuleCache$1> {
|
|
|
267
267
|
/**
|
|
268
268
|
* Return parsed source map based on inlined source map of the module
|
|
269
269
|
*/
|
|
270
|
-
getSourceMap(id: string):
|
|
270
|
+
getSourceMap(id: string): RawSourceMap | null;
|
|
271
271
|
}
|
|
272
272
|
declare class ViteNodeRunner {
|
|
273
273
|
options: ViteNodeRunnerOptions;
|
|
@@ -281,7 +281,7 @@ declare class ViteNodeRunner {
|
|
|
281
281
|
constructor(options: ViteNodeRunnerOptions);
|
|
282
282
|
executeFile(file: string): Promise<any>;
|
|
283
283
|
executeId(id: string): Promise<any>;
|
|
284
|
-
getSourceMap(id: string):
|
|
284
|
+
getSourceMap(id: string): RawSourceMap | null;
|
|
285
285
|
/** @internal */
|
|
286
286
|
cachedRequest(rawId: string, callstack: string[]): Promise<any>;
|
|
287
287
|
/** @internal */
|
|
@@ -331,6 +331,7 @@ declare type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) =>
|
|
|
331
331
|
interface ModuleCache$1 {
|
|
332
332
|
promise?: Promise<any>;
|
|
333
333
|
exports?: any;
|
|
334
|
+
evaluated?: boolean;
|
|
334
335
|
code?: string;
|
|
335
336
|
map?: RawSourceMap;
|
|
336
337
|
/**
|
|
@@ -792,6 +793,7 @@ declare class JUnitReporter implements Reporter {
|
|
|
792
793
|
private reportFile?;
|
|
793
794
|
private baseLog;
|
|
794
795
|
private logger;
|
|
796
|
+
private _timeStart;
|
|
795
797
|
onInit(ctx: Vitest): Promise<void>;
|
|
796
798
|
writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
|
|
797
799
|
writeErrorDetails(error: ErrorWithDiff): Promise<void>;
|
|
@@ -1277,6 +1279,7 @@ interface TestEachFunction {
|
|
|
1277
1279
|
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1278
1280
|
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1279
1281
|
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1282
|
+
(...args: [TemplateStringsArray, ...any]): (name: string, fn: (...args: any[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1280
1283
|
}
|
|
1281
1284
|
declare type ChainableTestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
|
1282
1285
|
name: string,
|
|
@@ -1474,13 +1477,35 @@ declare type ResolvedCoverageOptions = {
|
|
|
1474
1477
|
} & Required<CoverageOptions>;
|
|
1475
1478
|
interface BaseCoverageOptions {
|
|
1476
1479
|
/**
|
|
1477
|
-
*
|
|
1480
|
+
* Enables coverage collection. Can be overriden using `--coverage` CLI option.
|
|
1478
1481
|
*
|
|
1479
1482
|
* @default false
|
|
1480
1483
|
*/
|
|
1481
1484
|
enabled?: boolean;
|
|
1482
1485
|
/**
|
|
1483
|
-
*
|
|
1486
|
+
* List of files included in coverage as glob patterns
|
|
1487
|
+
*
|
|
1488
|
+
* @default ['**']
|
|
1489
|
+
*/
|
|
1490
|
+
include?: string[];
|
|
1491
|
+
/**
|
|
1492
|
+
* Extensions for files to be included in coverage
|
|
1493
|
+
*
|
|
1494
|
+
* @default ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte']
|
|
1495
|
+
*/
|
|
1496
|
+
extension?: string | string[];
|
|
1497
|
+
/**
|
|
1498
|
+
* List of files excluded from coverage as glob patterns
|
|
1499
|
+
*/
|
|
1500
|
+
exclude?: string[];
|
|
1501
|
+
/**
|
|
1502
|
+
* Whether to include all files, including the untested ones into report
|
|
1503
|
+
*
|
|
1504
|
+
* @default false
|
|
1505
|
+
*/
|
|
1506
|
+
all?: boolean;
|
|
1507
|
+
/**
|
|
1508
|
+
* Clean coverage results before running tests
|
|
1484
1509
|
*
|
|
1485
1510
|
* @default true
|
|
1486
1511
|
*/
|
|
@@ -1496,56 +1521,62 @@ interface BaseCoverageOptions {
|
|
|
1496
1521
|
*/
|
|
1497
1522
|
reportsDirectory?: string;
|
|
1498
1523
|
/**
|
|
1499
|
-
*
|
|
1524
|
+
* Coverage reporters to use.
|
|
1525
|
+
* See [istanbul documentation](https://istanbul.js.org/docs/advanced/alternative-reporters/) for detailed list of all reporters.
|
|
1500
1526
|
*
|
|
1501
|
-
* @default 'text'
|
|
1527
|
+
* @default ['text', 'html', 'clover', 'json']
|
|
1502
1528
|
*/
|
|
1503
1529
|
reporter?: Arrayable<CoverageReporter>;
|
|
1504
|
-
/**
|
|
1505
|
-
* List of files included in coverage as glob patterns
|
|
1506
|
-
*/
|
|
1507
|
-
include?: string[];
|
|
1508
|
-
/**
|
|
1509
|
-
* List of files excluded from coverage as glob patterns
|
|
1510
|
-
*/
|
|
1511
|
-
exclude?: string[];
|
|
1512
1530
|
/**
|
|
1513
1531
|
* Do not show files with 100% statement, branch, and function coverage
|
|
1532
|
+
*
|
|
1533
|
+
* @default false
|
|
1514
1534
|
*/
|
|
1515
1535
|
skipFull?: boolean;
|
|
1516
1536
|
/**
|
|
1517
|
-
* Check thresholds per file
|
|
1537
|
+
* Check thresholds per file.
|
|
1538
|
+
* See `lines`, `functions`, `branches` and `statements` for the actual thresholds.
|
|
1518
1539
|
*
|
|
1519
1540
|
* @default false
|
|
1520
1541
|
*/
|
|
1521
1542
|
perFile?: boolean;
|
|
1522
1543
|
/**
|
|
1523
1544
|
* Threshold for lines
|
|
1545
|
+
*
|
|
1546
|
+
* @default undefined
|
|
1524
1547
|
*/
|
|
1525
1548
|
lines?: number;
|
|
1526
1549
|
/**
|
|
1527
1550
|
* Threshold for functions
|
|
1551
|
+
*
|
|
1552
|
+
* @default undefined
|
|
1528
1553
|
*/
|
|
1529
1554
|
functions?: number;
|
|
1530
1555
|
/**
|
|
1531
1556
|
* Threshold for branches
|
|
1557
|
+
*
|
|
1558
|
+
* @default undefined
|
|
1532
1559
|
*/
|
|
1533
1560
|
branches?: number;
|
|
1534
1561
|
/**
|
|
1535
1562
|
* Threshold for statements
|
|
1563
|
+
*
|
|
1564
|
+
* @default undefined
|
|
1536
1565
|
*/
|
|
1537
1566
|
statements?: number;
|
|
1567
|
+
}
|
|
1568
|
+
interface CoverageIstanbulOptions extends BaseCoverageOptions {
|
|
1538
1569
|
/**
|
|
1539
|
-
*
|
|
1570
|
+
* Set to array of class method names to ignore for coverage
|
|
1571
|
+
*
|
|
1572
|
+
* @default []
|
|
1540
1573
|
*/
|
|
1541
|
-
|
|
1574
|
+
ignoreClassMethods?: string[];
|
|
1542
1575
|
/**
|
|
1543
|
-
*
|
|
1576
|
+
* Watermarks for statements, lines, branches and functions.
|
|
1577
|
+
*
|
|
1578
|
+
* Default value is `[50,80]` for each property.
|
|
1544
1579
|
*/
|
|
1545
|
-
all?: boolean;
|
|
1546
|
-
}
|
|
1547
|
-
interface CoverageIstanbulOptions extends BaseCoverageOptions {
|
|
1548
|
-
ignoreClassMethods?: string[];
|
|
1549
1580
|
watermarks?: {
|
|
1550
1581
|
statements?: [number, number];
|
|
1551
1582
|
functions?: [number, number];
|
|
@@ -1559,14 +1590,24 @@ interface CoverageC8Options extends BaseCoverageOptions {
|
|
|
1559
1590
|
*
|
|
1560
1591
|
* @default false
|
|
1561
1592
|
*/
|
|
1562
|
-
allowExternal?:
|
|
1593
|
+
allowExternal?: boolean;
|
|
1563
1594
|
/**
|
|
1564
|
-
* Exclude coverage under
|
|
1595
|
+
* Exclude coverage under `/node_modules/`
|
|
1565
1596
|
*
|
|
1566
1597
|
* @default true
|
|
1567
1598
|
*/
|
|
1568
1599
|
excludeNodeModules?: boolean;
|
|
1600
|
+
/**
|
|
1601
|
+
* Specifies the directories that are used when `--all` is enabled.
|
|
1602
|
+
*
|
|
1603
|
+
* @default cwd
|
|
1604
|
+
*/
|
|
1569
1605
|
src?: string[];
|
|
1606
|
+
/**
|
|
1607
|
+
* Shortcut for `--check-coverage --lines 100 --functions 100 --branches 100 --statements 100`
|
|
1608
|
+
*
|
|
1609
|
+
* @default false
|
|
1610
|
+
*/
|
|
1570
1611
|
100?: boolean;
|
|
1571
1612
|
}
|
|
1572
1613
|
|
|
@@ -2049,6 +2090,12 @@ interface InlineConfig {
|
|
|
2049
2090
|
* Options for configuring typechecking test environment.
|
|
2050
2091
|
*/
|
|
2051
2092
|
typecheck?: Partial<TypecheckConfig>;
|
|
2093
|
+
/**
|
|
2094
|
+
* The number of milliseconds after which a test is considered slow and reported as such in the results.
|
|
2095
|
+
*
|
|
2096
|
+
* @default 300
|
|
2097
|
+
*/
|
|
2098
|
+
slowTestThreshold?: number;
|
|
2052
2099
|
}
|
|
2053
2100
|
interface TypecheckConfig {
|
|
2054
2101
|
/**
|