vitest 5.1.0 → 5.1.2
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/dist/browser.d.ts +6 -5
- package/dist/browser.js +7 -7
- package/dist/chunks/{base.Cof-UHJf.js → base.DCg6Jh4N.js} +12 -12
- package/dist/chunks/{browser.d.C7tWgUvw.d.ts → browser.d.B-QwH_F6.d.ts} +3 -3
- package/dist/chunks/{cac.BYbt0aJp.js → cac.DnNTZKhD.js} +15 -10
- package/dist/chunks/{cli-api.COfZo8lK.js → cli-api.9v9AxcPO.js} +444 -161
- package/dist/chunks/{config.d.B3YV4t0O.d.ts → config.d.BpJq6tRA.d.ts} +7 -1
- package/dist/chunks/{console.CQZ877Hi.js → console.DdxlsSsm.js} +4 -4
- package/dist/chunks/{creator.DHWmytIK.js → creator.B-BIoERb.js} +13 -11
- package/dist/chunks/{display.BlTmubjj.js → display.Cj2h2zsY.js} +1 -1
- package/dist/chunks/{doctor.B-oPbwps.js → doctor.DBFXC86z.js} +1 -1
- package/dist/chunks/{environment.d.BFQtFKdZ.d.ts → environment.d.rlpAM-ON.d.ts} +1 -1
- package/dist/chunks/{globals.ZKtKSkEf.js → globals.Cz5RAf6U.js} +10 -10
- package/dist/chunks/{index.Di8au7q4.js → index.6pLw0FLK.js} +220 -91
- package/dist/chunks/{index.w_oBZ9N8.js → index.BSqmIH9v.js} +3 -3
- package/dist/chunks/{index.Bi0NXYPf.js → index.C7Nn66Gy.js} +21 -9
- package/dist/chunks/{index.DmDMHCg8.js → index.CAmut2NG.js} +25 -1
- package/dist/chunks/{index.CZzC1gGg.js → index.D5jWOaqm.js} +35 -22
- package/dist/chunks/{index.D0heQG4v.js → index.Or9psEGe.js} +1 -1
- package/dist/chunks/{init-forks.BaDXQSD8.js → init-forks.q4IoGYZe.js} +7 -1
- package/dist/chunks/{init-threads.ZX_Vov0z.js → init-threads.Bf1Frg9S.js} +1 -1
- package/dist/chunks/{init.CO4AB7HZ.js → init.dGO4K2C0.js} +16 -8
- package/dist/chunks/{inspector.CvyFGlXm.js → inspector.D6o1NPo1.js} +12 -1
- package/dist/chunks/{modules.BJuCwlRJ.js → moduleSourceMap.Dp1WduWi.js} +31 -1
- package/dist/chunks/{native.upB-V0CK.js → native.D5q1ylZC.js} +2 -1
- package/dist/chunks/{nativeModuleMocker.Dh5azSB4.js → nativeModuleMocker.ihb3q7Cg.js} +4 -2
- package/dist/chunks/{plugin.d.LRFSN46m.d.ts → plugin.d.Bx2wJglX.d.ts} +58 -75
- package/dist/chunks/{plugins.DPQHVT0p.js → plugins.BPruPOR8.js} +1 -1
- package/dist/chunks/{rawSnapshot.DqSiqIEx.js → rawSnapshot.DvoRLRNr.js} +2 -2
- package/dist/chunks/{rpc.Uhkwr2NM.js → rpc.CNYWPa97.js} +3 -19
- package/dist/chunks/{rpc.d.3FOhdFx8.d.ts → rpc.d.DHfuwqP0.d.ts} +2 -2
- package/dist/chunks/{run.CjdgFZiW.js → run.zBhXlcZQ.js} +113 -49
- package/dist/chunks/{setup-common.CqAQCXzx.js → setup-common.kEGtNVHG.js} +3 -3
- package/dist/chunks/{source-map.DakdQc29.js → source-map.DPHGMWvM.js} +3 -1
- package/dist/chunks/{source-map.d.BkG8YK_3.d.ts → source-map.d.xB6_75fl.d.ts} +2 -1
- package/dist/chunks/{spy.DDMXghXv.js → spy.BO0hTE3G.js} +76 -53
- package/dist/chunks/{task-utils.d.D-gFPNFi.d.ts → task-utils.d.DgSjIb7r.d.ts} +1 -1
- package/dist/chunks/{utils.BBk_icFG.js → utils.sAsh2ClK.js} +2 -6
- package/dist/chunks/{vm.b4MbCAJQ.js → vm.DNr3Eju_.js} +4 -4
- package/dist/chunks/{worker.d.CyJRpyfZ.d.ts → worker.d.BigfbIsH.d.ts} +3 -3
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +8 -8
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/module-evaluator.js +1 -1
- package/dist/node.d.ts +11 -10
- package/dist/node.js +18 -15
- package/dist/runtime.d.ts +5 -4
- package/dist/runtime.js +5 -3
- package/dist/spy.js +1 -1
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +19 -18
- package/dist/workers/forks.js +20 -19
- package/dist/workers/runVmTests.js +14 -14
- package/dist/workers/threads.js +20 -19
- package/dist/workers/vmForks.js +14 -13
- package/dist/workers/vmThreads.js +14 -13
- package/dist/workers/watchdog.js +20 -0
- package/package.json +21 -21
- /package/dist/chunks/{index.BoyTG_B7.js → dist.BoyTG_B7.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DevEnvironment, IndexHtmlTransformContext, IndexHtmlTransformResult, ViteDevServer, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1,
|
|
2
|
-
import { aW as TaskMeta, U as UserConsoleLog, Q as Suite, a as File, bk as SerializableRetry, T as TestError, h as TestAnnotation, j as TestArtifact, b2 as TestBenchmark, aL as SerializedError, a1 as ImportDuration, n as Test, A as Awaitable, Z as CancelReason, P as ParsedStack, bl as BrowserTraceViewMode, bm as BrowserTraceViewRecordingMode, a6 as BaselineData, p as ProvidedContext, b as SerializedConfig, bn as Arrayable, a3 as AfterSuiteRunMeta, aQ as SnapshotStateOptions, aR as SnapshotSummary, aO as SnapshotResult, Y as Task, bo as AsyncLeak, k as TaskResultPack, F as FileSpecification, m as SerializedRootConfig, L as LabelColor, c as SerializedDiffOptions, bi as SequenceSetupFiles, bh as SequenceHooks, bp as PrettyFormatOptions, e as FakeTimersConfig, g as TestTagDefinition } from './config.d.
|
|
1
|
+
import { DevEnvironment, IndexHtmlTransformContext, IndexHtmlTransformResult, ViteDevServer, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, parseAstAsync, TransformResult as TransformResult$1, InlineConfig as InlineConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions } from 'vite';
|
|
2
|
+
import { aW as TaskMeta, U as UserConsoleLog, Q as Suite, a as File, bk as SerializableRetry, T as TestError, h as TestAnnotation, j as TestArtifact, b2 as TestBenchmark, aL as SerializedError, a1 as ImportDuration, n as Test, A as Awaitable, Z as CancelReason, P as ParsedStack, bl as BrowserTraceViewMode, bm as BrowserTraceViewRecordingMode, a6 as BaselineData, p as ProvidedContext, b as SerializedConfig, bn as Arrayable, a3 as AfterSuiteRunMeta, aQ as SnapshotStateOptions, aR as SnapshotSummary, aO as SnapshotResult, Y as Task, bo as AsyncLeak, k as TaskResultPack, F as FileSpecification, m as SerializedRootConfig, L as LabelColor, c as SerializedDiffOptions, bi as SequenceSetupFiles, bh as SequenceHooks, bp as PrettyFormatOptions, e as FakeTimersConfig, g as TestTagDefinition } from './config.d.BpJq6tRA.js';
|
|
3
3
|
import { Writable } from 'node:stream';
|
|
4
|
-
import { S as SerializedTestSpecification, B as BrowserTesterOptions, c as SourceModuleDiagnostic } from './browser.d.
|
|
4
|
+
import { S as SerializedTestSpecification, B as BrowserTesterOptions, c as SourceModuleDiagnostic } from './browser.d.B-QwH_F6.js';
|
|
5
5
|
import * as chai from 'chai';
|
|
6
6
|
import { happyDomTypes, jsdomTypes } from 'vitest/optional-types.js';
|
|
7
|
-
import { a as ContextTestEnvironment, b as WorkerExecuteContext, c as WorkerTestEnvironment } from './worker.d.
|
|
8
|
-
import { O as OTELCarrier } from './rpc.d.
|
|
7
|
+
import { a as ContextTestEnvironment, b as WorkerExecuteContext, c as WorkerTestEnvironment } from './worker.d.BigfbIsH.js';
|
|
8
|
+
import { O as OTELCarrier } from './rpc.d.DHfuwqP0.js';
|
|
9
9
|
import { MockedModule } from '@vitest/mocker';
|
|
10
|
-
import { S as StackTraceParserOptions, a as RuntimeCoverageProviderModule } from './source-map.d.
|
|
10
|
+
import { S as StackTraceParserOptions, a as RuntimeCoverageProviderModule } from './source-map.d.xB6_75fl.js';
|
|
11
11
|
import { CDPSession, BrowserCommands, MarkOptions } from 'vitest/browser';
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import { Console } from 'node:console';
|
|
@@ -1331,7 +1331,32 @@ interface Report {
|
|
|
1331
1331
|
delete: (filename: string) => Promise<void>;
|
|
1332
1332
|
}
|
|
1333
1333
|
|
|
1334
|
-
|
|
1334
|
+
type PathParser = (path: string) => path.ParsedPath;
|
|
1335
|
+
declare class Path {
|
|
1336
|
+
v: string[];
|
|
1337
|
+
readonly length: number;
|
|
1338
|
+
push: (...items: string[]) => number;
|
|
1339
|
+
pop: () => string | undefined;
|
|
1340
|
+
shift: () => string | undefined;
|
|
1341
|
+
unshift: (...items: string[]) => number;
|
|
1342
|
+
splice: (start: number, deleteCount?: number, ...items: string[]) => string[];
|
|
1343
|
+
constructor(strOrArray: string | string[]);
|
|
1344
|
+
toString(): string;
|
|
1345
|
+
hasParent(): boolean;
|
|
1346
|
+
parent(): Path;
|
|
1347
|
+
elements(): string[];
|
|
1348
|
+
name(): string;
|
|
1349
|
+
contains(other: Path): boolean;
|
|
1350
|
+
ancestorOf(other: Path): boolean;
|
|
1351
|
+
descendantOf(other: Path): boolean;
|
|
1352
|
+
commonPrefixPath(other: Path): Path;
|
|
1353
|
+
static compare(a: Path, b: Path): number;
|
|
1354
|
+
static tester: {
|
|
1355
|
+
setParserAndSep(p: PathParser, sep: string): void;
|
|
1356
|
+
reset(): void;
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1335
1360
|
/**
|
|
1336
1361
|
* A partial visitor only having the functions of interest to the caller.
|
|
1337
1362
|
*
|
|
@@ -1391,34 +1416,6 @@ declare abstract class BaseNode {
|
|
|
1391
1416
|
visit(visitor: Visitor<any>, state?: any): void;
|
|
1392
1417
|
}
|
|
1393
1418
|
|
|
1394
|
-
//#region src/path.d.ts
|
|
1395
|
-
type PathParser = (path: string) => path.ParsedPath;
|
|
1396
|
-
declare class Path {
|
|
1397
|
-
v: string[];
|
|
1398
|
-
readonly length: number;
|
|
1399
|
-
push: (...items: string[]) => number;
|
|
1400
|
-
pop: () => string | undefined;
|
|
1401
|
-
shift: () => string | undefined;
|
|
1402
|
-
unshift: (...items: string[]) => number;
|
|
1403
|
-
splice: (start: number, deleteCount?: number, ...items: string[]) => string[];
|
|
1404
|
-
constructor(strOrArray: string | string[]);
|
|
1405
|
-
toString(): string;
|
|
1406
|
-
hasParent(): boolean;
|
|
1407
|
-
parent(): Path;
|
|
1408
|
-
elements(): string[];
|
|
1409
|
-
name(): string;
|
|
1410
|
-
contains(other: Path): boolean;
|
|
1411
|
-
ancestorOf(other: Path): boolean;
|
|
1412
|
-
descendantOf(other: Path): boolean;
|
|
1413
|
-
commonPrefixPath(other: Path): Path;
|
|
1414
|
-
static compare(a: Path, b: Path): number;
|
|
1415
|
-
static tester: {
|
|
1416
|
-
setParserAndSep(p: PathParser, sep: string): void;
|
|
1417
|
-
reset(): void;
|
|
1418
|
-
};
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
//#region src/coverage-summary.d.ts
|
|
1422
1419
|
/**
|
|
1423
1420
|
* Totals for a single coverage metric (statements, lines, functions, branches).
|
|
1424
1421
|
* `pct` is a percentage number (0-100), or the string `"Unknown"` for a blank
|
|
@@ -1474,8 +1471,6 @@ declare class CoverageSummary {
|
|
|
1474
1471
|
*/
|
|
1475
1472
|
isEmpty(): boolean;
|
|
1476
1473
|
}
|
|
1477
|
-
//#endregion
|
|
1478
|
-
//#region src/file-coverage.d.ts
|
|
1479
1474
|
/** a single location in a source file: 1-based line, 0-based column */
|
|
1480
1475
|
interface Location {
|
|
1481
1476
|
line: number;
|
|
@@ -1594,8 +1589,6 @@ declare class FileCoverage {
|
|
|
1594
1589
|
*/
|
|
1595
1590
|
toSummary(): CoverageSummary;
|
|
1596
1591
|
}
|
|
1597
|
-
//#endregion
|
|
1598
|
-
//#region src/coverage-map.d.ts
|
|
1599
1592
|
/**
|
|
1600
1593
|
* Raw, JSON-serializable data underlying a `CoverageMap`: `FileCoverage`
|
|
1601
1594
|
* objects or their raw data keyed by file path. This can be the raw global
|
|
@@ -1655,7 +1648,6 @@ declare class CoverageMap {
|
|
|
1655
1648
|
getCoverageSummary(): CoverageSummary;
|
|
1656
1649
|
}
|
|
1657
1650
|
|
|
1658
|
-
//#region src/summarizer-factory.d.ts
|
|
1659
1651
|
/** names of the summarizer strategies supported by {@link SummarizerFactory} */
|
|
1660
1652
|
type Summarizers = "flat" | "nested" | "pkg" | "defaultSummarizer";
|
|
1661
1653
|
declare class ReportNode extends BaseNode {
|
|
@@ -1684,14 +1676,12 @@ interface ReportBaseOptions {
|
|
|
1684
1676
|
summarizer?: Summarizers;
|
|
1685
1677
|
}
|
|
1686
1678
|
|
|
1687
|
-
//#region src/reports/clover/index.d.ts
|
|
1688
1679
|
/** options accepted by {@link CloverReport} */
|
|
1689
1680
|
interface CloverOptions {
|
|
1690
1681
|
/** the file to write the report to, defaults to `clover.xml` */
|
|
1691
1682
|
file?: string;
|
|
1692
1683
|
}
|
|
1693
1684
|
|
|
1694
|
-
//#region src/reports/cobertura/index.d.ts
|
|
1695
1685
|
/** options accepted by {@link CoberturaReport} */
|
|
1696
1686
|
interface CoberturaOptions {
|
|
1697
1687
|
/** the file to write the report to, defaults to `cobertura-coverage.xml` */
|
|
@@ -1702,7 +1692,6 @@ interface CoberturaOptions {
|
|
|
1702
1692
|
projectRoot?: string;
|
|
1703
1693
|
}
|
|
1704
1694
|
|
|
1705
|
-
//#region src/reports/html/index.d.ts
|
|
1706
1695
|
/** maps report nodes to output paths, see the html report's `linkMapper` option */
|
|
1707
1696
|
interface LinkMapper {
|
|
1708
1697
|
getPath(node: ReportNode | string): string;
|
|
@@ -1729,28 +1718,24 @@ interface HtmlOptions {
|
|
|
1729
1718
|
theme?: HtmlTheme;
|
|
1730
1719
|
}
|
|
1731
1720
|
|
|
1732
|
-
//#region src/reports/html-spa/index.d.ts
|
|
1733
1721
|
/** options accepted by {@link HtmlSpaReport} */
|
|
1734
1722
|
interface HtmlSpaOptions extends Omit<HtmlOptions, "theme"> {
|
|
1735
1723
|
/** the metrics to show in the report UI, defaults to lines, branches and functions */
|
|
1736
1724
|
metricsToShow?: ("lines" | "branches" | "functions" | "statements")[];
|
|
1737
1725
|
}
|
|
1738
1726
|
|
|
1739
|
-
//#region src/reports/json-summary/index.d.ts
|
|
1740
1727
|
/** options accepted by {@link JsonSummaryReport} */
|
|
1741
1728
|
interface JsonSummaryOptions {
|
|
1742
1729
|
/** the file to write the report to, defaults to `coverage-summary.json` */
|
|
1743
1730
|
file?: string;
|
|
1744
1731
|
}
|
|
1745
1732
|
|
|
1746
|
-
//#region src/reports/json/index.d.ts
|
|
1747
1733
|
/** options accepted by {@link JsonReport} */
|
|
1748
1734
|
interface JsonOptions$1 {
|
|
1749
1735
|
/** the file to write the report to, defaults to `coverage-final.json` */
|
|
1750
1736
|
file?: string;
|
|
1751
1737
|
}
|
|
1752
1738
|
|
|
1753
|
-
//#region src/reports/lcovonly/index.d.ts
|
|
1754
1739
|
/** options accepted by {@link LcovOnlyReport} */
|
|
1755
1740
|
interface LcovOnlyOptions {
|
|
1756
1741
|
/** the file to write the report to, defaults to `lcov.info` */
|
|
@@ -1759,11 +1744,9 @@ interface LcovOnlyOptions {
|
|
|
1759
1744
|
projectRoot?: string;
|
|
1760
1745
|
}
|
|
1761
1746
|
|
|
1762
|
-
//#region src/reports/lcov/index.d.ts
|
|
1763
1747
|
/** options accepted by {@link LcovReport}, passed through to the lcovonly report */
|
|
1764
1748
|
interface LcovOptions extends LcovOnlyOptions {}
|
|
1765
1749
|
|
|
1766
|
-
//#region src/reports/teamcity/index.d.ts
|
|
1767
1750
|
/** options accepted by {@link TeamcityReport} */
|
|
1768
1751
|
interface TeamcityOptions {
|
|
1769
1752
|
/** the file to write the report to, defaults to the console */
|
|
@@ -1772,21 +1755,18 @@ interface TeamcityOptions {
|
|
|
1772
1755
|
blockName?: string;
|
|
1773
1756
|
}
|
|
1774
1757
|
|
|
1775
|
-
//#region src/reports/text-lcov/index.d.ts
|
|
1776
1758
|
/** options accepted by {@link TextLcov}, `file` is always the console */
|
|
1777
1759
|
interface TextLcovOptions {
|
|
1778
1760
|
/** the project root used to relativize file paths, defaults to `process.cwd()` */
|
|
1779
1761
|
projectRoot?: string;
|
|
1780
1762
|
}
|
|
1781
1763
|
|
|
1782
|
-
//#region src/reports/text-summary/index.d.ts
|
|
1783
1764
|
/** options accepted by {@link TextSummaryReport} */
|
|
1784
1765
|
interface TextSummaryOptions {
|
|
1785
1766
|
/** the file to write the report to, defaults to the console */
|
|
1786
1767
|
file?: string | null;
|
|
1787
1768
|
}
|
|
1788
1769
|
|
|
1789
|
-
//#region src/reports/text/index.d.ts
|
|
1790
1770
|
/** options accepted by {@link TextReport} */
|
|
1791
1771
|
interface TextOptions extends ReportBaseOptions {
|
|
1792
1772
|
/** the file to write the report to, defaults to the console */
|
|
@@ -1818,6 +1798,14 @@ interface ReportOptions {
|
|
|
1818
1798
|
|
|
1819
1799
|
type TransformResult = string | Partial<TransformResult$1> | undefined | null | void;
|
|
1820
1800
|
type CoverageResults = unknown;
|
|
1801
|
+
type AstNode = CollectNodes<Awaited<ReturnType<typeof parseAstAsync>>>;
|
|
1802
|
+
type CollectNodes<
|
|
1803
|
+
T,
|
|
1804
|
+
Depth extends unknown[] = []
|
|
1805
|
+
> = Depth["length"] extends 8 ? T : CollectNodes<T | ChildNodes<T>, [...Depth, unknown]>;
|
|
1806
|
+
type ChildNodes<T> = T extends unknown ? Extract<{ [K in keyof T]: NonNullable<T[K]> extends readonly (infer U)[] ? NonNullable<U> : NonNullable<T[K]> }[keyof T], {
|
|
1807
|
+
type: string;
|
|
1808
|
+
}> : never;
|
|
1821
1809
|
interface CoverageProvider {
|
|
1822
1810
|
name: string;
|
|
1823
1811
|
/** Called when provider is being initialized before tests run */
|
|
@@ -2030,7 +2018,7 @@ interface CoverageOptions {
|
|
|
2030
2018
|
* ignoreNode: (node, type) => type === 'statement' && node.type === 'DebuggerStatement'
|
|
2031
2019
|
* ```
|
|
2032
2020
|
*/
|
|
2033
|
-
ignoreNode?: (node:
|
|
2021
|
+
ignoreNode?: (node: AstNode, type: "function" | "statement" | "branch") => boolean | "ignore-this-and-nested-nodes" | void;
|
|
2034
2022
|
/**
|
|
2035
2023
|
* Custom instrumenter factory to use instead of the default `@vitest/istanbul-lib-instrument`.
|
|
2036
2024
|
*
|
|
@@ -2353,14 +2341,7 @@ declare class StateManager {
|
|
|
2353
2341
|
/** Number of test workers that were started during the run. */
|
|
2354
2342
|
workersSpawned: number;
|
|
2355
2343
|
metadata: Record<string, {
|
|
2356
|
-
externalized: Record<string, string>;
|
|
2357
2344
|
duration: Record<string, number[]>;
|
|
2358
|
-
tmps: Record<string, string>;
|
|
2359
|
-
dumpDir?: string;
|
|
2360
|
-
outline?: {
|
|
2361
|
-
externalized: number;
|
|
2362
|
-
inlined: number;
|
|
2363
|
-
};
|
|
2364
2345
|
}>;
|
|
2365
2346
|
onUnhandledError?: OnUnhandledErrorCallback;
|
|
2366
2347
|
constructor(options: {
|
|
@@ -2517,6 +2498,7 @@ declare class Vitest {
|
|
|
2517
2498
|
private restartsCount;
|
|
2518
2499
|
private readonly specifications;
|
|
2519
2500
|
private pool;
|
|
2501
|
+
private sequencer;
|
|
2520
2502
|
private _coverageProvider?;
|
|
2521
2503
|
/**
|
|
2522
2504
|
* @deprecated Do not rely on this property, it's always `test`. Scheduled to be removed in the next major.
|
|
@@ -2670,6 +2652,8 @@ declare class Vitest {
|
|
|
2670
2652
|
/** @default os.availableParallelism() */
|
|
2671
2653
|
concurrency?: number;
|
|
2672
2654
|
}): Promise<TestModule[]>;
|
|
2655
|
+
private preParseSpecifications;
|
|
2656
|
+
private parseFiles;
|
|
2673
2657
|
experimental_parseSpecification(specification: TestSpecification): Promise<TestModule>;
|
|
2674
2658
|
/**
|
|
2675
2659
|
* Collect tests in specified modules. Vitest will run the files to collect tests.
|
|
@@ -2680,6 +2664,7 @@ declare class Vitest {
|
|
|
2680
2664
|
* Gracefully cancel the current test run. Vitest will wait until all running tests are finished before cancelling.
|
|
2681
2665
|
*/
|
|
2682
2666
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
2667
|
+
private getSequencer;
|
|
2683
2668
|
private initializeGlobalSetup;
|
|
2684
2669
|
/**
|
|
2685
2670
|
* Update snapshots in specified files. If no files are provided, it will update files with failed tests and obsolete snapshots.
|
|
@@ -3705,21 +3690,13 @@ interface InlineConfig {
|
|
|
3705
3690
|
deps?: DepsOptions;
|
|
3706
3691
|
server?: {
|
|
3707
3692
|
deps?: ServerDepsOptions;
|
|
3693
|
+
/**
|
|
3694
|
+
* @deprecated This option does nothing. To inspect or edit the transformed code,
|
|
3695
|
+
* look up the module in the `fsModuleCache` manifest.
|
|
3696
|
+
* @see {@link https://vitest.dev/config/fsmodulecache#manifest}
|
|
3697
|
+
*/
|
|
3708
3698
|
debug?: {
|
|
3709
|
-
/**
|
|
3710
|
-
* The folder where Vitest stores the contents of transformed
|
|
3711
|
-
* test files that can be inspected manually.
|
|
3712
|
-
*
|
|
3713
|
-
* If `true`, Vitest dumps the files in `.vitest-dump` folder relative to the root of the project.
|
|
3714
|
-
*
|
|
3715
|
-
* You can also use `VITEST_DEBUG_DUMP` env variable to enable this.
|
|
3716
|
-
*/
|
|
3717
3699
|
dump?: string | true;
|
|
3718
|
-
/**
|
|
3719
|
-
* If dump is enabled, should Vitest load the files from there instead of transforming them.
|
|
3720
|
-
*
|
|
3721
|
-
* You can also use `VITEST_DEBUG_LOAD_DUMP` env variable to enable this.
|
|
3722
|
-
*/
|
|
3723
3700
|
load?: boolean;
|
|
3724
3701
|
};
|
|
3725
3702
|
};
|
|
@@ -4552,7 +4529,7 @@ interface UserConfig extends InlineConfig {
|
|
|
4552
4529
|
type OnUnhandledErrorCallback = (error: (TestError | Error) & {
|
|
4553
4530
|
type: string;
|
|
4554
4531
|
}) => boolean | void;
|
|
4555
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name" | "vmMemoryLimit" | "fileParallelism" | "tagsFilter" | "reporter" | "ui"> {
|
|
4532
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name" | "vmMemoryLimit" | "fileParallelism" | "tagsFilter" | "reporter" | "ui" | "inspector"> {
|
|
4556
4533
|
name: ProjectName["label"];
|
|
4557
4534
|
color?: ProjectName["color"];
|
|
4558
4535
|
base?: string;
|
|
@@ -4571,6 +4548,13 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
4571
4548
|
poolRunner?: PoolRunnerInitializer;
|
|
4572
4549
|
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
4573
4550
|
defines: Record<string, any>;
|
|
4551
|
+
inspector: NonNullable<UserConfig["inspector"]> & {
|
|
4552
|
+
/**
|
|
4553
|
+
* The main process has an open inspector. A debugger attached to it can attach to workers too.
|
|
4554
|
+
* @internal
|
|
4555
|
+
*/
|
|
4556
|
+
openInMainProcess: boolean;
|
|
4557
|
+
};
|
|
4574
4558
|
api: ResolvedApiConfig;
|
|
4575
4559
|
ui: boolean;
|
|
4576
4560
|
uiOptions: Required<Omit<UIOptions, "enabled">>;
|
|
@@ -4602,7 +4586,6 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
4602
4586
|
runner?: string;
|
|
4603
4587
|
maxWorkers: number;
|
|
4604
4588
|
vmMemoryLimit?: string | number;
|
|
4605
|
-
dumpDir?: string;
|
|
4606
4589
|
tagsFilter?: string[];
|
|
4607
4590
|
mergeReportsLabel?: string;
|
|
4608
4591
|
experimental: Omit<Required<UserConfig>["experimental"], "importDurations" | "diagnostics"> & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { f as isObject, h as getCallLastIndex } from './pathe.M-eThtNZ.zq3TM4NT.js';
|
|
2
2
|
import { p as positionToOffset, o as offsetToLineNumber, l as lineSplitRE } from './offset.Dy-5Fdfn.js';
|
|
3
|
-
import { g as getDefaultExportFromCjs, f as format } from './index.
|
|
4
|
-
import { g as getSerializers } from './plugins.
|
|
3
|
+
import { g as getDefaultExportFromCjs, f as format } from './index.Or9psEGe.js';
|
|
4
|
+
import { g as getSerializers } from './plugins.BPruPOR8.js';
|
|
5
5
|
|
|
6
6
|
var naturalCompare$1 = {exports: {}};
|
|
7
7
|
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as getSafeTimers } from './source-map.DakdQc29.js';
|
|
4
|
-
import { c as createBirpc } from './index.DmDMHCg8.js';
|
|
1
|
+
import { a as getSafeTimers } from './source-map.DPHGMWvM.js';
|
|
2
|
+
import { c as createBirpc } from './index.CAmut2NG.js';
|
|
5
3
|
import { g as getWorkerState } from './utils.DYj33du9.js';
|
|
6
4
|
|
|
7
|
-
// TODO: this is not needed in Vite 7.2+
|
|
8
|
-
class VitestEvaluatedModules extends EvaluatedModules {
|
|
9
|
-
getModuleSourceMapById(id) {
|
|
10
|
-
/** the return type is not exposed by Vite */
|
|
11
|
-
const map = super.getModuleSourceMapById(id);
|
|
12
|
-
if (map != null && !("_patched" in map)) {
|
|
13
|
-
map._patched = true;
|
|
14
|
-
const dir = dirname(map.url);
|
|
15
|
-
map.resolvedSources = (map.map.sources || []).map((s) => resolve(dir, s || ""));
|
|
16
|
-
}
|
|
17
|
-
return map;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
5
|
const { get } = Reflect;
|
|
22
6
|
const globalProcess = globalThis.process;
|
|
23
7
|
function withSafeTimers(fn) {
|
|
@@ -90,4 +74,4 @@ function rpc() {
|
|
|
90
74
|
return rpc;
|
|
91
75
|
}
|
|
92
76
|
|
|
93
|
-
export {
|
|
77
|
+
export { rpcDone as a, createRuntimeRpc as c, onCancel as o, rpc as r };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bw as
|
|
1
|
+
import { bw as VitestFetchResult, bx as FetchCachedFileSystemResult, by as ResolveFunctionResult, U as UserConsoleLog, bo as AsyncLeak, a as File, a3 as AfterSuiteRunMeta, b2 as TestBenchmark, j as TestArtifact, k as TaskResultPack, l as TaskEventPack, Z as CancelReason, aO as SnapshotResult, a6 as BaselineData } from './config.d.BpJq6tRA.js';
|
|
2
2
|
import { FetchFunctionOptions, FetchResult } from 'vite/module-runner';
|
|
3
3
|
|
|
4
4
|
interface OTELCarrier {
|
|
@@ -31,7 +31,7 @@ interface GetterTrackerExport {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
interface RuntimeRPC {
|
|
34
|
-
fetch: (id: string, importer: string | undefined, environment: string, options?: FetchFunctionOptions, otelCarrier?: OTELCarrier) => Promise<
|
|
34
|
+
fetch: (id: string, importer: string | undefined, environment: string, options?: FetchFunctionOptions, otelCarrier?: OTELCarrier) => Promise<VitestFetchResult | FetchCachedFileSystemResult>;
|
|
35
35
|
resolve: (id: string, importer: string | undefined, environment: string) => Promise<ResolveFunctionResult | null>;
|
|
36
36
|
/**
|
|
37
37
|
* Returns the modules of the given test files' import graphs that the server
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as format, p as plugins } from './index.
|
|
1
|
+
import { f as format, p as plugins } from './index.Or9psEGe.js';
|
|
2
2
|
import { $ } from './tinyrainbow.Do8I1XRG.js';
|
|
3
|
-
import { s as stringify, f as format$1, a as formatRegExp, t as truncateString, i as inspect } from './display.
|
|
3
|
+
import { s as stringify, f as format$1, a as formatRegExp, t as truncateString, i as inspect } from './display.Cj2h2zsY.js';
|
|
4
4
|
import { u as deepClone, v as getOwnProperties, g as getType$1, f as isObject, w as filterOutComments, x as ordinal, e as createDefer, y as assertTypes, t as toArray, z as isNegativeNaN, A as unique, B as objectAttr } from './pathe.M-eThtNZ.zq3TM4NT.js';
|
|
5
|
-
import { d as diffSequences, b as serializeValue, p as parseStacktrace, a as getSafeTimers } from './source-map.
|
|
5
|
+
import { d as diffSequences, b as serializeValue, p as parseStacktrace, a as getSafeTimers } from './source-map.DPHGMWvM.js';
|
|
6
6
|
import { createTaskName, createFileTask, calculateSuiteHash, interpretTaskModes, hasFailed } from '../task-utils.js';
|
|
7
7
|
|
|
8
8
|
const RealDate = Date;
|
|
@@ -1212,7 +1212,23 @@ function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE_
|
|
|
1212
1212
|
replacedExpected: expected
|
|
1213
1213
|
};
|
|
1214
1214
|
}
|
|
1215
|
-
if (
|
|
1215
|
+
if (isAsymmetricMatcher(expected)) {
|
|
1216
|
+
const sample = unwrapContainingMatcher(expected, actual);
|
|
1217
|
+
if (sample === void 0) return {
|
|
1218
|
+
replacedActual: actual,
|
|
1219
|
+
replacedExpected: expected
|
|
1220
|
+
};
|
|
1221
|
+
return replaceAsymmetricMatcher(actual, sample, actualReplaced, expectedReplaced);
|
|
1222
|
+
}
|
|
1223
|
+
if (isAsymmetricMatcher(actual)) {
|
|
1224
|
+
const sample = unwrapContainingMatcher(actual, expected);
|
|
1225
|
+
if (sample === void 0) return {
|
|
1226
|
+
replacedActual: actual,
|
|
1227
|
+
replacedExpected: expected
|
|
1228
|
+
};
|
|
1229
|
+
return replaceAsymmetricMatcher(sample, expected, actualReplaced, expectedReplaced);
|
|
1230
|
+
}
|
|
1231
|
+
if (actual === expected || !isReplaceable(actual, expected)) return {
|
|
1216
1232
|
replacedActual: actual,
|
|
1217
1233
|
replacedExpected: expected
|
|
1218
1234
|
};
|
|
@@ -1226,35 +1242,67 @@ function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE_
|
|
|
1226
1242
|
const expectedValue = expected[key];
|
|
1227
1243
|
const actualValue = actual[key];
|
|
1228
1244
|
if (isAsymmetricMatcher(expectedValue)) {
|
|
1229
|
-
if (expectedValue.asymmetricMatch(actualValue))
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
// For container matchers (ArrayContaining, ObjectContaining), unwrap and recursively process
|
|
1235
|
-
// Matcher doesn't match: unwrap but keep structure to show mismatch
|
|
1236
|
-
const replaced = replaceAsymmetricMatcher(actualValue, expectedValue.sample, actualReplaced, expectedReplaced);
|
|
1237
|
-
actual[key] = replaced.replacedActual;
|
|
1238
|
-
expected[key] = replaced.replacedExpected;
|
|
1245
|
+
if (expectedValue.asymmetricMatch(actualValue)) {
|
|
1246
|
+
// When matcher matches, replace expected with actual value
|
|
1247
|
+
// so they appear the same in the diff
|
|
1248
|
+
expected[key] = actualValue;
|
|
1249
|
+
return;
|
|
1239
1250
|
}
|
|
1240
1251
|
} else if (isAsymmetricMatcher(actualValue)) {
|
|
1241
|
-
if (actualValue.asymmetricMatch(expectedValue))
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
actual[key] = replaced.replacedActual;
|
|
1245
|
-
expected[key] = replaced.replacedExpected;
|
|
1252
|
+
if (actualValue.asymmetricMatch(expectedValue)) {
|
|
1253
|
+
actual[key] = expectedValue;
|
|
1254
|
+
return;
|
|
1246
1255
|
}
|
|
1247
|
-
} else if (isReplaceable(actualValue, expectedValue))
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
}
|
|
1256
|
+
} else if (!isReplaceable(actualValue, expectedValue)) return;
|
|
1257
|
+
const replaced = replaceAsymmetricMatcher(actualValue, expectedValue, actualReplaced, expectedReplaced);
|
|
1258
|
+
if (replaced.replacedActual !== actualValue) actual[key] = replaced.replacedActual;
|
|
1259
|
+
if (replaced.replacedExpected !== expectedValue) expected[key] = replaced.replacedExpected;
|
|
1252
1260
|
});
|
|
1253
1261
|
return {
|
|
1254
1262
|
replacedActual: actual,
|
|
1255
1263
|
replacedExpected: expected
|
|
1256
1264
|
};
|
|
1257
1265
|
}
|
|
1266
|
+
function isContainingMatcher(value) {
|
|
1267
|
+
if (!isAsymmetricMatcher(value)) return false;
|
|
1268
|
+
const name = value.toString();
|
|
1269
|
+
return name === "ObjectContaining" || name === "ArrayContaining";
|
|
1270
|
+
}
|
|
1271
|
+
// Show a failed ObjectContaining/ArrayContaining as the plain value it checks,
|
|
1272
|
+
// so the diff points at the mismatched entries
|
|
1273
|
+
function unwrapContainingMatcher(matcher, other) {
|
|
1274
|
+
// a matching matcher fails only with `.not`, keep it as is
|
|
1275
|
+
if (!isContainingMatcher(matcher) || matcher.asymmetricMatch(other)) return;
|
|
1276
|
+
const sample = matcher.sample;
|
|
1277
|
+
if (matcher.toString() === "ArrayContaining") return Array.isArray(sample) && Array.isArray(other) ? fillArrayContaining(matcher, sample, other) : void 0;
|
|
1278
|
+
if (getType$1(sample) === "Object" && getType$1(other) === "Object") {
|
|
1279
|
+
// keys that the matcher does not check are taken from the other side
|
|
1280
|
+
const filled = Object.create(Object.getPrototypeOf(other), Object.getOwnPropertyDescriptors(other));
|
|
1281
|
+
return Object.defineProperties(filled, Object.getOwnPropertyDescriptors(sample));
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
// Keep the other array in its order and add the items that it misses
|
|
1285
|
+
function fillArrayContaining(matcher, sample, other) {
|
|
1286
|
+
// check one item with the same equality as the matcher
|
|
1287
|
+
const includes = (array, item) => Object.create(matcher, { sample: { value: [item] } }).asymmetricMatch(array);
|
|
1288
|
+
const found = [];
|
|
1289
|
+
const missing = [];
|
|
1290
|
+
for (const item of sample) if (includes(other, item)) found.push(item);
|
|
1291
|
+
else missing.push(item);
|
|
1292
|
+
const unmatched = other.map((_, index) => index).filter((index) => !includes(found, other[index]));
|
|
1293
|
+
const filled = [...other];
|
|
1294
|
+
for (const item of missing) {
|
|
1295
|
+
// put an object in place of an unmatched object to show the difference inside it
|
|
1296
|
+
const position = unmatched.findIndex((index) => isDiffableInside(item, other[index]));
|
|
1297
|
+
if (position === -1) filled.push(item);
|
|
1298
|
+
else filled[unmatched.splice(position, 1)[0]] = item;
|
|
1299
|
+
}
|
|
1300
|
+
return filled;
|
|
1301
|
+
}
|
|
1302
|
+
function isDiffableInside(expected, actual) {
|
|
1303
|
+
if (isAsymmetricMatcher(expected)) return isContainingMatcher(expected) && isReplaceable(actual, expected.sample);
|
|
1304
|
+
return isReplaceable(actual, expected);
|
|
1305
|
+
}
|
|
1258
1306
|
function getLabelPrinter(...strings) {
|
|
1259
1307
|
const maxLength = strings.reduce((max, string) => string.length > max ? string.length : max, 0);
|
|
1260
1308
|
return (string) => `${string}: ${" ".repeat(maxLength - string.length)}`;
|
|
@@ -1384,6 +1432,12 @@ class TestRunAbortError extends Error {
|
|
|
1384
1432
|
this.reason = reason;
|
|
1385
1433
|
}
|
|
1386
1434
|
}
|
|
1435
|
+
class TestTimeoutError extends Error {
|
|
1436
|
+
name = "TestTimeoutError";
|
|
1437
|
+
}
|
|
1438
|
+
class HookTimeoutError extends Error {
|
|
1439
|
+
name = "HookTimeoutError";
|
|
1440
|
+
}
|
|
1387
1441
|
class FixtureDependencyError extends Error {
|
|
1388
1442
|
name = "FixtureDependencyError";
|
|
1389
1443
|
}
|
|
@@ -1591,8 +1645,12 @@ class TestFixtures {
|
|
|
1591
1645
|
const cleanupFnArrayMap = /* @__PURE__ */ new WeakMap();
|
|
1592
1646
|
async function callFixtureCleanup(context) {
|
|
1593
1647
|
const cleanupFnArray = cleanupFnArrayMap.get(context) ?? [];
|
|
1594
|
-
for (const cleanup of cleanupFnArray.reverse()) await cleanup();
|
|
1595
1648
|
cleanupFnArrayMap.delete(context);
|
|
1649
|
+
await runFixtureCleanups(cleanupFnArray);
|
|
1650
|
+
}
|
|
1651
|
+
// one context at a time, so that teardowns do not overlap and keep their order on every run
|
|
1652
|
+
async function callFixtureCleanups(contexts) {
|
|
1653
|
+
await runFixtureCleanups(contexts.map((context) => () => callFixtureCleanup(context)));
|
|
1596
1654
|
}
|
|
1597
1655
|
/**
|
|
1598
1656
|
* Returns the current number of cleanup functions registered for the context.
|
|
@@ -1609,12 +1667,17 @@ function getFixtureCleanupCount(context) {
|
|
|
1609
1667
|
async function callFixtureCleanupFrom(context, fromIndex) {
|
|
1610
1668
|
const cleanupFnArray = cleanupFnArrayMap.get(context);
|
|
1611
1669
|
if (!cleanupFnArray || cleanupFnArray.length <= fromIndex) return;
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1670
|
+
await runFixtureCleanups(cleanupFnArray.splice(fromIndex));
|
|
1671
|
+
}
|
|
1672
|
+
async function runFixtureCleanups(cleanups) {
|
|
1673
|
+
const errors = [];
|
|
1674
|
+
for (const cleanup of cleanups.reverse()) try {
|
|
1675
|
+
await cleanup();
|
|
1676
|
+
} catch (error) {
|
|
1677
|
+
errors.push(error);
|
|
1678
|
+
}
|
|
1679
|
+
if (errors.length === 1) throw errors[0];
|
|
1680
|
+
if (errors.length > 1) throw new AggregateError(errors, "Multiple fixture teardowns failed.");
|
|
1618
1681
|
}
|
|
1619
1682
|
const contextHasFixturesCache = /* @__PURE__ */ new WeakMap();
|
|
1620
1683
|
function withFixtures(fn, options) {
|
|
@@ -2699,7 +2762,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
2699
2762
|
Error.stackTraceLimit = 10;
|
|
2700
2763
|
const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
|
|
2701
2764
|
Error.stackTraceLimit = limit;
|
|
2702
|
-
if (handler) setFn(task, withTimeout(withCancel(withAwaitAsyncAssertions(withFixtures(handler, { context }), task),
|
|
2765
|
+
if (handler) setFn(task, withTimeout(withCancel(withAwaitAsyncAssertions(withFixtures(handler, { context }), task), context), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
|
|
2703
2766
|
if (runner.config.includeTaskLocation) {
|
|
2704
2767
|
const stack = findTestFileStackTrace(currentTestFilepath, stackTraceError);
|
|
2705
2768
|
if (stack) task.location = {
|
|
@@ -3328,8 +3391,9 @@ catch (error) {
|
|
|
3328
3391
|
});
|
|
3329
3392
|
};
|
|
3330
3393
|
}
|
|
3331
|
-
function withCancel(fn,
|
|
3394
|
+
function withCancel(fn, context) {
|
|
3332
3395
|
return function runWithCancel(...args) {
|
|
3396
|
+
const signal = context.signal;
|
|
3333
3397
|
return new Promise((resolve, reject) => {
|
|
3334
3398
|
const onAbort = () => reject(signal.reason);
|
|
3335
3399
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -3361,16 +3425,18 @@ function abortIfTimeout([context], error) {
|
|
|
3361
3425
|
function abortContextSignal(context, error) {
|
|
3362
3426
|
abortControllers.get(context)?.abort(error);
|
|
3363
3427
|
}
|
|
3428
|
+
function resetContextSignal(context) {
|
|
3429
|
+
// the next attempt of a cancelled run starts aborted
|
|
3430
|
+
if (abortControllers.get(context)?.signal.reason instanceof TestRunAbortError) return;
|
|
3431
|
+
const abortController = new AbortController();
|
|
3432
|
+
abortControllers.set(context, abortController);
|
|
3433
|
+
context.signal = abortController.signal;
|
|
3434
|
+
}
|
|
3364
3435
|
function createTestContext(test, runner) {
|
|
3365
3436
|
const context = function() {
|
|
3366
3437
|
throw new Error("done() callback is deprecated, use promise instead");
|
|
3367
3438
|
};
|
|
3368
|
-
|
|
3369
|
-
if (!abortController) {
|
|
3370
|
-
abortController = new AbortController();
|
|
3371
|
-
abortControllers.set(context, abortController);
|
|
3372
|
-
}
|
|
3373
|
-
context.signal = abortController.signal;
|
|
3439
|
+
resetContextSignal(context);
|
|
3374
3440
|
context.task = test;
|
|
3375
3441
|
context.skip = (condition, note) => {
|
|
3376
3442
|
if (condition === false)
|
|
@@ -3404,11 +3470,11 @@ function createTestContext(test, runner) {
|
|
|
3404
3470
|
});
|
|
3405
3471
|
context.onTestFailed = (handler, timeout) => {
|
|
3406
3472
|
test.onFailed ||= [];
|
|
3407
|
-
test.onFailed.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) =>
|
|
3473
|
+
test.onFailed.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) => abortContextSignal(context, error)));
|
|
3408
3474
|
};
|
|
3409
3475
|
context.onTestFinished = (handler, timeout) => {
|
|
3410
3476
|
test.onFinished ||= [];
|
|
3411
|
-
test.onFinished.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) =>
|
|
3477
|
+
test.onFinished.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) => abortContextSignal(context, error)));
|
|
3412
3478
|
};
|
|
3413
3479
|
return runner.extendTaskContext?.(context) || context;
|
|
3414
3480
|
}
|
|
@@ -3418,8 +3484,8 @@ function makeTimeoutError(isHook, timeout, stackTraceError, pending) {
|
|
|
3418
3484
|
const lastOperationSource = pending?.at(-1)?.source;
|
|
3419
3485
|
if (lastOperationSource) stackTraceError = lastOperationSource;
|
|
3420
3486
|
const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms${waiting}.\nIf this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
|
|
3421
|
-
const error = new
|
|
3422
|
-
if (stackTraceError?.stack) error.stack = stackTraceError.stack.replace(stackTraceError.message
|
|
3487
|
+
const error = isHook ? new HookTimeoutError(message) : new TestTimeoutError(message);
|
|
3488
|
+
if (stackTraceError?.stack) error.stack = stackTraceError.stack.replace(`${stackTraceError.name}: ${stackTraceError.message}`, `${error.name}: ${error.message}`);
|
|
3423
3489
|
return error;
|
|
3424
3490
|
}
|
|
3425
3491
|
|
|
@@ -3888,6 +3954,7 @@ async function runTest(test, runner) {
|
|
|
3888
3954
|
test.result.state = "run";
|
|
3889
3955
|
const retry = getRetryCount(test.retry);
|
|
3890
3956
|
for (let retryCount = 0; retryCount <= retry; retryCount++) {
|
|
3957
|
+
if (retryCount > 0 || repeatCount > 0) resetContextSignal(test.context);
|
|
3891
3958
|
const attemptStart = now();
|
|
3892
3959
|
const attemptStartTime = unixNow();
|
|
3893
3960
|
const attemptErrorsStart = test.result.errors?.length ?? 0;
|
|
@@ -4113,10 +4180,7 @@ async function runSuite(suite, runner) {
|
|
|
4113
4180
|
try {
|
|
4114
4181
|
await $("suite.afterAll", () => callSuiteHook(suite, suite, "afterAll", runner, [suite]));
|
|
4115
4182
|
if (beforeAllCleanups.length) await $("suite.cleanup", () => callCleanupHooks(runner, beforeAllCleanups));
|
|
4116
|
-
if (suite.file === suite)
|
|
4117
|
-
const contexts = TestFixtures.getFileContexts(suite.file);
|
|
4118
|
-
await Promise.all(contexts.map((context) => callFixtureCleanup(context)));
|
|
4119
|
-
}
|
|
4183
|
+
if (suite.file === suite) await callFixtureCleanups(TestFixtures.getFileContexts(suite.file));
|
|
4120
4184
|
} catch (e) {
|
|
4121
4185
|
failTask(suite.result, e, runner.config._diffOptions);
|
|
4122
4186
|
}
|
|
@@ -4199,7 +4263,7 @@ async function startTests(specs, runner) {
|
|
|
4199
4263
|
};
|
|
4200
4264
|
if (!workerRunners.has(runner)) {
|
|
4201
4265
|
runner.onCleanupWorkerContext?.(async () => {
|
|
4202
|
-
await
|
|
4266
|
+
await callFixtureCleanups(Array.from(TestFixtures.getWorkerContexts())).finally(() => {
|
|
4203
4267
|
TestFixtures.clearDefinitions();
|
|
4204
4268
|
});
|
|
4205
4269
|
});
|
|
@@ -4228,4 +4292,4 @@ async function publicCollect(specs, runner) {
|
|
|
4228
4292
|
return files;
|
|
4229
4293
|
}
|
|
4230
4294
|
|
|
4231
|
-
export {
|
|
4295
|
+
export { test as A, limitConcurrency as B, createTagsFilter as C, validateTags as D, shuffle as E, TestSyntaxError as T, processError as a, printDiffOrStringify as b, getCurrentTest as c, diff as d, recordArtifact as e, createTaskCollector as f, getRunningTests as g, getCurrentSuite as h, createChainable as i, getHooks as j, getFn as k, afterAll as l, matchesTags as m, afterEach as n, aroundAll as o, publicCollect as p, aroundEach as q, replaceAsymmetricMatcher as r, startTests as s, beforeAll as t, beforeEach as u, describe as v, it as w, onTestFailed as x, onTestFinished as y, suite as z };
|