vitest 5.0.4 → 5.1.0-beta.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 +1 -1
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +3 -3
- package/dist/chunks/{base.CYbb9pQW.js → base.PJyN9N0u.js} +13 -11
- package/dist/chunks/{browser.d.FGQ9_rK6.d.ts → browser.d.D7a15z82.d.ts} +4 -3
- package/dist/chunks/{cac.DTXWs6Ni.js → cac.Ccf5Je_F.js} +21 -9
- package/dist/chunks/{cli-api.Bx28WXzL.js → cli-api.DE22LIzq.js} +4584 -4369
- package/dist/chunks/{config.d.QBNYCgFU.d.ts → config.d.BgktgHfG.d.ts} +134 -93
- package/dist/chunks/{console.DtI4yxfN.js → console.DrMPSuFo.js} +5 -2
- package/dist/chunks/{constants.-juJ8b_4.js → constants.DLYM6cZY.js} +1 -1
- package/dist/chunks/{creator.CLL8QFMS.js → creator.BQ3onxbh.js} +5 -5
- package/dist/chunks/{doctor.Bqc8NDDb.js → doctor.CPlMs7-y.js} +1 -1
- package/dist/chunks/{environment.d.BY56MoGs.d.ts → environment.d.CbTLsZSj.d.ts} +1 -1
- package/dist/chunks/{globals.CTWMSIPL.js → globals.TipXUFcZ.js} +5 -5
- package/dist/chunks/{index.GYMZ12wH.js → index.B03wg4V0.js} +5 -3
- package/dist/chunks/{index.CPNMO3h-.js → index.BFXLpwll.js} +119 -43
- package/dist/chunks/{index.uwTEEBsB.js → index.BXttT2gP.js} +37 -18
- package/dist/chunks/{index.B8VfM7Mf.js → index.D14IAvnE.js} +149 -96
- package/dist/chunks/{init-forks.CbYYa5xq.js → init-forks.BL1E3__4.js} +1 -1
- package/dist/chunks/{init-threads.DtjdvxPl.js → init-threads.CYXAGzKQ.js} +1 -1
- package/dist/chunks/{init.DrHtV5zd.js → init.DVorxUyL.js} +3 -3
- package/dist/chunks/{nativeModuleMocker.D8f4cW4A.js → nativeModuleMocker.3uBcOd84.js} +26 -4
- package/dist/chunks/{plugin.d.C8mmycim.d.ts → plugin.d.olEn8IL9.d.ts} +108 -20
- package/dist/chunks/{rpc.DpkUyY1N.js → rpc.BV0XpJ5q.js} +1 -1
- package/dist/chunks/{rpc.d.Cft1biqy.d.ts → rpc.d.DGFP7vWr.d.ts} +1 -1
- package/dist/chunks/{run.Cm2sd7-x.js → run.BfrMbGVD.js} +59 -32
- package/dist/chunks/{setup-common.BABL3z3m.js → setup-common.llxJkJaD.js} +2 -2
- package/dist/chunks/{source-map.DdKI5IHB.js → source-map.BjWcsIL9.js} +32 -24
- package/dist/chunks/{source-map.d.kzFtk_dj.d.ts → source-map.d.C5A_Tr6V.d.ts} +2 -1
- package/dist/chunks/{task-utils.d.PFh2BV6Q.d.ts → task-utils.d.BUh7ylUT.d.ts} +2 -1
- package/dist/chunks/{vm.Uo_C9Uld.js → vm.Cwj01UFE.js} +16 -5
- package/dist/chunks/{worker.d.BH-r1bPu.d.ts → worker.d.gsA26mmR.d.ts} +3 -3
- package/dist/cli.js +2 -2
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +11 -11
- package/dist/config.js +1 -1
- package/dist/index.d.ts +14 -13
- package/dist/index.js +4 -4
- package/dist/module-evaluator.d.ts +3 -2
- package/dist/module-evaluator.js +16 -12
- package/dist/node.d.ts +29 -11
- package/dist/node.js +7 -7
- package/dist/runtime.d.ts +4 -4
- package/dist/runtime.js +3 -2
- package/dist/task-utils.js +3 -1
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +9 -9
- package/dist/workers/forks.js +10 -10
- package/dist/workers/runVmTests.js +10 -8
- package/dist/workers/threads.js +10 -10
- package/dist/workers/vmForks.js +9 -8
- package/dist/workers/vmThreads.js +9 -8
- package/package.json +14 -14
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DevEnvironment, IndexHtmlTransformContext, IndexHtmlTransformResult, ViteDevServer, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, TransformResult as TransformResult$1, InlineConfig as InlineConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions } from 'vite';
|
|
2
|
-
import {
|
|
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, a6 as BaselineData, p as ProvidedContext, b as SerializedConfig, bm as Arrayable, a3 as AfterSuiteRunMeta, aQ as SnapshotStateOptions, aR as SnapshotSummary, aO as SnapshotResult, Y as Task, bn as AsyncLeak, k as TaskResultPack, F as FileSpecification, m as SerializedRootConfig, L as LabelColor, c as SerializedDiffOptions, bi as SequenceSetupFiles, bh as SequenceHooks, bo as PrettyFormatOptions, e as FakeTimersConfig, g as TestTagDefinition } from './config.d.BgktgHfG.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.D7a15z82.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.gsA26mmR.js';
|
|
8
|
+
import { O as OTELCarrier } from './rpc.d.DGFP7vWr.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.C5A_Tr6V.js';
|
|
11
11
|
import { CDPSession, BrowserCommands, MarkOptions } from 'vitest/browser';
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import { Console } from 'node:console';
|
|
@@ -132,6 +132,10 @@ declare class TestCase extends ReportedTaskImplementation {
|
|
|
132
132
|
*/
|
|
133
133
|
result(): TestResult;
|
|
134
134
|
/**
|
|
135
|
+
* Individual results for every retry and repeat attempt.
|
|
136
|
+
*/
|
|
137
|
+
attempts(): ReadonlyArray<TestAttempt>;
|
|
138
|
+
/**
|
|
135
139
|
* Test annotations added via the `task.annotate` API during the test execution.
|
|
136
140
|
*/
|
|
137
141
|
annotations(): ReadonlyArray<TestAnnotation>;
|
|
@@ -305,9 +309,27 @@ interface TaskOptions {
|
|
|
305
309
|
readonly timeout: number | undefined;
|
|
306
310
|
readonly mode: "run" | "only" | "skip" | "todo";
|
|
307
311
|
}
|
|
308
|
-
type
|
|
312
|
+
type TestAttemptState = "skipped" | "failed" | "passed";
|
|
313
|
+
type TestSuiteState = TestAttemptState | "pending";
|
|
309
314
|
type TestModuleState = TestSuiteState | "queued";
|
|
310
315
|
type TestState = TestResult["state"];
|
|
316
|
+
/**
|
|
317
|
+
* The result of an individual test attempt.
|
|
318
|
+
*/
|
|
319
|
+
interface TestAttempt {
|
|
320
|
+
/** The state after applying the test's expected failure option. */
|
|
321
|
+
readonly state: TestAttemptState;
|
|
322
|
+
/** Errors produced by this attempt. */
|
|
323
|
+
readonly errors: ReadonlyArray<TestError> | undefined;
|
|
324
|
+
/** How long in milliseconds the attempt took to run. */
|
|
325
|
+
readonly duration: number;
|
|
326
|
+
/** Time in milliseconds when the attempt started running. */
|
|
327
|
+
readonly startTime: number;
|
|
328
|
+
/** The zero-based retry index within the repeat. */
|
|
329
|
+
readonly retryIndex: number;
|
|
330
|
+
/** The zero-based repeat index. */
|
|
331
|
+
readonly repeatIndex: number;
|
|
332
|
+
}
|
|
311
333
|
type TestResult = TestResultPassed | TestResultFailed | TestResultSkipped | TestResultPending;
|
|
312
334
|
interface TestResultPending {
|
|
313
335
|
/**
|
|
@@ -448,6 +470,7 @@ declare function experimental_getRunnerTask(entity: TestCase | TestSuite | TestM
|
|
|
448
470
|
interface TestSpecificationOptions {
|
|
449
471
|
testNamePattern?: RegExp;
|
|
450
472
|
testIds?: string[];
|
|
473
|
+
testNames?: string[];
|
|
451
474
|
testLines?: number[];
|
|
452
475
|
testTagsFilter?: string[];
|
|
453
476
|
}
|
|
@@ -481,6 +504,10 @@ declare class TestSpecification {
|
|
|
481
504
|
*/
|
|
482
505
|
testIds: string[] | undefined;
|
|
483
506
|
/**
|
|
507
|
+
* The full names of the tests inside of this specification to run, including the parent suites separated with `>`.
|
|
508
|
+
*/
|
|
509
|
+
testNames: string[] | undefined;
|
|
510
|
+
/**
|
|
484
511
|
* The tags of tests to run.
|
|
485
512
|
*/
|
|
486
513
|
testTagsFilter: string[] | undefined;
|
|
@@ -549,7 +576,6 @@ interface BrowserTraceViewOptions {
|
|
|
549
576
|
* This option controls Vitest's own trace-view pipeline, independently from provider-specific trace retention.
|
|
550
577
|
*
|
|
551
578
|
* @default false
|
|
552
|
-
* @experimental
|
|
553
579
|
*/
|
|
554
580
|
enabled?: boolean;
|
|
555
581
|
/**
|
|
@@ -559,7 +585,6 @@ interface BrowserTraceViewOptions {
|
|
|
559
585
|
* In the trace viewer, this enables a weaker replay iframe sandbox because rrweb needs scripts to redraw canvas data.
|
|
560
586
|
*
|
|
561
587
|
* @default false
|
|
562
|
-
* @experimental
|
|
563
588
|
*/
|
|
564
589
|
recordCanvas?: boolean;
|
|
565
590
|
/**
|
|
@@ -569,9 +594,17 @@ interface BrowserTraceViewOptions {
|
|
|
569
594
|
* but can increase trace artifact size and does not preserve original image resource bytes.
|
|
570
595
|
*
|
|
571
596
|
* @default false
|
|
572
|
-
* @experimental
|
|
573
597
|
*/
|
|
574
598
|
inlineImages?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Capture the accessibility tree alongside each trace view snapshot.
|
|
601
|
+
*
|
|
602
|
+
* The trace viewer can switch from the DOM snapshot to an "Aria" view.
|
|
603
|
+
*
|
|
604
|
+
* @default true
|
|
605
|
+
* @experimental
|
|
606
|
+
*/
|
|
607
|
+
ariaSnapshot?: boolean;
|
|
575
608
|
}
|
|
576
609
|
type UnsupportedProperties = "browser" | "typecheck" | "alias" | "sequence" | "root" | "pool" | "runner" | "api" | "deps" | "environment" | "environmentOptions" | "server" | "benchmark" | "name";
|
|
577
610
|
interface BrowserInstanceOption extends Omit<ProjectConfig, UnsupportedProperties>, Pick<BrowserConfigOptions, "headless" | "locators" | "viewport" | "testerHtmlPath" | "screenshotDirectory" | "screenshotFailures"> {
|
|
@@ -695,7 +728,6 @@ interface BrowserConfigOptions {
|
|
|
695
728
|
* This option controls Vitest's own trace-view pipeline, independently from provider-specific trace retention.
|
|
696
729
|
*
|
|
697
730
|
* @default false
|
|
698
|
-
* @experimental
|
|
699
731
|
*/
|
|
700
732
|
traceView?: boolean | BrowserTraceViewOptions;
|
|
701
733
|
/**
|
|
@@ -770,6 +802,19 @@ interface BrowserConfigOptions {
|
|
|
770
802
|
* @default true
|
|
771
803
|
*/
|
|
772
804
|
trackUnhandledErrors?: boolean;
|
|
805
|
+
/**
|
|
806
|
+
* Serve module mocks through an import map in the tester document instead of
|
|
807
|
+
* intercepting network requests.
|
|
808
|
+
*
|
|
809
|
+
* By default, Vitest checks once per browser whether it accepts an import map
|
|
810
|
+
* after a module has loaded (Chromium 133+, Safari 18.4+, Firefox 150+ with
|
|
811
|
+
* `dom.multiple_import_maps.enabled`, which the Playwright provider sets) and
|
|
812
|
+
* falls back to request interception otherwise. `true` fails in a browser that
|
|
813
|
+
* cannot, `false` always intercepts.
|
|
814
|
+
*
|
|
815
|
+
* @experimental
|
|
816
|
+
*/
|
|
817
|
+
importMapMocks?: boolean;
|
|
773
818
|
}
|
|
774
819
|
interface BrowserCommandContext {
|
|
775
820
|
testPath: string | undefined;
|
|
@@ -856,7 +901,7 @@ interface ProjectBrowser {
|
|
|
856
901
|
close: () => Promise<void>;
|
|
857
902
|
initBrowserProvider: (project: TestProject) => Promise<void>;
|
|
858
903
|
closeBrowserProvider: (options?: BrowserProviderCloseOptions) => Promise<void>;
|
|
859
|
-
parseStacktrace: (stack: string) => ParsedStack[];
|
|
904
|
+
parseStacktrace: (stack: string, options?: StackTraceParserOptions) => ParsedStack[];
|
|
860
905
|
parseErrorStacktrace: (error: TestError, options?: StackTraceParserOptions) => ParsedStack[];
|
|
861
906
|
registerCommand: <K extends keyof BrowserCommands>(name: K, cb: BrowserCommand<Parameters<BrowserCommands[K]>, ReturnType<BrowserCommands[K]>>) => void;
|
|
862
907
|
triggerCommand: <K extends keyof BrowserCommands>(name: K, context: BrowserCommandContext, ...args: Parameters<BrowserCommands[K]>) => ReturnType<BrowserCommands[K]>;
|
|
@@ -1766,7 +1811,7 @@ interface CoverageProvider {
|
|
|
1766
1811
|
/** Called with coverage results after a single test file has been run */
|
|
1767
1812
|
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void | Promise<void>;
|
|
1768
1813
|
/** Callback called when test run starts */
|
|
1769
|
-
onTestRunStart?: () => void | Promise<void>;
|
|
1814
|
+
onTestRunStart?: (specifications: ReadonlyArray<TestSpecification>) => void | Promise<void>;
|
|
1770
1815
|
/** Callback called when test run fails due to test failures */
|
|
1771
1816
|
onTestFailure?: () => void | Promise<void>;
|
|
1772
1817
|
/** Callback to generate final coverage results */
|
|
@@ -2054,9 +2099,31 @@ interface TestRunResult {
|
|
|
2054
2099
|
unhandledErrors: unknown[];
|
|
2055
2100
|
}
|
|
2056
2101
|
|
|
2102
|
+
interface ModuleDependency {
|
|
2103
|
+
/**
|
|
2104
|
+
* Absolute path of the file.
|
|
2105
|
+
*/
|
|
2106
|
+
file: string;
|
|
2107
|
+
/**
|
|
2108
|
+
* Start time of the oldest run that recorded the file, in milliseconds since the epoch.
|
|
2109
|
+
* A change after this time was not seen by every test file that depends on the file.
|
|
2110
|
+
* It is not set when the dependency comes from the static module graph.
|
|
2111
|
+
*/
|
|
2112
|
+
recordedAt?: number;
|
|
2113
|
+
}
|
|
2114
|
+
interface ModulesResolver {
|
|
2115
|
+
/**
|
|
2116
|
+
* Every file whose change can affect the test files of the run.
|
|
2117
|
+
*/
|
|
2118
|
+
getDependencies(): Promise<ModuleDependency[]>;
|
|
2119
|
+
}
|
|
2057
2120
|
interface VCSProviderOptions {
|
|
2058
2121
|
root: string;
|
|
2059
2122
|
changedSince?: string | boolean;
|
|
2123
|
+
/**
|
|
2124
|
+
* Resolves the dependencies of the test files of the run.
|
|
2125
|
+
*/
|
|
2126
|
+
resolver: ModulesResolver;
|
|
2060
2127
|
}
|
|
2061
2128
|
interface VCSProvider {
|
|
2062
2129
|
findChangedFiles(options: VCSProviderOptions): Promise<string[]>;
|
|
@@ -2075,7 +2142,8 @@ declare class SnapshotManager {
|
|
|
2075
2142
|
|
|
2076
2143
|
interface CachedTestFileResult {
|
|
2077
2144
|
/**
|
|
2078
|
-
* The file has a known failure.
|
|
2145
|
+
* The file has a known failure.
|
|
2146
|
+
* A complete run of the file clears it, or a run in which every known failed test passes.
|
|
2079
2147
|
*/
|
|
2080
2148
|
failed: boolean;
|
|
2081
2149
|
/**
|
|
@@ -2088,6 +2156,11 @@ interface CachedTestFileResult {
|
|
|
2088
2156
|
* It is not set if the file never ran completely.
|
|
2089
2157
|
*/
|
|
2090
2158
|
lastRun?: number;
|
|
2159
|
+
/**
|
|
2160
|
+
* Full names of the tests that failed in the last run of the file. `--last-failed` runs only these tests.
|
|
2161
|
+
* It is not set if the failure happened outside of tests, for example in a hook or during collection.
|
|
2162
|
+
*/
|
|
2163
|
+
failedTests?: string[];
|
|
2091
2164
|
}
|
|
2092
2165
|
|
|
2093
2166
|
declare class VitestCache {
|
|
@@ -2645,6 +2718,10 @@ interface CliOptions extends UserConfig {
|
|
|
2645
2718
|
*/
|
|
2646
2719
|
run?: boolean;
|
|
2647
2720
|
/**
|
|
2721
|
+
* Run only the tests that failed in the last run
|
|
2722
|
+
*/
|
|
2723
|
+
lastFailed?: boolean;
|
|
2724
|
+
/**
|
|
2648
2725
|
* Removes colors from the console output
|
|
2649
2726
|
*/
|
|
2650
2727
|
color?: boolean;
|
|
@@ -2675,6 +2752,12 @@ interface CliOptions extends UserConfig {
|
|
|
2675
2752
|
configLoader?: InlineConfig$1 extends {
|
|
2676
2753
|
configLoader?: infer T;
|
|
2677
2754
|
} ? T : never;
|
|
2755
|
+
/**
|
|
2756
|
+
* Run only the tests whose recorded dependencies were modified since the last run of the test,
|
|
2757
|
+
* and the tests that failed in their last run. Requires `cache`.
|
|
2758
|
+
* @experimental
|
|
2759
|
+
*/
|
|
2760
|
+
sinceLastRun?: boolean;
|
|
2678
2761
|
}
|
|
2679
2762
|
/**
|
|
2680
2763
|
* Start Vitest programmatically
|
|
@@ -2833,6 +2916,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
2833
2916
|
onServerRestart(reason?: string): void;
|
|
2834
2917
|
reportSummary(files: File[], errors: unknown[]): void;
|
|
2835
2918
|
private printSourceFilterSummary;
|
|
2919
|
+
private printLastFailedSummary;
|
|
2836
2920
|
reportTestSummary(files: File[], errors: unknown[], leakCount: number): void;
|
|
2837
2921
|
/**
|
|
2838
2922
|
* Surfaces the cost of re-creating a DOM environment for every test file:
|
|
@@ -3885,7 +3969,7 @@ interface InlineConfig {
|
|
|
3885
3969
|
/**
|
|
3886
3970
|
* Options for @sinon/fake-timers
|
|
3887
3971
|
*/
|
|
3888
|
-
fakeTimers?:
|
|
3972
|
+
fakeTimers?: FakeTimersConfig;
|
|
3889
3973
|
/**
|
|
3890
3974
|
* Custom handler for console.log in tests.
|
|
3891
3975
|
*
|
|
@@ -4204,13 +4288,17 @@ interface InlineConfig {
|
|
|
4204
4288
|
*/
|
|
4205
4289
|
nodeLoader?: boolean;
|
|
4206
4290
|
/**
|
|
4207
|
-
*
|
|
4291
|
+
* Provider for detecting changed files. Used with the `--changed` flag
|
|
4208
4292
|
* to determine which files have been modified.
|
|
4209
4293
|
*
|
|
4210
|
-
*
|
|
4211
|
-
*
|
|
4294
|
+
* - `'git'` (default) compares the working tree with the `--changed` reference.
|
|
4295
|
+
* - `'mtime'` compares the modification time of every recorded dependency with the run
|
|
4296
|
+
* that recorded it. It requires `experimental.recordDependencies`. The test files that
|
|
4297
|
+
* failed in their last run also run.
|
|
4298
|
+
*
|
|
4299
|
+
* You can also provide a custom implementation of the `VCSProvider` interface.
|
|
4212
4300
|
*/
|
|
4213
|
-
vcsProvider?: VCSProvider | string;
|
|
4301
|
+
vcsProvider?: "git" | "mtime" | VCSProvider | (string & {});
|
|
4214
4302
|
/**
|
|
4215
4303
|
* Record the modules that every test file loads in the cache and use the records
|
|
4216
4304
|
* with `--changed` and `--related` instead of walking the module graph statically.
|
|
@@ -4576,5 +4664,5 @@ interface VitestPluginContext {
|
|
|
4576
4664
|
experimental_defineCacheKeyGenerator: (callback: CacheKeyIdGenerator) => void;
|
|
4577
4665
|
}
|
|
4578
4666
|
|
|
4579
|
-
export { Logger as L, MinimalReporter as M, PluginHarness as P,
|
|
4580
|
-
export type {
|
|
4667
|
+
export { Logger as L, MinimalReporter as M, PluginHarness as P, ReportersMap as aD, TapFlatReporter as aK, TapReporter as aL, TestCase as aP, TestCollection as aQ, TestModule as aS, DefaultReporter as aa, DotReporter as ac, GithubActionsReporter as ae, HangingProcessReporter as ag, JUnitReporter as aj, JsonReporter as am, TestSuite as b2, VerboseReporter as b8, VitestPackageInstaller as ba, experimental_getRunnerTask as bd, startVitest as be, Vitest as f, CoverageMap as h, TestSpecification as i, TestProject as k, BaseReporter as t };
|
|
4668
|
+
export type { CSSModuleScopeStrategy as $, ApiConfig as A, BaseCoverageOptions as B, CoverageOptions as C, BrowserModuleMocker as D, BrowserOrchestrator as E, FieldsWithDefaultValues as F, BrowserProvider as G, BrowserProviderCloseOptions as H, InlineConfig as I, BrowserProviderOption as J, BrowserScript as K, BrowserServerContribution as N, BrowserServerFactory as O, BrowserServerState as Q, ResolvedConfig as R, BrowserServerStateSession as S, TestProjectConfiguration as T, UserWorkspaceConfig as U, VitestPluginContext as V, WatcherTriggerPattern as W, BrowserTraceViewOptions as X, BuiltinEnvironment as Y, BuiltinReporterOptions as Z, BuiltinReporters as _, UserProjectConfigFn as a, TestSequencerConstructor as a$, CacheKeyIdGenerator as a0, CacheKeyIdGeneratorContext as a1, CachedTestFileResult as a2, CoverageInstrumenter as a3, CoverageIstanbulOptions as a4, CoverageProvider as a5, CoverageProviderModule as a6, CoverageReporter as a7, CoverageV8Options as a8, CustomProviderOptions as a9, Report as aA, ReportedHookContext as aB, Reporter as aC, ResolveSnapshotPathHandler as aE, ResolveSnapshotPathHandlerContext as aF, ResolvedBrowserOptions as aG, ResolvedProjectConfig as aH, SerializedTestProject as aI, SuiteNameTemplateVariables as aJ, TaskOptions as aM, TestAttempt as aN, TestAttemptState as aO, TestDiagnostic as aR, TestModuleState as aT, TestResult as aU, TestResultFailed as aV, TestResultPassed as aW, TestResultPending as aX, TestResultSkipped as aY, TestRunEndReason as aZ, TestRunResult as a_, DepsOptimizationOptions as ab, EnvironmentOptions as ad, HTMLOptions as af, InstrumenterOptions as ah, JUnitOptions as ai, JsonAssertionResult as ak, JsonOptions as al, JsonTestResult as an, JsonTestResults as ao, ModuleDependency as ap, ModuleDiagnostic as aq, ModulesResolver as ar, OnServerRestartHandler as as, OnTestsRerunHandler as at, ParentProjectBrowser as au, Pool as av, PoolRunnerInitializer as aw, PoolTask as ax, ProjectBrowser as ay, ProjectConfig as az, UserProjectConfigExport as b, TestSpecificationOptions as b0, TestState as b1, TestSuiteState as b3, ToMatchScreenshotComparators as b4, ToMatchScreenshotOptions as b5, TypecheckConfig as b6, UIOptions as b7, VitestEnvironment as b9, WorkerResponse as bb, _BrowserNames as bc, TestProjectInlineConfiguration as c, UserConfig as d, CliOptions as e, ResolvedCoverageOptions as g, ReportContext as j, VitestOptions as l, VitestRunMode as m, VCSProvider as n, VCSProviderOptions as o, PoolWorker as p, PoolOptions as q, WorkerRequest as r, TestSequencer as s, BenchmarkUserOptions as u, BrowserBuiltinProvider as v, BrowserCommand as w, BrowserCommandContext as x, BrowserConfigOptions as y, BrowserInstanceOption as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EvaluatedModules } from 'vite/module-runner';
|
|
2
2
|
import { d as dirname, r as resolve } from './pathe.M-eThtNZ.Ba-7h1rE.js';
|
|
3
|
-
import { a as getSafeTimers } from './source-map.
|
|
3
|
+
import { a as getSafeTimers } from './source-map.BjWcsIL9.js';
|
|
4
4
|
import { c as createBirpc } from './index.DmDMHCg8.js';
|
|
5
5
|
import { g as getWorkerState } from './utils.DYj33du9.js';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bv as FetchCachedFileSystemResult, bw as ResolveFunctionResult, U as UserConsoleLog, bn 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.BgktgHfG.js';
|
|
2
2
|
import { FetchFunctionOptions, FetchResult } from 'vite/module-runner';
|
|
3
3
|
|
|
4
4
|
interface OTELCarrier {
|
|
@@ -2,7 +2,7 @@ import { f as format, p as plugins } from './index.D0heQG4v.js';
|
|
|
2
2
|
import { $ } from './tinyrainbow.Do8I1XRG.js';
|
|
3
3
|
import { s as stringify, f as format$1, a as formatRegExp, t as truncateString, i as inspect } from './display.BlTmubjj.js';
|
|
4
4
|
import { p as deepClone, q as getOwnProperties, g as getType$1, u as isObject, v as filterOutComments, w as ordinal, e as createDefer, x as assertTypes, t as toArray, y as isNegativeNaN, z as unique, A as objectAttr } from './pathe.M-eThtNZ.Ba-7h1rE.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.BjWcsIL9.js';
|
|
6
6
|
import { createTaskName, createFileTask, calculateSuiteHash, interpretTaskModes, hasFailed } from '../task-utils.js';
|
|
7
7
|
|
|
8
8
|
const RealDate = Date;
|
|
@@ -1849,11 +1849,11 @@ function setCurrentTest(test) {
|
|
|
1849
1849
|
function getCurrentTest() {
|
|
1850
1850
|
return _test;
|
|
1851
1851
|
}
|
|
1852
|
-
const tests =
|
|
1852
|
+
const tests = /* @__PURE__ */ new Set();
|
|
1853
1853
|
function addRunningTest(test) {
|
|
1854
|
-
tests.
|
|
1854
|
+
tests.add(test);
|
|
1855
1855
|
return () => {
|
|
1856
|
-
tests.
|
|
1856
|
+
tests.delete(test);
|
|
1857
1857
|
};
|
|
1858
1858
|
}
|
|
1859
1859
|
function getRunningTests() {
|
|
@@ -1873,6 +1873,10 @@ function createChainable(keys, fn, context) {
|
|
|
1873
1873
|
Object.defineProperty(chain, kChainableContext, {
|
|
1874
1874
|
value: {
|
|
1875
1875
|
withContext: () => chain.bind(context),
|
|
1876
|
+
extendContext: (ctx) => create({
|
|
1877
|
+
...context,
|
|
1878
|
+
...ctx
|
|
1879
|
+
}),
|
|
1876
1880
|
getFixtures: () => context.fixtures,
|
|
1877
1881
|
setContext: (key, value) => {
|
|
1878
1882
|
context[key] = value;
|
|
@@ -2595,6 +2599,10 @@ function createSuiteHooks() {
|
|
|
2595
2599
|
};
|
|
2596
2600
|
}
|
|
2597
2601
|
const POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
|
2602
|
+
function assignDefined(target, source) {
|
|
2603
|
+
for (const key in source) if (source[key] !== void 0) target[key] = source[key];
|
|
2604
|
+
return target;
|
|
2605
|
+
}
|
|
2598
2606
|
function parseArguments(optionsOrFn, timeoutOrTest) {
|
|
2599
2607
|
if (timeoutOrTest != null && typeof timeoutOrTest === "object") throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
|
|
2600
2608
|
let options = {};
|
|
@@ -2626,16 +2634,16 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
2626
2634
|
return tagDefinition;
|
|
2627
2635
|
}).filter((r) => r != null).sort((tag1, tag2) => (tag2.priority ?? POSITIVE_INFINITY) - (tag1.priority ?? POSITIVE_INFINITY)).reduce((acc, tag) => {
|
|
2628
2636
|
const { name, description, priority, meta, ...options } = tag;
|
|
2629
|
-
|
|
2637
|
+
assignDefined(acc, options);
|
|
2630
2638
|
if (meta) acc.meta = Object.assign(acc.meta ?? Object.create(null), meta);
|
|
2631
2639
|
return acc;
|
|
2632
2640
|
}, {});
|
|
2633
2641
|
const testOwnMeta = options.meta;
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
...
|
|
2637
|
-
...
|
|
2638
|
-
};
|
|
2642
|
+
const parentOptions = collectorContext.currentSuite?.options;
|
|
2643
|
+
options = assignDefined({
|
|
2644
|
+
...parentOptions,
|
|
2645
|
+
...tagsOptions
|
|
2646
|
+
}, options);
|
|
2639
2647
|
const timeout = options.timeout ?? runner.config.testTimeout;
|
|
2640
2648
|
// TODO: should this be `parentTask.meta`?
|
|
2641
2649
|
// currently we don't inherit
|
|
@@ -2707,8 +2715,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
|
2707
2715
|
const concurrent = this.concurrent ?? options?.concurrent;
|
|
2708
2716
|
if (concurrent != null) options.concurrent = concurrent;
|
|
2709
2717
|
const test = task(formatName(name), {
|
|
2710
|
-
...this,
|
|
2711
|
-
...options,
|
|
2718
|
+
...assignDefined({ ...this }, options),
|
|
2712
2719
|
handler
|
|
2713
2720
|
});
|
|
2714
2721
|
test.type = "test";
|
|
@@ -2807,10 +2814,7 @@ function createSuite() {
|
|
|
2807
2814
|
let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
|
|
2808
2815
|
const { meta: parentMeta, ...parentOptions } = currentSuite?.options || {};
|
|
2809
2816
|
// inherit options from current suite
|
|
2810
|
-
options = {
|
|
2811
|
-
...parentOptions,
|
|
2812
|
-
...options
|
|
2813
|
-
};
|
|
2817
|
+
options = assignDefined({ ...parentOptions }, options);
|
|
2814
2818
|
const shuffle = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ?? runner?.config.sequence.shuffle;
|
|
2815
2819
|
if (shuffle != null) options.shuffle = shuffle;
|
|
2816
2820
|
let mode = this.only ?? options.only ? "only" : this.skip ?? options.skip ? "skip" : this.todo ?? options.todo ? "todo" : "run";
|
|
@@ -2904,10 +2908,10 @@ function createTaskCollector(fn) {
|
|
|
2904
2908
|
};
|
|
2905
2909
|
};
|
|
2906
2910
|
taskFn.skipIf = function(condition) {
|
|
2907
|
-
return
|
|
2911
|
+
return getChainableContext(this).extendContext({ skip: !!condition });
|
|
2908
2912
|
};
|
|
2909
2913
|
taskFn.runIf = function(condition) {
|
|
2910
|
-
return
|
|
2914
|
+
return getChainableContext(this).extendContext({ skip: !condition });
|
|
2911
2915
|
};
|
|
2912
2916
|
/**
|
|
2913
2917
|
* Parse builder pattern arguments into a fixtures object.
|
|
@@ -3439,6 +3443,7 @@ async function collectTests(specs, runner) {
|
|
|
3439
3443
|
const testLocations = typeof spec === "string" ? void 0 : spec.testLocations;
|
|
3440
3444
|
const testNamePattern = typeof spec === "string" ? void 0 : spec.testNamePattern;
|
|
3441
3445
|
const testIds = typeof spec === "string" ? void 0 : spec.testIds;
|
|
3446
|
+
const testNames = typeof spec === "string" ? void 0 : spec.testNames;
|
|
3442
3447
|
const testTagsFilter = typeof spec === "object" && spec.testTagsFilter ? createTagsFilter(spec.testTagsFilter, config.tags) : void 0;
|
|
3443
3448
|
const fileTags = typeof spec === "string" ? [] : spec.fileTags || [];
|
|
3444
3449
|
const file = createFileTask(filepath, config.root, config.name, runner.pool, runner.viteEnvironment, { __vitest_label__: config.mergeReportsLabel });
|
|
@@ -3491,7 +3496,7 @@ async function collectTests(specs, runner) {
|
|
|
3491
3496
|
file.containsTest = file.tasks.some((t) => t.type === "test" || t.type === "suite" && t.containsTest);
|
|
3492
3497
|
const hasOnlyTasks = file.containsOnly;
|
|
3493
3498
|
if (!testTagsFilter && !defaultTagsFilter && config.tagsFilter) defaultTagsFilter = createTagsFilter(config.tagsFilter, config.tags);
|
|
3494
|
-
interpretTaskModes(file, testNamePattern ?? config.testNamePattern, testLocations, testIds, testTagsFilter ?? defaultTagsFilter, hasOnlyTasks, false, config.allowOnly);
|
|
3499
|
+
interpretTaskModes(file, testNamePattern ?? config.testNamePattern, testLocations, testIds, testNames, testTagsFilter ?? defaultTagsFilter, hasOnlyTasks, false, config.allowOnly);
|
|
3495
3500
|
if (file.mode === "queued") file.mode = "run";
|
|
3496
3501
|
files.push(file);
|
|
3497
3502
|
});
|
|
@@ -3586,12 +3591,11 @@ async function callTestHooks(runner, test, hooks, sequence) {
|
|
|
3586
3591
|
context.onTestFailed = onTestFailed;
|
|
3587
3592
|
context.onTestFinished = onTestFinished;
|
|
3588
3593
|
}
|
|
3589
|
-
async function callSuiteHook(suite, currentTask, name, runner, args) {
|
|
3594
|
+
async function callSuiteHook(suite, currentTask, name, runner, args, cleanups = []) {
|
|
3590
3595
|
const sequence = runner.config.sequence.hooks;
|
|
3591
|
-
const callbacks = [];
|
|
3592
3596
|
// stop at file level
|
|
3593
3597
|
const parentSuite = "filepath" in suite ? null : suite.suite || suite.file;
|
|
3594
|
-
if (name === "beforeEach" && parentSuite)
|
|
3598
|
+
if (name === "beforeEach" && parentSuite) await callSuiteHook(parentSuite, currentTask, name, runner, args, cleanups);
|
|
3595
3599
|
const hooks = getSuiteHooks(suite, name, sequence);
|
|
3596
3600
|
if (hooks.length > 0) updateSuiteHookState(currentTask, name, "run", runner);
|
|
3597
3601
|
async function runHook(hook) {
|
|
@@ -3599,11 +3603,17 @@ async function callSuiteHook(suite, currentTask, name, runner, args) {
|
|
|
3599
3603
|
return getBeforeHookCleanupCallback(hook, await hook(...args), name === "beforeEach" ? args[0] : void 0);
|
|
3600
3604
|
});
|
|
3601
3605
|
}
|
|
3602
|
-
if (sequence === "parallel")
|
|
3603
|
-
|
|
3606
|
+
if (sequence === "parallel") {
|
|
3607
|
+
const results = await Promise.allSettled(hooks.map((hook) => runHook(hook)));
|
|
3608
|
+
// hooks can reject with the same `signal.reason`
|
|
3609
|
+
const errors = /* @__PURE__ */ new Set();
|
|
3610
|
+
for (const result of results) if (result.status === "fulfilled") cleanups.push(result.value);
|
|
3611
|
+
else errors.add(result.reason);
|
|
3612
|
+
if (errors.size === 1) throw [...errors][0];
|
|
3613
|
+
if (errors.size > 1) throw new AggregateError([...errors], `Multiple "${name}" hooks failed.`);
|
|
3614
|
+
} else for (const hook of hooks) cleanups.push(await runHook(hook));
|
|
3604
3615
|
if (hooks.length > 0) updateSuiteHookState(currentTask, name, "pass", runner);
|
|
3605
|
-
if (name === "afterEach" && parentSuite)
|
|
3606
|
-
return callbacks;
|
|
3616
|
+
if (name === "afterEach" && parentSuite) await callSuiteHook(parentSuite, currentTask, name, runner, args);
|
|
3607
3617
|
}
|
|
3608
3618
|
function getAroundEachHooks(suite) {
|
|
3609
3619
|
const hooks = [];
|
|
@@ -3860,7 +3870,8 @@ async function runTest(test, runner) {
|
|
|
3860
3870
|
test.result = {
|
|
3861
3871
|
state: "run",
|
|
3862
3872
|
startTime: unixNow(),
|
|
3863
|
-
retryCount: 0
|
|
3873
|
+
retryCount: 0,
|
|
3874
|
+
attempts: []
|
|
3864
3875
|
};
|
|
3865
3876
|
updateTask("test-prepare", test, runner);
|
|
3866
3877
|
const cleanupRunningTest = addRunningTest(test);
|
|
@@ -3874,8 +3885,21 @@ async function runTest(test, runner) {
|
|
|
3874
3885
|
test.result.state = "run";
|
|
3875
3886
|
const retry = getRetryCount(test.retry);
|
|
3876
3887
|
for (let retryCount = 0; retryCount <= retry; retryCount++) {
|
|
3888
|
+
const attemptStart = now();
|
|
3889
|
+
const attemptStartTime = unixNow();
|
|
3877
3890
|
const attemptErrorsStart = test.result.errors?.length ?? 0;
|
|
3878
|
-
|
|
3891
|
+
const recordAttempt = (state) => {
|
|
3892
|
+
const errors = test.result.errors?.slice(attemptErrorsStart);
|
|
3893
|
+
test.result.attempts.push({
|
|
3894
|
+
state,
|
|
3895
|
+
errors: errors?.length ? errors : void 0,
|
|
3896
|
+
duration: now() - attemptStart,
|
|
3897
|
+
startTime: attemptStartTime,
|
|
3898
|
+
retryIndex: retryCount,
|
|
3899
|
+
repeatIndex: repeatCount
|
|
3900
|
+
});
|
|
3901
|
+
};
|
|
3902
|
+
const beforeEachCleanups = [];
|
|
3879
3903
|
// fixtureCheckpoint is passed by callAroundEachHooks - it represents the count
|
|
3880
3904
|
// of fixture cleanup functions AFTER all aroundEach fixtures have been resolved
|
|
3881
3905
|
// but BEFORE the test runs. This allows us to clean up only fixtures created
|
|
@@ -3887,7 +3911,7 @@ async function runTest(test, runner) {
|
|
|
3887
3911
|
repeats: repeatCount
|
|
3888
3912
|
});
|
|
3889
3913
|
test.result.repeatCount = repeatCount;
|
|
3890
|
-
|
|
3914
|
+
await $("test.beforeEach", () => callSuiteHook(suite, test, "beforeEach", runner, [test.context, suite], beforeEachCleanups));
|
|
3891
3915
|
if (runner.runTask) await $("test.callback", () => limitMaxConcurrency(() => runner.runTask(test)));
|
|
3892
3916
|
else {
|
|
3893
3917
|
const fn = getFn(test);
|
|
@@ -3936,12 +3960,14 @@ async function runTest(test, runner) {
|
|
|
3936
3960
|
}
|
|
3937
3961
|
// skipped with new PendingError
|
|
3938
3962
|
if (test.result?.pending || test.result?.state === "skip") {
|
|
3963
|
+
recordAttempt("skip");
|
|
3939
3964
|
test.mode = "skip";
|
|
3940
3965
|
test.result = {
|
|
3941
3966
|
state: "skip",
|
|
3942
3967
|
note: test.result?.note,
|
|
3943
3968
|
pending: true,
|
|
3944
|
-
duration: now() - start
|
|
3969
|
+
duration: now() - start,
|
|
3970
|
+
attempts: test.result.attempts
|
|
3945
3971
|
};
|
|
3946
3972
|
updateTask("test-finished", test, runner);
|
|
3947
3973
|
setCurrentTest(void 0);
|
|
@@ -3961,6 +3987,7 @@ async function runTest(test, runner) {
|
|
|
3961
3987
|
if (!test.result.errors?.length) test.result.errors = void 0;
|
|
3962
3988
|
}
|
|
3963
3989
|
}
|
|
3990
|
+
recordAttempt(test.result.state === "pass" ? "pass" : "fail");
|
|
3964
3991
|
if (test.result.state === "pass") break;
|
|
3965
3992
|
if (retryCount < retry) {
|
|
3966
3993
|
if (!passesRetryCondition(test, test.result.errors)) break;
|
|
@@ -4042,7 +4069,7 @@ async function runSuite(suite, runner) {
|
|
|
4042
4069
|
};
|
|
4043
4070
|
const $ = runner.trace;
|
|
4044
4071
|
updateTask("suite-prepare", suite, runner);
|
|
4045
|
-
|
|
4072
|
+
const beforeAllCleanups = [];
|
|
4046
4073
|
if (suite.mode === "skip") {
|
|
4047
4074
|
suite.result.state = "skip";
|
|
4048
4075
|
updateTask("suite-finished", suite, runner);
|
|
@@ -4057,7 +4084,7 @@ async function runSuite(suite, runner) {
|
|
|
4057
4084
|
try {
|
|
4058
4085
|
// beforeAll
|
|
4059
4086
|
try {
|
|
4060
|
-
|
|
4087
|
+
await $("suite.beforeAll", () => callSuiteHook(suite, suite, "beforeAll", runner, [suite], beforeAllCleanups));
|
|
4061
4088
|
} catch (e) {
|
|
4062
4089
|
failTask(suite.result, e, runner.config._diffOptions);
|
|
4063
4090
|
markTasksAsSkipped(suite, runner);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as setSafeTimers } from './source-map.
|
|
1
|
+
import { s as setSafeTimers } from './source-map.BjWcsIL9.js';
|
|
2
2
|
import { a as addSerializer } from './plugins.DPQHVT0p.js';
|
|
3
3
|
|
|
4
4
|
let globalSetup = false;
|
|
@@ -7,7 +7,7 @@ async function setupCommonEnv(config) {
|
|
|
7
7
|
if (globalSetup) return;
|
|
8
8
|
globalSetup = true;
|
|
9
9
|
setSafeTimers();
|
|
10
|
-
if (config.globals) (await import('./globals.
|
|
10
|
+
if (config.globals) (await import('./globals.TipXUFcZ.js')).registerApiGlobally();
|
|
11
11
|
}
|
|
12
12
|
function setupDefines(config) {
|
|
13
13
|
for (const key in config.defines) globalThis[key] = config.defines[key];
|
|
@@ -1696,30 +1696,38 @@ function parseStacktrace(stack, options = {}) {
|
|
|
1696
1696
|
// remove vi.defineHelper's internal stacks
|
|
1697
1697
|
const helperIndex = stacks.findLastIndex((s) => s.method.includes("__VITEST_HELPER__"));
|
|
1698
1698
|
if (helperIndex >= 0) stacks = stacks.slice(helperIndex + 1);
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1699
|
+
if (options.firstOnly) {
|
|
1700
|
+
for (const stack of stacks) {
|
|
1701
|
+
const mapped = mapStackFrame(stack, options, ignoreStackEntries);
|
|
1702
|
+
if (mapped) return [mapped];
|
|
1703
|
+
}
|
|
1704
|
+
return [];
|
|
1705
|
+
}
|
|
1706
|
+
return stacks.map((stack) => mapStackFrame(stack, options, ignoreStackEntries)).filter((s) => s != null);
|
|
1707
|
+
}
|
|
1708
|
+
function mapStackFrame(stack, options, ignoreStackEntries) {
|
|
1709
|
+
if (options.getUrlId) stack.file = options.getUrlId(stack.file);
|
|
1710
|
+
const map = options.getSourceMap?.(stack.file);
|
|
1711
|
+
if (!map || typeof map !== "object" || !map.version) return shouldFilter(ignoreStackEntries, stack.file) ? null : stack;
|
|
1712
|
+
const traceMap = new DecodedMap(map, stack.file);
|
|
1713
|
+
if (stack.line <= 0 || stack.column <= 0) return stack;
|
|
1714
|
+
const position = getOriginalPosition(traceMap, {
|
|
1715
|
+
line: stack.line,
|
|
1716
|
+
// stacktrace's column is 1-indexed, but sourcemap's one is 0-indexed
|
|
1717
|
+
column: stack.column - 1
|
|
1718
|
+
});
|
|
1719
|
+
if (!position) return stack;
|
|
1720
|
+
const { line, column, source, name } = position;
|
|
1721
|
+
let file = source || stack.file;
|
|
1722
|
+
if (/\/\w:\//.test(file)) file = file.slice(1);
|
|
1723
|
+
if (shouldFilter(ignoreStackEntries, file)) return null;
|
|
1724
|
+
if (line != null && column != null) return {
|
|
1725
|
+
line,
|
|
1726
|
+
column: column + 1,
|
|
1727
|
+
file,
|
|
1728
|
+
method: name || stack.method
|
|
1729
|
+
};
|
|
1730
|
+
return stack;
|
|
1723
1731
|
}
|
|
1724
1732
|
function shouldFilter(ignoreStackEntries, file) {
|
|
1725
1733
|
return ignoreStackEntries.some((p) => file.match(p));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TestError, P as ParsedStack } from './config.d.
|
|
1
|
+
import { T as TestError, P as ParsedStack } from './config.d.BgktgHfG.js';
|
|
2
2
|
|
|
3
3
|
interface RuntimeCoverageModuleLoader {
|
|
4
4
|
import: (id: string) => Promise<{
|
|
@@ -53,6 +53,7 @@ interface StackTraceParserOptions {
|
|
|
53
53
|
getSourceMap?: (file: string) => unknown;
|
|
54
54
|
getUrlId?: (id: string) => string;
|
|
55
55
|
frameFilter?: (error: TestError, frame: ParsedStack) => boolean | void;
|
|
56
|
+
firstOnly?: boolean;
|
|
56
57
|
}
|
|
57
58
|
interface SourceMapLike {
|
|
58
59
|
version: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="chai" />
|
|
2
|
+
import { bp as SnapshotState, n as Test, bq as PromisifyAssertion, br as Tester, bs as Plugin, ae as BenchResult, a as File } from './config.d.BgktgHfG.js';
|
|
2
3
|
|
|
3
4
|
interface SnapshotMatcher<
|
|
4
5
|
R extends void | Promise<void>,
|