@rstest/core 0.8.4 → 0.9.0

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/worker.d.ts CHANGED
@@ -2,248 +2,6 @@ import type { config } from 'chai';
2
2
  import type { RsbuildConfig } from '@rsbuild/core';
3
3
  import type { Writable } from 'node:stream';
4
4
 
5
- /**
6
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */
11
-
12
- declare function addSerializer(plugin: Plugin_2): void;
13
-
14
- declare type AfterAllListener = (ctx: SuiteContext) => MaybePromise<void>;
15
-
16
- declare type AfterEachListener = (ctx: TestContext) => MaybePromise<void>;
17
-
18
- declare interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T>, Matchers<T> {
19
- /**
20
- * Ensures a value is of a specific type.
21
- *
22
- * @example
23
- * expect(value).toBeTypeOf('string');
24
- * expect(number).toBeTypeOf('number');
25
- */
26
- toBeTypeOf: (expected: "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined") => void;
27
- /**
28
- * Asserts that a mock function was called exactly once.
29
- *
30
- * @example
31
- * expect(mockFunc).toHaveBeenCalledOnce();
32
- */
33
- toHaveBeenCalledOnce: () => void;
34
- /**
35
- * Ensure that a mock function is called with specific arguments and called
36
- * exactly once.
37
- *
38
- * @example
39
- * expect(mockFunc).toHaveBeenCalledExactlyOnceWith('arg1', 42);
40
- */
41
- toHaveBeenCalledExactlyOnceWith: <E extends any[]>(...args: E) => void;
42
- /**
43
- * This assertion checks if a `Mock` was called before another `Mock`.
44
- * @param mock - A mock function created by `vi.spyOn` or `vi.fn`
45
- * @param failIfNoFirstInvocation - Fail if the first mock was never called
46
- * @example
47
- * const mock1 = vi.fn()
48
- * const mock2 = vi.fn()
49
- *
50
- * mock1()
51
- * mock2()
52
- * mock1()
53
- *
54
- * expect(mock1).toHaveBeenCalledBefore(mock2)
55
- */
56
- toHaveBeenCalledBefore: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void;
57
- /**
58
- * This assertion checks if a `Mock` was called after another `Mock`.
59
- * @param mock - A mock function created by `vi.spyOn` or `vi.fn`
60
- * @param failIfNoFirstInvocation - Fail if the first mock was never called
61
- * @example
62
- * const mock1 = vi.fn()
63
- * const mock2 = vi.fn()
64
- *
65
- * mock2()
66
- * mock1()
67
- * mock2()
68
- *
69
- * expect(mock1).toHaveBeenCalledAfter(mock2)
70
- */
71
- toHaveBeenCalledAfter: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void;
72
- /**
73
- * Checks that a promise resolves successfully at least once.
74
- *
75
- * @example
76
- * await expect(promise).toHaveResolved();
77
- */
78
- toHaveResolved: () => void;
79
- /**
80
- * Checks that a promise resolves to a specific value.
81
- *
82
- * @example
83
- * await expect(promise).toHaveResolvedWith('success');
84
- */
85
- toHaveResolvedWith: <E>(value: E) => void;
86
- /**
87
- * Ensures a promise resolves a specific number of times.
88
- *
89
- * @example
90
- * expect(mockAsyncFunc).toHaveResolvedTimes(3);
91
- */
92
- toHaveResolvedTimes: (times: number) => void;
93
- /**
94
- * Asserts that the last resolved value of a promise matches an expected value.
95
- *
96
- * @example
97
- * await expect(mockAsyncFunc).toHaveLastResolvedWith('finalResult');
98
- */
99
- toHaveLastResolvedWith: <E>(value: E) => void;
100
- /**
101
- * Ensures a specific value was returned by a promise on the nth resolution.
102
- *
103
- * @example
104
- * await expect(mockAsyncFunc).toHaveNthResolvedWith(2, 'secondResult');
105
- */
106
- toHaveNthResolvedWith: <E>(nthCall: number, value: E) => void;
107
- /**
108
- * Verifies that a promise resolves.
109
- *
110
- * @example
111
- * await expect(someAsyncFunc).resolves.toBe(42);
112
- */
113
- resolves: PromisifyAssertion<T>;
114
- /**
115
- * Verifies that a promise rejects.
116
- *
117
- * @example
118
- * await expect(someAsyncFunc).rejects.toThrow('error');
119
- */
120
- rejects: PromisifyAssertion<T>;
121
- }
122
-
123
- declare interface Assertion_2<T = any> extends Assertion<T> {
124
- matchSnapshot: SnapshotMatcher<T>;
125
- toMatchSnapshot: SnapshotMatcher<T>;
126
- toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
127
- /**
128
- * Checks that an error thrown by a function matches a previously recorded snapshot.
129
- *
130
- * @param message - Optional custom error message.
131
- *
132
- * @example
133
- * expect(functionWithError).toThrowErrorMatchingSnapshot();
134
- */
135
- toThrowErrorMatchingSnapshot: (message?: string) => void;
136
- /**
137
- * Checks that an error thrown by a function matches an inline snapshot within the test file.
138
- * Useful for keeping snapshots close to the test code.
139
- *
140
- * @param snapshot - Optional inline snapshot string to match.
141
- * @param message - Optional custom error message.
142
- *
143
- * @example
144
- * const throwError = () => { throw new Error('Error occurred') };
145
- * expect(throwError).toThrowErrorMatchingInlineSnapshot(`"Error occurred"`);
146
- */
147
- toThrowErrorMatchingInlineSnapshot: (snapshot?: string, message?: string) => void;
148
- /**
149
- * Compares the received value to a snapshot saved in a specified file.
150
- * Useful for cases where snapshot content is large or needs to be shared across tests.
151
- *
152
- * @param filepath - Path to the snapshot file.
153
- * @param message - Optional custom error message.
154
- *
155
- * @example
156
- * await expect(largeData).toMatchFileSnapshot('path/to/snapshot.json');
157
- */
158
- toMatchFileSnapshot: (filepath: string, message?: string) => Promise<void>;
159
- /**
160
- * Verifies that a promise resolves.
161
- *
162
- * @example
163
- * await expect(someAsyncFunc).resolves.toBe(42);
164
- */
165
- resolves: PromisifyAssertion_2<T>;
166
- /**
167
- * Verifies that a promise rejects.
168
- *
169
- * @example
170
- * await expect(someAsyncFunc).rejects.toThrow('error');
171
- */
172
- rejects: PromisifyAssertion_2<T>;
173
- }
174
-
175
- declare abstract class AsymmetricMatcher<
176
- T,
177
- State extends MatcherState = MatcherState
178
- > implements AsymmetricMatcherInterface {
179
- protected sample: T;
180
- protected inverse: boolean;
181
- // should have "jest" to be compatible with its ecosystem
182
- $$typeof: symbol;
183
- constructor(sample: T, inverse?: boolean);
184
- protected getMatcherContext(expect?: Chai.ExpectStatic): State;
185
- abstract asymmetricMatch(other: unknown): boolean;
186
- abstract toString(): string;
187
- getExpectedType?(): string;
188
- toAsymmetricMatcher?(): string;
189
- }
190
-
191
- declare interface AsymmetricMatcherInterface {
192
- asymmetricMatch: (other: unknown) => boolean;
193
- toString: () => string;
194
- getExpectedType?: () => string;
195
- toAsymmetricMatcher?: () => string;
196
- }
197
-
198
- declare interface AsymmetricMatchersContaining extends CustomMatcher {
199
- /**
200
- * Matches if the received string contains the expected substring.
201
- *
202
- * @example
203
- * expect('I have an apple').toEqual(expect.stringContaining('apple'));
204
- * expect({ a: 'test string' }).toEqual({ a: expect.stringContaining('test') });
205
- */
206
- stringContaining: (expected: string) => any;
207
- /**
208
- * Matches if the received object contains all properties of the expected object.
209
- *
210
- * @example
211
- * expect({ a: '1', b: 2 }).toEqual(expect.objectContaining({ a: '1' }))
212
- */
213
- objectContaining: <T = any>(expected: DeeplyAllowMatchers<T>) => any;
214
- /**
215
- * Matches if the received array contains all elements in the expected array.
216
- *
217
- * @example
218
- * expect(['a', 'b', 'c']).toEqual(expect.arrayContaining(['b', 'a']));
219
- */
220
- arrayContaining: <T = unknown>(expected: Array<DeeplyAllowMatchers<T>>) => any;
221
- /**
222
- * Matches if the received string or regex matches the expected pattern.
223
- *
224
- * @example
225
- * expect('hello world').toEqual(expect.stringMatching(/^hello/));
226
- * expect('hello world').toEqual(expect.stringMatching('hello'));
227
- */
228
- stringMatching: (expected: string | RegExp) => any;
229
- /**
230
- * Matches if the received number is within a certain precision of the expected number.
231
- *
232
- * @param precision - Optional decimal precision for comparison. Default is 2.
233
- *
234
- * @example
235
- * expect(10.45).toEqual(expect.closeTo(10.5, 1));
236
- * expect(5.11).toEqual(expect.closeTo(5.12)); // with default precision
237
- */
238
- closeTo: (expected: number, precision?: number) => any;
239
- }
240
-
241
- declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
242
-
243
- declare type BeforeAllListener = (ctx: SuiteContext) => MaybePromise<void | AfterAllListener>;
244
-
245
- declare type BeforeEachListener = (ctx: TestContext) => MaybePromise<void | AfterEachListener>;
246
-
247
5
  declare interface BranchMapping {
248
6
  loc: Range_2;
249
7
  type: string;
@@ -374,10 +132,6 @@ declare interface Config {
374
132
  spacingOuter: string;
375
133
  }
376
134
 
377
- declare interface Constructable {
378
- new (...args: any[]): any;
379
- }
380
-
381
135
  /**
382
136
  * Base class for writing content
383
137
  */
@@ -431,29 +185,6 @@ declare interface Context {
431
185
  getXmlWriter(contentWriter: ContentWriter): XmlWriter;
432
186
  }
433
187
 
434
- declare class CounterMap<K> extends DefaultMap<K, number> {
435
- constructor();
436
- // compat for jest-image-snapshot https://github.com/vitest-dev/vitest/issues/7322
437
- // `valueOf` and `Snapshot.added` setter allows
438
- // snapshotState.added = snapshotState.added + 1
439
- // to function as
440
- // snapshotState.added.total_ = snapshotState.added.total() + 1
441
- _total: number | undefined;
442
- valueOf(): number;
443
- increment(key: K): void;
444
- total(): number;
445
- }
446
-
447
- declare interface Coverage {
448
- covered: number;
449
- total: number;
450
- coverage: number;
451
- }
452
-
453
- declare interface CoverageMapData {
454
- [key: string]: FileCoverage | FileCoverageData;
455
- }
456
-
457
188
  declare type CoverageOptions = {
458
189
  /**
459
190
  * Enable coverage collection.
@@ -524,25 +255,6 @@ declare type CoverageOptions = {
524
255
  reportOnFailure?: boolean;
525
256
  };
526
257
 
527
- declare class CoverageSummary {
528
- constructor(data: CoverageSummary | CoverageSummaryData);
529
- merge(obj: CoverageSummary): CoverageSummary;
530
- toJSON(): CoverageSummaryData;
531
- isEmpty(): boolean;
532
- data: CoverageSummaryData;
533
- lines: Totals;
534
- statements: Totals;
535
- branches: Totals;
536
- functions: Totals;
537
- }
538
-
539
- declare interface CoverageSummaryData {
540
- lines: Totals;
541
- statements: Totals;
542
- branches: Totals;
543
- functions: Totals;
544
- }
545
-
546
258
  declare type CoverageThreshold = {
547
259
  /** Threshold for statements */
548
260
  statements?: number;
@@ -556,29 +268,6 @@ declare type CoverageThreshold = {
556
268
 
557
269
  declare type CoverageThresholds = CoverageThreshold | (CoverageThreshold & ThresholdGlobRecord);
558
270
 
559
- declare interface CustomMatcher {
560
- /**
561
- * Checks that a value satisfies a custom matcher function.
562
- *
563
- * @param matcher - A function returning a boolean based on the custom condition
564
- * @param message - Optional custom error message on failure
565
- *
566
- * @example
567
- * expect(age).toSatisfy(val => val >= 18, 'Age must be at least 18');
568
- * expect(age).toEqual(expect.toSatisfy(val => val >= 18, 'Age must be at least 18'));
569
- */
570
- toSatisfy: (matcher: (value: any) => boolean, message?: string) => any;
571
- /**
572
- * Matches if the received value is one of the values in the expected array.
573
- *
574
- * @example
575
- * expect(1).toBeOneOf([1, 2, 3])
576
- * expect('foo').toBeOneOf([expect.any(String)])
577
- * expect({ a: 1 }).toEqual({ a: expect.toBeOneOf(['1', '2', '3']) })
578
- */
579
- toBeOneOf: <T>(sample: Array<T>) => any;
580
- }
581
-
582
271
  /** Custom reporter configuration for non-istanbul reporters */
583
272
  declare type CustomReporter = string | [string, Record<string, unknown>];
584
273
 
@@ -588,24 +277,6 @@ declare interface DecodedSourceMap extends SourceMapV3 {
588
277
 
589
278
  declare type DecodedSourceMapXInput = DecodedSourceMap & XInput;
590
279
 
591
- declare type DeeplyAllowMatchers<T> = T extends Array<infer Element> ? WithAsymmetricMatcher<T> | DeeplyAllowMatchers<Element>[] : T extends object ? WithAsymmetricMatcher<T> | { [K in keyof T] : DeeplyAllowMatchers<T[K]> } : WithAsymmetricMatcher<T>;
592
-
593
- /**
594
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
595
- *
596
- * This source code is licensed under the MIT license found in the
597
- * LICENSE file in the root directory of this source tree.
598
- */
599
-
600
- declare class DefaultMap<
601
- K,
602
- V
603
- > extends Map<K, V> {
604
- private defaultFn;
605
- constructor(defaultFn: (key: K) => V, entries?: Iterable<readonly [K, V]>);
606
- get(key: K): V;
607
- }
608
-
609
280
  declare type DefaultReporterOptions = {
610
281
  /**
611
282
  * prints out summary of all tests
@@ -624,28 +295,6 @@ declare type DefaultReporterOptions = {
624
295
  showProjectName?: boolean;
625
296
  };
626
297
 
627
- declare type DescribeAPI = DescribeFn & {
628
- each: DescribeEachFn;
629
- for: DescribeForFn;
630
- only: DescribeAPI;
631
- skip: DescribeAPI;
632
- runIf: (condition: boolean) => DescribeAPI;
633
- skipIf: (condition: boolean) => DescribeAPI;
634
- todo: DescribeAPI;
635
- concurrent: DescribeAPI;
636
- sequential: DescribeAPI;
637
- };
638
-
639
- declare interface DescribeEachFn {
640
- <T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>) => void;
641
- <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>) => void;
642
- <T>(cases: readonly T[]): (description: string, fn: (param: T) => MaybePromise<void>) => void;
643
- }
644
-
645
- declare type DescribeFn = (description: string, fn?: () => void) => void;
646
-
647
- declare type DescribeForFn = <T>(cases: readonly T[]) => (description: string, fn?: (param: T) => MaybePromise<void>) => void;
648
-
649
298
  /**
650
299
  * Device presets aligned with Chrome DevTools device toolbar.
651
300
  *
@@ -660,49 +309,6 @@ declare type DescribeForFn = <T>(cases: readonly T[]) => (description: string, f
660
309
  */
661
310
  declare type DevicePreset = 'iPhoneSE' | 'iPhoneXR' | 'iPhone12Pro' | 'iPhone14ProMax' | 'Pixel7' | 'SamsungGalaxyS8Plus' | 'SamsungGalaxyS20Ultra' | 'iPadMini' | 'iPadAir' | 'iPadPro' | 'SurfacePro7' | 'SurfaceDuo' | 'GalaxyZFold5' | 'AsusZenbookFold' | 'SamsungGalaxyA51A71' | 'NestHub' | 'NestHubMax';
662
311
 
663
- /**
664
- * @param a Expected value
665
- * @param b Received value
666
- * @param options Diff options
667
- * @returns {string | null} a string diff
668
- */
669
- declare function diff(a: any, b: any, options?: DiffOptions): string | undefined;
670
-
671
- declare interface DiffOptions {
672
- aAnnotation?: string;
673
- aColor?: DiffOptionsColor;
674
- aIndicator?: string;
675
- bAnnotation?: string;
676
- bColor?: DiffOptionsColor;
677
- bIndicator?: string;
678
- changeColor?: DiffOptionsColor;
679
- changeLineTrailingSpaceColor?: DiffOptionsColor;
680
- commonColor?: DiffOptionsColor;
681
- commonIndicator?: string;
682
- commonLineTrailingSpaceColor?: DiffOptionsColor;
683
- contextLines?: number;
684
- emptyFirstOrLastLinePlaceholder?: string;
685
- expand?: boolean;
686
- includeChangeCounts?: boolean;
687
- omitAnnotationLines?: boolean;
688
- patchColor?: DiffOptionsColor;
689
- printBasicPrototype?: boolean;
690
- maxDepth?: number;
691
- compareKeys?: CompareKeys;
692
- truncateThreshold?: number;
693
- truncateAnnotation?: string;
694
- truncateAnnotationColor?: DiffOptionsColor;
695
- }
696
-
697
- /**
698
- * Copyright (c) Meta Platforms, Inc. and affiliates.
699
- *
700
- * This source code is licensed under the MIT license found in the
701
- * LICENSE file in the root directory of this source tree.
702
- */
703
-
704
- declare type DiffOptionsColor = (arg: string) => string;
705
-
706
312
  /** The test file output path */
707
313
  declare type DistPath = string;
708
314
 
@@ -732,69 +338,10 @@ declare type EnvironmentWithOptions = {
732
338
  options?: Record<string, any>;
733
339
  };
734
340
 
735
- declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
736
-
737
- declare interface ExpectPollOptions {
738
- /**
739
- * @default 50
740
- */
741
- interval?: number;
742
- /**
743
- * @default 1000
744
- */
745
- timeout?: number;
746
- message?: string;
747
- }
748
-
749
- declare interface ExpectStatic extends ExpectStatic_2 {
750
- <T>(actual: T, message?: string): Assertion_2<T>;
751
- unreachable: (message?: string) => never;
752
- soft: <T>(actual: T, message?: string) => Assertion_2<T>;
753
- poll: <T>(actual: () => T, options?: ExpectPollOptions) => Omit<PromisifyAssertion_2<Awaited<T>>, 'rejects' | 'resolves' | 'toThrow' | 'toThrowError' | 'throw' | 'throws' | 'matchSnapshot' | 'toMatchSnapshot' | 'toMatchInlineSnapshot' | 'toThrowErrorMatchingSnapshot' | 'toThrowErrorMatchingInlineSnapshot'>;
754
- addEqualityTesters: (testers: Tester[]) => void;
755
- assertions: (expected: number) => void;
756
- hasAssertions: () => void;
757
- addSnapshotSerializer: typeof addSerializer;
758
- getState: () => MatcherState_2;
759
- setState: (state: Partial<MatcherState_2>) => void;
760
- }
761
-
762
- declare interface ExpectStatic_2 extends Chai.ExpectStatic, Matchers, AsymmetricMatchersContaining {
763
- <T>(actual: T, message?: string): Assertion<T>;
764
- extend: (expects: MatchersObject) => void;
765
- anything: () => any;
766
- any: (constructor: unknown) => any;
767
- getState: () => MatcherState;
768
- setState: (state: Partial<MatcherState>) => void;
769
- not: AsymmetricMatchersContaining;
770
- }
771
-
772
341
  declare type ExtendConfig = Omit<LooseRstestConfig, 'projects'>;
773
342
 
774
343
  declare type ExtendConfigFn = (userConfig: Readonly<LooseRstestConfig>) => MaybePromise<ExtendConfig>;
775
344
 
776
- declare class FileCoverage implements FileCoverageData {
777
- constructor(data: string | FileCoverage | FileCoverageData);
778
- merge(other: FileCoverageData): void;
779
- getBranchCoverageByLine(): { [line: number]: Coverage };
780
- getLineCoverage(): { [line: number]: number };
781
- getUncoveredLines(): number[];
782
- resetHits(): void;
783
- computeBranchTotals(): Totals;
784
- computeSimpleTotals(): Totals;
785
- toSummary(): CoverageSummary;
786
- toJSON(): object;
787
-
788
- data: FileCoverageData;
789
- path: string;
790
- statementMap: { [key: string]: Range_2 };
791
- fnMap: { [key: string]: FunctionMapping };
792
- branchMap: { [key: string]: BranchMapping };
793
- s: { [key: string]: number };
794
- f: { [key: string]: number };
795
- b: { [key: string]: number[] };
796
- }
797
-
798
345
  declare interface FileCoverageData {
799
346
  path: string;
800
347
  statementMap: { [key: string]: Range_2 };
@@ -832,21 +379,6 @@ declare class FileWriter {
832
379
  writeFile(file: string | null): ContentWriter;
833
380
  }
834
381
 
835
- declare type Fixture<T, K extends keyof T, ExtraContext = object> = ((...args: any) => any) extends T[K] ? T[K] extends any ? FixtureFn<T, K, Omit<ExtraContext, Exclude<keyof T, K>>> : never : T[K] | (T[K] extends any ? FixtureFn<T, K, Omit<ExtraContext, Exclude<keyof T, K>>> : never);
836
-
837
- declare type FixtureFn<T, K extends keyof T, ExtraContext> = (context: Omit<T, K> & ExtraContext, use: Use<T[K]>) => Promise<void>;
838
-
839
- declare interface FixtureOptions {
840
- /**
841
- * Whether to automatically set up current fixture, even though it's not being used in tests.
842
- */
843
- auto?: boolean;
844
- }
845
-
846
- declare type Fixtures<T extends Record<string, any> = object, ExtraContext = object> = {
847
- [K in keyof T]: Fixture<T, K, ExtraContext & TestContext> | [Fixture<T, K, ExtraContext & TestContext>, FixtureOptions?];
848
- };
849
-
850
382
  declare type FormattedError = {
851
383
  fullStack?: boolean;
852
384
  message: string;
@@ -857,12 +389,6 @@ declare type FormattedError = {
857
389
  actual?: string;
858
390
  };
859
391
 
860
- declare interface Formatter {
861
- (input?: unknown): string;
862
- open: string;
863
- close: string;
864
- }
865
-
866
392
  declare interface FunctionMapping {
867
393
  name: string;
868
394
  decl: Range_2;
@@ -872,20 +398,6 @@ declare interface FunctionMapping {
872
398
 
873
399
  declare type GeneratedColumn = number;
874
400
 
875
- declare function getMatcherUtils(): {
876
- EXPECTED_COLOR: Formatter
877
- RECEIVED_COLOR: Formatter
878
- INVERTED_COLOR: Formatter
879
- BOLD_WEIGHT: Formatter
880
- DIM_COLOR: Formatter
881
- diff: typeof diff
882
- matcherHint: typeof matcherHint
883
- printReceived: typeof printReceived
884
- printExpected: typeof printExpected
885
- printDiffOrStringify: typeof printDiffOrStringify
886
- printWithType: typeof printWithType
887
- };
888
-
889
401
  declare type GetSourcemap = (sourcePath: string) => Promise<SourceMapInput | null>;
890
402
 
891
403
  declare interface HtmlOptions {
@@ -913,402 +425,6 @@ declare type InlineProjectConfig = ProjectConfig & {
913
425
  name: string;
914
426
  };
915
427
 
916
- declare interface InlineSnapshotMatcher<T> {
917
- <U extends {
918
- [P in keyof T]: any;
919
- }>(properties: Partial<U>, snapshot?: string, message?: string): void;
920
- (message?: string): void;
921
- }
922
-
923
- declare interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMatcher {
924
- /**
925
- * Used when you want to check that two objects have the same value.
926
- * This matcher recursively checks the equality of all fields, rather than checking for object identity.
927
- *
928
- * @example
929
- * expect(user).toEqual({ name: 'Alice', age: 30 });
930
- */
931
- toEqual: <E>(expected: E) => void;
932
- /**
933
- * Use to test that objects have the same types as well as structure.
934
- *
935
- * @example
936
- * expect(user).toStrictEqual({ name: 'Alice', age: 30 });
937
- */
938
- toStrictEqual: <E>(expected: E) => void;
939
- /**
940
- * Checks that a value is what you expect. It calls `Object.is` to compare values.
941
- * Don't use `toBe` with floating-point numbers.
942
- *
943
- * @example
944
- * expect(result).toBe(42);
945
- * expect(status).toBe(true);
946
- */
947
- toBe: <E>(expected: E) => void;
948
- /**
949
- * Check that a string matches a regular expression.
950
- *
951
- * @example
952
- * expect(message).toMatch(/hello/);
953
- * expect(greeting).toMatch('world');
954
- */
955
- toMatch: (expected: string | RegExp) => void;
956
- /**
957
- * Used to check that a JavaScript object matches a subset of the properties of an object
958
- *
959
- * @example
960
- * expect(user).toMatchObject({
961
- * name: 'Alice',
962
- * address: { city: 'Wonderland' }
963
- * });
964
- */
965
- toMatchObject: <E extends object | any[]>(expected: E) => void;
966
- /**
967
- * Used when you want to check that an item is in a list.
968
- * For testing the items in the list, this uses `===`, a strict equality check.
969
- *
970
- * @example
971
- * expect(items).toContain('apple');
972
- * expect(numbers).toContain(5);
973
- */
974
- toContain: <E>(item: E) => void;
975
- /**
976
- * Used when you want to check that an item is in a list.
977
- * For testing the items in the list, this matcher recursively checks the
978
- * equality of all fields, rather than checking for object identity.
979
- *
980
- * @example
981
- * expect(items).toContainEqual({ name: 'apple', quantity: 1 });
982
- */
983
- toContainEqual: <E>(item: E) => void;
984
- /**
985
- * Use when you don't care what a value is, you just want to ensure a value
986
- * is true in a boolean context. In JavaScript, there are six falsy values:
987
- * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
988
- *
989
- * @example
990
- * expect(user.isActive).toBeTruthy();
991
- */
992
- toBeTruthy: () => void;
993
- /**
994
- * When you don't care what a value is, you just want to
995
- * ensure a value is false in a boolean context.
996
- *
997
- * @example
998
- * expect(user.isActive).toBeFalsy();
999
- */
1000
- toBeFalsy: () => void;
1001
- /**
1002
- * For comparing floating point numbers.
1003
- *
1004
- * @example
1005
- * expect(score).toBeGreaterThan(10);
1006
- */
1007
- toBeGreaterThan: (num: number | bigint) => void;
1008
- /**
1009
- * For comparing floating point numbers.
1010
- *
1011
- * @example
1012
- * expect(score).toBeGreaterThanOrEqual(10);
1013
- */
1014
- toBeGreaterThanOrEqual: (num: number | bigint) => void;
1015
- /**
1016
- * For comparing floating point numbers.
1017
- *
1018
- * @example
1019
- * expect(score).toBeLessThan(10);
1020
- */
1021
- toBeLessThan: (num: number | bigint) => void;
1022
- /**
1023
- * For comparing floating point numbers.
1024
- *
1025
- * @example
1026
- * expect(score).toBeLessThanOrEqual(10);
1027
- */
1028
- toBeLessThanOrEqual: (num: number | bigint) => void;
1029
- /**
1030
- * Used to check that a variable is NaN.
1031
- *
1032
- * @example
1033
- * expect(value).toBeNaN();
1034
- */
1035
- toBeNaN: () => void;
1036
- /**
1037
- * Used to check that a variable is undefined.
1038
- *
1039
- * @example
1040
- * expect(value).toBeUndefined();
1041
- */
1042
- toBeUndefined: () => void;
1043
- /**
1044
- * This is the same as `.toBe(null)` but the error messages are a bit nicer.
1045
- * So use `.toBeNull()` when you want to check that something is null.
1046
- *
1047
- * @example
1048
- * expect(value).toBeNull();
1049
- */
1050
- toBeNull: () => void;
1051
- /**
1052
- * Ensure that a variable is not undefined.
1053
- *
1054
- * @example
1055
- * expect(value).toBeDefined();
1056
- */
1057
- toBeDefined: () => void;
1058
- /**
1059
- * Ensure that an object is an instance of a class.
1060
- * This matcher uses `instanceof` underneath.
1061
- *
1062
- * @example
1063
- * expect(new Date()).toBeInstanceOf(Date);
1064
- */
1065
- toBeInstanceOf: <E>(expected: E) => void;
1066
- /**
1067
- * Used to check that an object has a `.length` property
1068
- * and it is set to a certain numeric value.
1069
- *
1070
- * @example
1071
- * expect([1, 2, 3]).toHaveLength(3);
1072
- * expect('hello').toHaveLength(5);
1073
- */
1074
- toHaveLength: (length: number) => void;
1075
- /**
1076
- * Use to check if a property at the specified path exists on an object.
1077
- * For checking deeply nested properties, you may use dot notation or an array containing
1078
- * the path segments for deep references.
1079
- *
1080
- * Optionally, you can provide a value to check if it matches the value present at the path
1081
- * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
1082
- * the equality of all fields.
1083
- *
1084
- * @example
1085
- * expect(user).toHaveProperty('address.city', 'New York');
1086
- * expect(config).toHaveProperty(['settings', 'theme'], 'dark');
1087
- */
1088
- toHaveProperty: <E>(property: string | (string | number)[], value?: E) => void;
1089
- /**
1090
- * Using exact equality with floating point numbers is a bad idea.
1091
- * Rounding means that intuitive things fail.
1092
- * The default for `precision` is 2.
1093
- *
1094
- * @example
1095
- * expect(price).toBeCloseTo(9.99, 2);
1096
- */
1097
- toBeCloseTo: (number: number, numDigits?: number) => void;
1098
- /**
1099
- * Ensures that a mock function is called an exact number of times.
1100
- *
1101
- * Also under the alias `expect.toBeCalledTimes`.
1102
- *
1103
- * @example
1104
- * expect(mockFunc).toHaveBeenCalledTimes(2);
1105
- */
1106
- toHaveBeenCalledTimes: (times: number) => void;
1107
- /**
1108
- * Ensures that a mock function is called an exact number of times.
1109
- *
1110
- * Alias for `expect.toHaveBeenCalledTimes`.
1111
- *
1112
- * @example
1113
- * expect(mockFunc).toBeCalledTimes(2);
1114
- */
1115
- toBeCalledTimes: (times: number) => void;
1116
- /**
1117
- * Ensures that a mock function is called.
1118
- *
1119
- * Also under the alias `expect.toBeCalled`.
1120
- *
1121
- * @example
1122
- * expect(mockFunc).toHaveBeenCalled();
1123
- */
1124
- toHaveBeenCalled: () => void;
1125
- /**
1126
- * Ensures that a mock function is called.
1127
- *
1128
- * Alias for `expect.toHaveBeenCalled`.
1129
- *
1130
- * @example
1131
- * expect(mockFunc).toBeCalled();
1132
- */
1133
- toBeCalled: () => void;
1134
- /**
1135
- * Ensure that a mock function is called with specific arguments.
1136
- *
1137
- * Also under the alias `expect.toBeCalledWith`.
1138
- *
1139
- * @example
1140
- * expect(mockFunc).toHaveBeenCalledWith('arg1', 42);
1141
- */
1142
- toHaveBeenCalledWith: <E extends any[]>(...args: E) => void;
1143
- /**
1144
- * Ensure that a mock function is called with specific arguments.
1145
- *
1146
- * Alias for `expect.toHaveBeenCalledWith`.
1147
- *
1148
- * @example
1149
- * expect(mockFunc).toBeCalledWith('arg1', 42);
1150
- */
1151
- toBeCalledWith: <E extends any[]>(...args: E) => void;
1152
- /**
1153
- * Ensure that a mock function is called with specific arguments on an Nth call.
1154
- *
1155
- * Also under the alias `expect.nthCalledWith`.
1156
- *
1157
- * @example
1158
- * expect(mockFunc).toHaveBeenNthCalledWith(2, 'secondArg');
1159
- */
1160
- toHaveBeenNthCalledWith: <E extends any[]>(n: number, ...args: E) => void;
1161
- /**
1162
- * Ensure that a mock function is called with specific arguments on an Nth call.
1163
- *
1164
- * Alias for `expect.toHaveBeenNthCalledWith`.
1165
- *
1166
- * @example
1167
- * expect(mockFunc).nthCalledWith(2, 'secondArg');
1168
- */
1169
- nthCalledWith: <E extends any[]>(nthCall: number, ...args: E) => void;
1170
- /**
1171
- * If you have a mock function, you can use `.toHaveBeenLastCalledWith`
1172
- * to test what arguments it was last called with.
1173
- *
1174
- * Also under the alias `expect.lastCalledWith`.
1175
- *
1176
- * @example
1177
- * expect(mockFunc).toHaveBeenLastCalledWith('lastArg');
1178
- */
1179
- toHaveBeenLastCalledWith: <E extends any[]>(...args: E) => void;
1180
- /**
1181
- * If you have a mock function, you can use `.lastCalledWith`
1182
- * to test what arguments it was last called with.
1183
- *
1184
- * Alias for `expect.toHaveBeenLastCalledWith`.
1185
- *
1186
- * @example
1187
- * expect(mockFunc).lastCalledWith('lastArg');
1188
- */
1189
- lastCalledWith: <E extends any[]>(...args: E) => void;
1190
- /**
1191
- * Used to test that a function throws when it is called.
1192
- *
1193
- * Also under the alias `expect.toThrowError`.
1194
- *
1195
- * @example
1196
- * expect(() => functionWithError()).toThrow('Error message');
1197
- * expect(() => parseJSON('invalid')).toThrow(SyntaxError);
1198
- */
1199
- toThrow: (expected?: string | Constructable | RegExp | Error) => void;
1200
- /**
1201
- * Used to test that a function throws when it is called.
1202
- *
1203
- * Alias for `expect.toThrow`.
1204
- *
1205
- * @example
1206
- * expect(() => functionWithError()).toThrowError('Error message');
1207
- * expect(() => parseJSON('invalid')).toThrowError(SyntaxError);
1208
- */
1209
- toThrowError: (expected?: string | Constructable | RegExp | Error) => void;
1210
- /**
1211
- * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
1212
- *
1213
- * Alias for `expect.toHaveReturned`.
1214
- *
1215
- * @example
1216
- * expect(mockFunc).toReturn();
1217
- */
1218
- toReturn: () => void;
1219
- /**
1220
- * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
1221
- *
1222
- * Also under the alias `expect.toReturn`.
1223
- *
1224
- * @example
1225
- * expect(mockFunc).toHaveReturned();
1226
- */
1227
- toHaveReturned: () => void;
1228
- /**
1229
- * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
1230
- * Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
1231
- *
1232
- * Alias for `expect.toHaveReturnedTimes`.
1233
- *
1234
- * @example
1235
- * expect(mockFunc).toReturnTimes(3);
1236
- */
1237
- toReturnTimes: (times: number) => void;
1238
- /**
1239
- * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
1240
- * Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
1241
- *
1242
- * Also under the alias `expect.toReturnTimes`.
1243
- *
1244
- * @example
1245
- * expect(mockFunc).toHaveReturnedTimes(3);
1246
- */
1247
- toHaveReturnedTimes: (times: number) => void;
1248
- /**
1249
- * Use to ensure that a mock function returned a specific value.
1250
- *
1251
- * Alias for `expect.toHaveReturnedWith`.
1252
- *
1253
- * @example
1254
- * expect(mockFunc).toReturnWith('returnValue');
1255
- */
1256
- toReturnWith: <E>(value: E) => void;
1257
- /**
1258
- * Use to ensure that a mock function returned a specific value.
1259
- *
1260
- * Also under the alias `expect.toReturnWith`.
1261
- *
1262
- * @example
1263
- * expect(mockFunc).toHaveReturnedWith('returnValue');
1264
- */
1265
- toHaveReturnedWith: <E>(value: E) => void;
1266
- /**
1267
- * Use to test the specific value that a mock function last returned.
1268
- * If the last call to the mock function threw an error, then this matcher will fail
1269
- * no matter what value you provided as the expected return value.
1270
- *
1271
- * Also under the alias `expect.lastReturnedWith`.
1272
- *
1273
- * @example
1274
- * expect(mockFunc).toHaveLastReturnedWith('lastValue');
1275
- */
1276
- toHaveLastReturnedWith: <E>(value: E) => void;
1277
- /**
1278
- * Use to test the specific value that a mock function last returned.
1279
- * If the last call to the mock function threw an error, then this matcher will fail
1280
- * no matter what value you provided as the expected return value.
1281
- *
1282
- * Alias for `expect.toHaveLastReturnedWith`.
1283
- *
1284
- * @example
1285
- * expect(mockFunc).lastReturnedWith('lastValue');
1286
- */
1287
- lastReturnedWith: <E>(value: E) => void;
1288
- /**
1289
- * Use to test the specific value that a mock function returned for the nth call.
1290
- * If the nth call to the mock function threw an error, then this matcher will fail
1291
- * no matter what value you provided as the expected return value.
1292
- *
1293
- * Also under the alias `expect.nthReturnedWith`.
1294
- *
1295
- * @example
1296
- * expect(mockFunc).toHaveNthReturnedWith(2, 'nthValue');
1297
- */
1298
- toHaveNthReturnedWith: <E>(nthCall: number, value: E) => void;
1299
- /**
1300
- * Use to test the specific value that a mock function returned for the nth call.
1301
- * If the nth call to the mock function threw an error, then this matcher will fail
1302
- * no matter what value you provided as the expected return value.
1303
- *
1304
- * Alias for `expect.toHaveNthReturnedWith`.
1305
- *
1306
- * @example
1307
- * expect(mockFunc).nthReturnedWith(2, 'nthValue');
1308
- */
1309
- nthReturnedWith: <E>(nthCall: number, value: E) => void;
1310
- }
1311
-
1312
428
  declare type JsonOptions = FileOptions;
1313
429
 
1314
430
  declare type JsonSummaryOptions = FileOptions;
@@ -1337,56 +453,6 @@ declare type LooseRstestConfig = Omit<RstestConfig, 'reporters'> & {
1337
453
  reporters?: any;
1338
454
  };
1339
455
 
1340
- declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
1341
-
1342
- declare interface MatcherHintOptions {
1343
- comment?: string;
1344
- expectedColor?: Formatter;
1345
- isDirectExpectCall?: boolean;
1346
- isNot?: boolean;
1347
- promise?: string;
1348
- receivedColor?: Formatter;
1349
- secondArgument?: string;
1350
- secondArgumentColor?: Formatter;
1351
- }
1352
-
1353
- declare interface Matchers<T = any> {}
1354
-
1355
- declare type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>> & ThisType<T> & { [K in keyof Matchers<T>]? : RawMatcherFn<T, Parameters<Matchers<T>[K]>> };
1356
-
1357
- declare interface MatcherState {
1358
- customTesters: Array<Tester>;
1359
- assertionCalls: number;
1360
- currentTestName?: string;
1361
- dontThrow?: () => void;
1362
- error?: Error;
1363
- equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
1364
- expand?: boolean;
1365
- expectedAssertionsNumber?: number | null;
1366
- expectedAssertionsNumberErrorGen?: (() => Error) | null;
1367
- isExpectingAssertions?: boolean;
1368
- isExpectingAssertionsError?: Error | null;
1369
- isNot: boolean;
1370
- // environment: VitestEnvironment
1371
- promise: string;
1372
- // snapshotState: SnapshotState
1373
- suppressedErrors: Array<Error>;
1374
- testPath?: string;
1375
- utils: ReturnType<typeof getMatcherUtils> & {
1376
- diff: typeof diff
1377
- stringify: typeof stringify
1378
- iterableEquality: Tester
1379
- subsetEquality: Tester
1380
- };
1381
- soft?: boolean;
1382
- poll?: boolean;
1383
- }
1384
-
1385
- declare interface MatcherState_2 extends MatcherState {
1386
- environment: string;
1387
- snapshotState: SnapshotState;
1388
- }
1389
-
1390
456
  declare type MaybePromise<T> = T | Promise<T>;
1391
457
 
1392
458
  declare type MdReporterOptions = {
@@ -1417,6 +483,13 @@ declare type MdReporterOptions = {
1417
483
  * @default 'file+name'
1418
484
  */
1419
485
  reproduction?: boolean | 'file' | 'file+name';
486
+ /**
487
+ * Test lists (Passed / Skipped / Todo) display mode.
488
+ * - `'auto'`: show only when all tests pass and the run is focused
489
+ * - `'always'`: always show regardless of test status or focus
490
+ * @default 'auto'
491
+ */
492
+ testLists?: 'auto' | 'always';
1420
493
  /**
1421
494
  * Failure output controls.
1422
495
  * @default { max: 50 }
@@ -1474,303 +547,6 @@ declare type MdReporterOptions = {
1474
547
  };
1475
548
  };
1476
549
 
1477
- declare interface MockContext<T extends Procedure> {
1478
- /**
1479
- * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
1480
- *
1481
- * @see https://vitest.dev/api/mock#mock-calls
1482
- * @example
1483
- * const fn = vi.fn()
1484
- *
1485
- * fn('arg1', 'arg2')
1486
- * fn('arg3')
1487
- *
1488
- * fn.mock.calls === [
1489
- * ['arg1', 'arg2'], // first call
1490
- * ['arg3'], // second call
1491
- * ]
1492
- */
1493
- calls: Parameters<T>[];
1494
- /**
1495
- * This is an array containing all instances that were instantiated when mock was called with a `new` keyword. Note that this is an actual context (`this`) of the function, not a return value.
1496
- * @see https://vitest.dev/api/mock#mock-instances
1497
- */
1498
- instances: ReturnType<T>[];
1499
- /**
1500
- * An array of `this` values that were used during each call to the mock function.
1501
- * @see https://vitest.dev/api/mock#mock-contexts
1502
- */
1503
- contexts: ThisParameterType<T>[];
1504
- /**
1505
- * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
1506
- *
1507
- * @see https://vitest.dev/api/mock#mock-invocationcallorder
1508
- * @example
1509
- * const fn1 = vi.fn()
1510
- * const fn2 = vi.fn()
1511
- *
1512
- * fn1()
1513
- * fn2()
1514
- * fn1()
1515
- *
1516
- * fn1.mock.invocationCallOrder === [1, 3]
1517
- * fn2.mock.invocationCallOrder === [2]
1518
- */
1519
- invocationCallOrder: number[];
1520
- /**
1521
- * This is an array containing all values that were `returned` from the function.
1522
- *
1523
- * The `value` property contains the returned value or thrown error. If the function returned a `Promise`, then `result` will always be `'return'` even if the promise was rejected.
1524
- *
1525
- * @see https://vitest.dev/api/mock#mock-results
1526
- * @example
1527
- * const fn = vi.fn()
1528
- * .mockReturnValueOnce('result')
1529
- * .mockImplementationOnce(() => { throw new Error('thrown error') })
1530
- *
1531
- * const result = fn()
1532
- *
1533
- * try {
1534
- * fn()
1535
- * }
1536
- * catch {}
1537
- *
1538
- * fn.mock.results === [
1539
- * {
1540
- * type: 'return',
1541
- * value: 'result',
1542
- * },
1543
- * {
1544
- * type: 'throw',
1545
- * value: Error,
1546
- * },
1547
- * ]
1548
- */
1549
- results: MockResult<ReturnType<T>>[];
1550
- /**
1551
- * An array containing all values that were `resolved` or `rejected` from the function.
1552
- *
1553
- * This array will be empty if the function was never resolved or rejected.
1554
- *
1555
- * @see https://vitest.dev/api/mock#mock-settledresults
1556
- * @example
1557
- * const fn = vi.fn().mockResolvedValueOnce('result')
1558
- *
1559
- * const result = fn()
1560
- *
1561
- * fn.mock.settledResults === []
1562
- * fn.mock.results === [
1563
- * {
1564
- * type: 'return',
1565
- * value: Promise<'result'>,
1566
- * },
1567
- * ]
1568
- *
1569
- * await result
1570
- *
1571
- * fn.mock.settledResults === [
1572
- * {
1573
- * type: 'fulfilled',
1574
- * value: 'result',
1575
- * },
1576
- * ]
1577
- */
1578
- settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
1579
- /**
1580
- * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
1581
- * @see https://vitest.dev/api/mock#mock-lastcall
1582
- */
1583
- lastCall: Parameters<T> | undefined;
1584
- }
1585
-
1586
- declare interface MockInstance<T extends Procedure = Procedure> extends Disposable {
1587
- /**
1588
- * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
1589
- * @see https://vitest.dev/api/mock#getmockname
1590
- */
1591
- getMockName(): string;
1592
- /**
1593
- * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
1594
- * @see https://vitest.dev/api/mock#mockname
1595
- */
1596
- mockName(name: string): this;
1597
- /**
1598
- * Current context of the mock. It stores information about all invocation calls, instances, and results.
1599
- */
1600
- mock: MockContext<T>;
1601
- /**
1602
- * Clears all information about every call. After calling it, all properties on `.mock` will return to their initial state. This method does not reset implementations. It is useful for cleaning up mocks between different assertions.
1603
- *
1604
- * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
1605
- * @see https://vitest.dev/api/mock#mockclear
1606
- */
1607
- mockClear(): this;
1608
- /**
1609
- * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations.
1610
- *
1611
- * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`.
1612
- * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state.
1613
- *
1614
- * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
1615
- * @see https://vitest.dev/api/mock#mockreset
1616
- */
1617
- mockReset(): this;
1618
- /**
1619
- * Does what `mockReset` does and restores original descriptors of spied-on objects.
1620
- *
1621
- * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`.
1622
- * @see https://vitest.dev/api/mock#mockrestore
1623
- */
1624
- mockRestore(): void;
1625
- /**
1626
- * Returns current permanent mock implementation if there is one.
1627
- *
1628
- * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation.
1629
- *
1630
- * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided.
1631
- */
1632
- getMockImplementation(): NormalizedProcedure<T> | undefined;
1633
- /**
1634
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
1635
- * @see https://vitest.dev/api/mock#mockimplementation
1636
- * @example
1637
- * const increment = vi.fn().mockImplementation(count => count + 1);
1638
- * expect(increment(3)).toBe(4);
1639
- */
1640
- mockImplementation(fn: NormalizedProcedure<T>): this;
1641
- /**
1642
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. This method can be chained to produce different results for multiple function calls.
1643
- *
1644
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
1645
- * @see https://vitest.dev/api/mock#mockimplementationonce
1646
- * @example
1647
- * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
1648
- * expect(fn(3)).toBe(4);
1649
- * expect(fn(3)).toBe(3);
1650
- */
1651
- mockImplementationOnce(fn: NormalizedProcedure<T>): this;
1652
- /**
1653
- * Overrides the original mock implementation temporarily while the callback is being executed.
1654
- *
1655
- * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
1656
- * @see https://vitest.dev/api/mock#withimplementation
1657
- * @example
1658
- * const myMockFn = vi.fn(() => 'original')
1659
- *
1660
- * myMockFn.withImplementation(() => 'temp', () => {
1661
- * myMockFn() // 'temp'
1662
- * })
1663
- *
1664
- * myMockFn() // 'original'
1665
- */
1666
- withImplementation<T2>(fn: NormalizedProcedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
1667
- /**
1668
- * Use this if you need to return the `this` context from the method without invoking the actual implementation.
1669
- * @see https://vitest.dev/api/mock#mockreturnthis
1670
- */
1671
- mockReturnThis(): this;
1672
- /**
1673
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
1674
- * @see https://vitest.dev/api/mock#mockreturnvalue
1675
- * @example
1676
- * const mock = vi.fn()
1677
- * mock.mockReturnValue(42)
1678
- * mock() // 42
1679
- * mock.mockReturnValue(43)
1680
- * mock() // 43
1681
- */
1682
- mockReturnValue(value: ReturnType<T>): this;
1683
- /**
1684
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
1685
- *
1686
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
1687
- * @example
1688
- * const myMockFn = vi
1689
- * .fn()
1690
- * .mockReturnValue('default')
1691
- * .mockReturnValueOnce('first call')
1692
- * .mockReturnValueOnce('second call')
1693
- *
1694
- * // 'first call', 'second call', 'default'
1695
- * console.log(myMockFn(), myMockFn(), myMockFn())
1696
- */
1697
- mockReturnValueOnce(value: ReturnType<T>): this;
1698
- /**
1699
- * Accepts a value that will be resolved when the async function is called. TypeScript will only accept values that match the return type of the original function.
1700
- * @example
1701
- * const asyncMock = vi.fn().mockResolvedValue(42)
1702
- * asyncMock() // Promise<42>
1703
- */
1704
- mockResolvedValue(value: Awaited<ReturnType<T>>): this;
1705
- /**
1706
- * Accepts a value that will be resolved during the next function call. TypeScript will only accept values that match the return type of the original function. If chained, each consecutive call will resolve the specified value.
1707
- * @example
1708
- * const myMockFn = vi
1709
- * .fn()
1710
- * .mockResolvedValue('default')
1711
- * .mockResolvedValueOnce('first call')
1712
- * .mockResolvedValueOnce('second call')
1713
- *
1714
- * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
1715
- * console.log(myMockFn(), myMockFn(), myMockFn())
1716
- */
1717
- mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
1718
- /**
1719
- * Accepts an error that will be rejected when async function is called.
1720
- * @example
1721
- * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
1722
- * await asyncMock() // throws Error<'Async error'>
1723
- */
1724
- mockRejectedValue(error: unknown): this;
1725
- /**
1726
- * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
1727
- * @example
1728
- * const asyncMock = vi
1729
- * .fn()
1730
- * .mockResolvedValueOnce('first call')
1731
- * .mockRejectedValueOnce(new Error('Async error'))
1732
- *
1733
- * await asyncMock() // first call
1734
- * await asyncMock() // throws Error<'Async error'>
1735
- */
1736
- mockRejectedValueOnce(error: unknown): this;
1737
- }
1738
-
1739
- declare type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
1740
-
1741
- declare interface MockResultIncomplete {
1742
- type: "incomplete";
1743
- value: undefined;
1744
- }
1745
-
1746
- declare interface MockResultReturn<T> {
1747
- type: "return";
1748
- /**
1749
- * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
1750
- */
1751
- value: T;
1752
- }
1753
-
1754
- declare interface MockResultThrow {
1755
- type: "throw";
1756
- /**
1757
- * An error that was thrown during function execution.
1758
- */
1759
- value: any;
1760
- }
1761
-
1762
- declare type MockSettledResult<T> = MockSettledResultFulfilled<T> | MockSettledResultRejected;
1763
-
1764
- declare interface MockSettledResultFulfilled<T> {
1765
- type: "fulfilled";
1766
- value: T;
1767
- }
1768
-
1769
- declare interface MockSettledResultRejected {
1770
- type: "rejected";
1771
- value: any;
1772
- }
1773
-
1774
550
  declare type NamesIndex = number;
1775
551
 
1776
552
  declare interface NewPlugin {
@@ -1811,17 +587,6 @@ declare type NormalizedCoverageOptions = Required<Omit<CoverageOptions, 'thresho
1811
587
  include?: string[];
1812
588
  };
1813
589
 
1814
- declare type NormalizedFixture = {
1815
- isFn: boolean;
1816
- deps?: string[];
1817
- value: FixtureFn<any, any, any> | any;
1818
- options?: FixtureOptions;
1819
- };
1820
-
1821
- declare type NormalizedFixtures = Record<string, NormalizedFixture>;
1822
-
1823
- declare type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
1824
-
1825
590
  declare type NormalizedProjectConfig = Required<Omit<NormalizedConfig, OptionalKeys | 'projects' | 'reporters' | 'pool' | 'setupFiles' | 'globalSetup'>> & Pick<NormalizedConfig, OptionalKeys> & {
1826
591
  setupFiles: string[];
1827
592
  globalSetup: string[];
@@ -1832,11 +597,7 @@ declare interface OldPlugin {
1832
597
  test: Test;
1833
598
  }
1834
599
 
1835
- declare type OnTestFailedHandler = (ctx: TestContext) => MaybePromise<void>;
1836
-
1837
- declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
1838
-
1839
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
600
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
1840
601
 
1841
602
  declare interface Options {
1842
603
  logger: {
@@ -1884,18 +645,8 @@ declare interface PrettyFormatOptions {
1884
645
 
1885
646
  declare type Print = (arg0: unknown) => string;
1886
647
 
1887
- declare function printDiffOrStringify(received: unknown, expected: unknown, options?: DiffOptions): string | undefined;
1888
-
1889
648
  declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
1890
649
 
1891
- declare function printExpected(value: unknown): string;
1892
-
1893
- declare function printReceived(object: unknown): string;
1894
-
1895
- declare function printWithType<T>(name: string, value: T, print: (value: T) => string): string;
1896
-
1897
- declare type Procedure = (...args: any[]) => any;
1898
-
1899
650
  declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
1900
651
 
1901
652
  declare type ProjectContext = {
@@ -1914,34 +665,11 @@ declare interface ProjectOptions {
1914
665
  projectRoot: string;
1915
666
  }
1916
667
 
1917
- declare type Promisify<O> = { [K in keyof O] : O[K] extends (...args: infer A) => infer R ? Promisify<O[K]> & ((...args: A) => Promise<R>) : O[K] };
1918
-
1919
- declare type Promisify_2<O> = {
1920
- [K in keyof O]: O[K] extends (...args: infer A) => infer R ? Promisify_2<O[K]> & ((...args: A) => Promise<R>) : O[K];
1921
- };
1922
-
1923
- declare type PromisifyAssertion<T> = Promisify<Assertion<T>>;
1924
-
1925
- declare type PromisifyAssertion_2<T> = Promisify_2<Assertion_2<T>>;
1926
-
1927
668
  declare interface Range_2 {
1928
669
  start: Location_3;
1929
670
  end: Location_3;
1930
671
  }
1931
672
 
1932
- declare interface RawMatcherFn<
1933
- T extends MatcherState = MatcherState,
1934
- E extends Array<any> = Array<any>
1935
- > {
1936
- (this: T, received: any, ...expected: E): ExpectationResult;
1937
- }
1938
-
1939
- declare interface RawSnapshotInfo {
1940
- file: string;
1941
- readonly?: boolean;
1942
- content?: string;
1943
- }
1944
-
1945
673
  declare type Refs = Array<unknown>;
1946
674
 
1947
675
  declare class ReportBase {
@@ -2219,7 +947,7 @@ declare interface RstestConfig {
2219
947
  */
2220
948
  unstubGlobals?: boolean;
2221
949
  /**
2222
- * Restores all `process.env` values that were changed with `rstest.stubEnv` before every test.
950
+ * Restores all runtime env values that were changed with `rstest.stubEnv` before every test.
2223
951
  * @default false
2224
952
  */
2225
953
  unstubEnvs?: boolean;
@@ -2265,7 +993,6 @@ declare interface RstestConfig {
2265
993
  includeTaskLocation?: boolean;
2266
994
  plugins?: RsbuildConfig['plugins'];
2267
995
  source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
2268
- performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
2269
996
  dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
2270
997
  output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath' | 'module'>;
2271
998
  resolve?: RsbuildConfig['resolve'];
@@ -2306,8 +1033,6 @@ declare type RstestContext = {
2306
1033
  stateManager: TestStateManager;
2307
1034
  };
2308
1035
 
2309
- declare type RstestExpect = ExpectStatic;
2310
-
2311
1036
  declare type RstestPoolOptions = {
2312
1037
  /** Pool used to run tests in. */
2313
1038
  type?: RstestPoolType;
@@ -2329,23 +1054,11 @@ declare type RstestTestState = {
2329
1054
  };
2330
1055
 
2331
1056
  declare const runInPool: (options: RunWorkerOptions["options"]) => Promise<{
2332
- tests: Test_2[];
1057
+ tests: TestInfo[];
2333
1058
  testPath: string;
2334
1059
  } | TestFileResult>;
2335
1060
  export default runInPool;
2336
1061
 
2337
- declare type RunnerAPI = {
2338
- describe: DescribeAPI;
2339
- it: TestAPIs;
2340
- test: TestAPIs;
2341
- beforeAll: (fn: BeforeAllListener, timeout?: number) => MaybePromise<void>;
2342
- afterAll: (fn: AfterAllListener, timeout?: number) => MaybePromise<void>;
2343
- beforeEach: (fn: BeforeEachListener, timeout?: number) => MaybePromise<void>;
2344
- afterEach: (fn: AfterEachListener, timeout?: number) => MaybePromise<void>;
2345
- onTestFinished: (fn: OnTestFinishedHandler, timeout?: number) => void;
2346
- onTestFailed: (fn: OnTestFailedHandler, timeout?: number) => void;
2347
- };
2348
-
2349
1062
  declare type RunningModules = Map<string, {
2350
1063
  runningTests: TestCaseInfo[];
2351
1064
  results: TestResult[];
@@ -2386,11 +1099,6 @@ declare type RunWorkerOptions = {
2386
1099
  rpcMethods: RuntimeRPC;
2387
1100
  };
2388
1101
 
2389
- declare interface SaveStatus {
2390
- deleted: boolean;
2391
- saved: boolean;
2392
- }
2393
-
2394
1102
  declare interface SnapshotEnvironment {
2395
1103
  getVersion: () => string;
2396
1104
  getHeader: () => string;
@@ -2415,24 +1123,6 @@ declare class SnapshotManager {
2415
1123
  resolveRawPath(testPath: string, rawPath: string): string;
2416
1124
  }
2417
1125
 
2418
- declare interface SnapshotMatcher<T> {
2419
- <U extends {
2420
- [P in keyof T]: any;
2421
- }>(snapshot: Partial<U>, message?: string): void;
2422
- (message?: string): void;
2423
- }
2424
-
2425
- declare interface SnapshotMatchOptions {
2426
- testId: string;
2427
- testName: string;
2428
- received: unknown;
2429
- key?: string;
2430
- inlineSnapshot?: string;
2431
- isInline: boolean;
2432
- error?: Error;
2433
- rawSnapshot?: RawSnapshotInfo;
2434
- }
2435
-
2436
1126
  declare interface SnapshotResult {
2437
1127
  filepath: string;
2438
1128
  added: number;
@@ -2444,60 +1134,6 @@ declare interface SnapshotResult {
2444
1134
  updated: number;
2445
1135
  }
2446
1136
 
2447
- declare interface SnapshotReturnOptions {
2448
- actual: string;
2449
- count: number;
2450
- expected?: string;
2451
- key: string;
2452
- pass: boolean;
2453
- }
2454
-
2455
- declare class SnapshotState {
2456
- testFilePath: string;
2457
- snapshotPath: string;
2458
- private _counters;
2459
- private _dirty;
2460
- private _updateSnapshot;
2461
- private _snapshotData;
2462
- private _initialData;
2463
- private _inlineSnapshots;
2464
- private _inlineSnapshotStacks;
2465
- private _testIdToKeys;
2466
- private _rawSnapshots;
2467
- private _uncheckedKeys;
2468
- private _snapshotFormat;
2469
- private _environment;
2470
- private _fileExists;
2471
- expand: boolean;
2472
- // getter/setter for jest-image-snapshot compat
2473
- // https://github.com/vitest-dev/vitest/issues/7322
2474
- private _added;
2475
- private _matched;
2476
- private _unmatched;
2477
- private _updated;
2478
- get added(): CounterMap<string>;
2479
- set added(value: CounterMap<string>);
2480
- get matched(): CounterMap<string>;
2481
- set matched(value: CounterMap<string>);
2482
- get unmatched(): CounterMap<string>;
2483
- set unmatched(value: CounterMap<string>);
2484
- get updated(): CounterMap<string>;
2485
- set updated(value: CounterMap<string>);
2486
- private constructor();
2487
- static create(testFilePath: string, options: SnapshotStateOptions): Promise<SnapshotState>;
2488
- get environment(): SnapshotEnvironment;
2489
- markSnapshotsAsCheckedForTest(testName: string): void;
2490
- clearTest(testId: string): void;
2491
- protected _inferInlineSnapshotStack(stacks: ParsedStack[]): ParsedStack | null;
2492
- private _addSnapshot;
2493
- save(): Promise<SaveStatus>;
2494
- getUncheckedCount(): number;
2495
- getUncheckedKeys(): Array<string>;
2496
- removeUncheckedKeys(): void;
2497
- match({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot }: SnapshotMatchOptions): SnapshotReturnOptions;
2498
- pack(): Promise<SnapshotResult>;
2499
- }
2500
-
2501
1137
  declare interface SnapshotStateOptions {
2502
1138
  updateSnapshot: SnapshotUpdateState;
2503
1139
  snapshotEnvironment: SnapshotEnvironment;
@@ -2556,102 +1192,17 @@ declare interface SourceMapV3 {
2556
1192
 
2557
1193
  declare type SourcesIndex = number;
2558
1194
 
2559
- declare function stringify(object: unknown, maxDepth?: number, { maxLength,...options }?: StringifyOptions): string;
2560
-
2561
- declare interface StringifyOptions extends PrettyFormatOptions {
2562
- maxLength?: number;
2563
- }
2564
-
2565
- declare type SuiteContext = {
2566
- filepath: TestPath;
2567
- };
2568
-
2569
1195
  declare type Summarizers = "flat" | "nested" | "pkg" | "defaultSummarizer";
2570
1196
 
2571
1197
  /** Union type for all supported reporter types */
2572
1198
  declare type SupportedReporter = keyof ReportOptions | ReportWithOptions | ReportBase | CustomReporter;
2573
1199
 
2574
- declare interface SyncExpectationResult {
2575
- pass: boolean;
2576
- message: () => string;
2577
- actual?: any;
2578
- expected?: any;
2579
- }
2580
-
2581
- declare interface TaskResult {
2582
- /**
2583
- * State of the task. Inherits the `task.mode` during collection.
2584
- * When the task has finished, it will be changed to `pass` or `fail`.
2585
- * - **pass**: task ran successfully
2586
- * - **fail**: task failed
2587
- */
2588
- state: TaskState;
2589
- /**
2590
- * Errors that occurred during the task execution. It is possible to have several errors
2591
- * if `expect.soft()` failed multiple times or `retry` was triggered.
2592
- */
2593
- errors?: FormattedError[];
2594
- }
2595
-
2596
- declare type TaskState = 'pass' | 'fail';
2597
-
2598
1200
  declare interface TeamcityOptions extends FileOptions {
2599
1201
  blockName: string;
2600
1202
  }
2601
1203
 
2602
1204
  declare type Test = (arg0: any) => boolean;
2603
1205
 
2604
- declare type Test_2 = TestSuite | TestCase;
2605
-
2606
- declare type TestAPI<ExtraContext = object> = TestFn<ExtraContext> & {
2607
- each: TestEachFn;
2608
- for: TestForFn<ExtraContext>;
2609
- fails: TestAPI<ExtraContext>;
2610
- concurrent: TestAPI<ExtraContext>;
2611
- sequential: TestAPI<ExtraContext>;
2612
- only: TestAPI<ExtraContext>;
2613
- skip: TestAPI<ExtraContext>;
2614
- todo: TestAPI<ExtraContext>;
2615
- runIf: (condition: boolean) => TestAPI<ExtraContext>;
2616
- skipIf: (condition: boolean) => TestAPI<ExtraContext>;
2617
- };
2618
-
2619
- declare type TestAPIs<ExtraContext = object> = TestAPI<ExtraContext> & {
2620
- extend: <T extends Record<string, any> = object>(fixtures: Fixtures<T, ExtraContext>) => TestAPIs<{
2621
- [K in keyof T | keyof ExtraContext]: K extends keyof T ? T[K] : K extends keyof ExtraContext ? ExtraContext[K] : never;
2622
- }>;
2623
- };
2624
-
2625
- declare type TestCallbackFn<ExtraContext = object> = (context: TestContext & ExtraContext) => MaybePromise<void>;
2626
-
2627
- declare type TestCase = TestCaseInfo & {
2628
- originalFn?: (context: TestContext) => void | Promise<void>;
2629
- fn?: (context: TestContext) => void | Promise<void>;
2630
- runMode: TestRunMode;
2631
- fails?: boolean;
2632
- each?: boolean;
2633
- fixtures?: NormalizedFixtures;
2634
- concurrent?: boolean;
2635
- sequential?: boolean;
2636
- inTestEach?: boolean;
2637
- context: TestContext;
2638
- only?: boolean;
2639
- onFinished: OnTestFinishedHandler[];
2640
- onFailed: OnTestFailedHandler[];
2641
- /**
2642
- * Store promises (from async expects) to wait for them before finishing the test
2643
- */
2644
- promises?: Promise<any>[];
2645
- /**
2646
- * Store stack trace error created when test is registered, used for trace original position
2647
- */
2648
- stackTraceError: Error;
2649
- /**
2650
- * Result of the task. if `expect.soft()` failed multiple times or `retry` was triggered.
2651
- */
2652
- result?: TaskResult;
2653
- };
2654
-
2655
1206
  declare type TestCaseInfo = {
2656
1207
  testId: string;
2657
1208
  testPath: TestPath;
@@ -2663,35 +1214,9 @@ declare type TestCaseInfo = {
2663
1214
  /** Only included when `includeTaskLocation` config is enabled */
2664
1215
  location?: Location_2;
2665
1216
  type: 'case';
1217
+ runMode: TestRunMode;
2666
1218
  };
2667
1219
 
2668
- declare type TestContext = {
2669
- /**
2670
- * Metadata of the current test
2671
- */
2672
- task: {
2673
- /** Test name provided by user */
2674
- name: string;
2675
- /** Result of the current test, undefined if the test is not run yet */
2676
- result?: TestResult;
2677
- };
2678
- expect: RstestExpect;
2679
- onTestFinished: RunnerAPI['onTestFinished'];
2680
- onTestFailed: RunnerAPI['onTestFailed'];
2681
- };
2682
-
2683
- declare interface TestEachFn {
2684
- <T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>, timeout?: number) => void;
2685
- <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>, timeout?: number) => void;
2686
- <T>(cases: readonly T[]): (description: string, fn: (...args: T[]) => MaybePromise<void>, timeout?: number) => void;
2687
- }
2688
-
2689
- declare type Tester = (this: TesterContext, a: any, b: any, customTesters: Array<Tester>) => boolean | undefined;
2690
-
2691
- declare interface TesterContext {
2692
- equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
2693
- }
2694
-
2695
1220
  declare type TestFileInfo = {
2696
1221
  testPath: TestPath;
2697
1222
  tests: TestInfo[];
@@ -2700,13 +1225,9 @@ declare type TestFileInfo = {
2700
1225
  declare type TestFileResult = TestResult & {
2701
1226
  results: TestResult[];
2702
1227
  snapshotResult?: SnapshotResult;
2703
- coverage?: CoverageMapData;
1228
+ coverage?: Record<string, FileCoverageData>;
2704
1229
  };
2705
1230
 
2706
- declare type TestFn<ExtraContext = object> = (description: string, fn?: TestCallbackFn<ExtraContext>, timeout?: number) => void;
2707
-
2708
- declare type TestForFn<ExtraContext = object> = <T>(cases: readonly T[]) => (description: string, fn?: (param: T, context: TestContext & ExtraContext) => MaybePromise<void>, timeout?: number) => void;
2709
-
2710
1231
  declare type TestInfo = TestCaseInfo | (TestSuiteInfo & {
2711
1232
  tests: TestInfo[];
2712
1233
  });
@@ -2748,20 +1269,6 @@ declare class TestStateManager {
2748
1269
  reset(): void;
2749
1270
  }
2750
1271
 
2751
- declare type TestSuite = TestSuiteInfo & {
2752
- runMode: TestRunMode;
2753
- each?: boolean;
2754
- inTestEach?: boolean;
2755
- concurrent?: boolean;
2756
- sequential?: boolean;
2757
- /** nested cases and suite could in a suite */
2758
- tests: Test_2[];
2759
- afterAllListeners?: AfterAllListener[];
2760
- beforeAllListeners?: BeforeAllListener[];
2761
- afterEachListeners?: AfterEachListener[];
2762
- beforeEachListeners?: BeforeEachListener[];
2763
- };
2764
-
2765
1272
  declare type TestSuiteInfo = {
2766
1273
  testId: string;
2767
1274
  name: string;
@@ -2771,6 +1278,7 @@ declare type TestSuiteInfo = {
2771
1278
  type: 'suite';
2772
1279
  /** Only included when `includeTaskLocation` config is enabled */
2773
1280
  location?: Location_2;
1281
+ runMode: TestRunMode;
2774
1282
  };
2775
1283
 
2776
1284
  declare type TextLcovOptions = ProjectOptions;
@@ -2792,13 +1300,6 @@ declare type ThresholdGlobRecord = Record<string, CoverageThreshold & {
2792
1300
  perFile?: boolean;
2793
1301
  }>;
2794
1302
 
2795
- declare interface Totals {
2796
- total: number;
2797
- covered: number;
2798
- skipped: number;
2799
- pct: number;
2800
- }
2801
-
2802
1303
  declare class TraceMap implements SourceMap {
2803
1304
  version: SourceMapV3['version'];
2804
1305
  file: SourceMapV3['file'];
@@ -2826,8 +1327,6 @@ declare interface UncheckedSnapshot {
2826
1327
  keys: Array<string>;
2827
1328
  }
2828
1329
 
2829
- declare type Use<T> = (value: T) => Promise<void>;
2830
-
2831
1330
  declare interface UserConsoleLog {
2832
1331
  content: string;
2833
1332
  name: string;
@@ -2846,11 +1345,6 @@ declare interface Visitor<N extends Node_2 = Node_2> {
2846
1345
  onEnd(root: N, state: any): void;
2847
1346
  }
2848
1347
 
2849
- declare type VitestAssertion<
2850
- A,
2851
- T
2852
- > = { [K in keyof A] : A[K] extends Chai.Assertion ? Assertion<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T> } & ((type: string, message?: string) => Assertion);
2853
-
2854
1348
  declare type Watermark = [number, number];
2855
1349
 
2856
1350
  declare interface Watermarks {
@@ -2860,8 +1354,6 @@ declare interface Watermarks {
2860
1354
  lines: Watermark;
2861
1355
  }
2862
1356
 
2863
- declare type WithAsymmetricMatcher<T> = T | AsymmetricMatcher<unknown>;
2864
-
2865
1357
  declare type WorkerContext = {
2866
1358
  rootPath: RstestContext['rootPath'];
2867
1359
  projectRoot: ProjectContext['rootPath'];