@storybook/test 0.0.0-pr-24225-sha-d42b137f → 0.0.0-pr-23888-sha-8657c59a

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/index.d.ts CHANGED
@@ -1,10 +1,468 @@
1
- import { AsymmetricMatchersContaining, MatchersObject, MatcherState, JestAssertion, ExpectStatic } from '@vitest/expect';
1
+ import { D } from './types-f5c02aaf.js';
2
2
  import { TestingLibraryMatchers } from '@testing-library/jest-dom/types/matchers';
3
- export * from '@vitest/spy';
4
3
  import * as _testing_library_user_event_dist_types_setup_directApi from '@testing-library/user-event/dist/types/setup/directApi';
5
4
  import * as _testing_library_user_event_dist_types_setup_setup from '@testing-library/user-event/dist/types/setup/setup';
6
5
  import * as domTestingLibrary from '@testing-library/dom';
7
6
 
7
+ interface Constructable$1 {
8
+ new (...args: any[]): any;
9
+ }
10
+
11
+ declare const Modifier: unique symbol;
12
+ declare const Hint: unique symbol;
13
+ declare const Kind: unique symbol;
14
+ type Evaluate<T> = T extends infer O ? {
15
+ [K in keyof O]: O[K];
16
+ } : never;
17
+ type TReadonly<T extends TSchema> = T & {
18
+ [Modifier]: 'Readonly';
19
+ };
20
+ type TOptional<T extends TSchema> = T & {
21
+ [Modifier]: 'Optional';
22
+ };
23
+ type TReadonlyOptional<T extends TSchema> = T & {
24
+ [Modifier]: 'ReadonlyOptional';
25
+ };
26
+ interface SchemaOptions {
27
+ $schema?: string;
28
+ /** Id for this schema */
29
+ $id?: string;
30
+ /** Title of this schema */
31
+ title?: string;
32
+ /** Description of this schema */
33
+ description?: string;
34
+ /** Default value for this schema */
35
+ default?: any;
36
+ /** Example values matching this schema */
37
+ examples?: any;
38
+ [prop: string]: any;
39
+ }
40
+ interface TKind {
41
+ [Kind]: string;
42
+ }
43
+ interface TSchema extends SchemaOptions, TKind {
44
+ [Modifier]?: string;
45
+ [Hint]?: string;
46
+ params: unknown[];
47
+ static: unknown;
48
+ }
49
+ interface NumericOptions<N extends number | bigint> extends SchemaOptions {
50
+ exclusiveMaximum?: N;
51
+ exclusiveMinimum?: N;
52
+ maximum?: N;
53
+ minimum?: N;
54
+ multipleOf?: N;
55
+ }
56
+ interface TBoolean extends TSchema {
57
+ [Kind]: 'Boolean';
58
+ static: boolean;
59
+ type: 'boolean';
60
+ }
61
+ interface TNull extends TSchema {
62
+ [Kind]: 'Null';
63
+ static: null;
64
+ type: 'null';
65
+ }
66
+ interface TNumber extends TSchema, NumericOptions<number> {
67
+ [Kind]: 'Number';
68
+ static: number;
69
+ type: 'number';
70
+ }
71
+ type ReadonlyOptionalPropertyKeys<T extends TProperties> = {
72
+ [K in keyof T]: T[K] extends TReadonlyOptional<TSchema> ? K : never;
73
+ }[keyof T];
74
+ type ReadonlyPropertyKeys<T extends TProperties> = {
75
+ [K in keyof T]: T[K] extends TReadonly<TSchema> ? K : never;
76
+ }[keyof T];
77
+ type OptionalPropertyKeys<T extends TProperties> = {
78
+ [K in keyof T]: T[K] extends TOptional<TSchema> ? K : never;
79
+ }[keyof T];
80
+ type RequiredPropertyKeys<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys<T> | ReadonlyPropertyKeys<T> | OptionalPropertyKeys<T>>;
81
+ type PropertiesReducer<T extends TProperties, R extends Record<keyof any, unknown>> = Evaluate<(Readonly<Partial<Pick<R, ReadonlyOptionalPropertyKeys<T>>>> & Readonly<Pick<R, ReadonlyPropertyKeys<T>>> & Partial<Pick<R, OptionalPropertyKeys<T>>> & Required<Pick<R, RequiredPropertyKeys<T>>>)>;
82
+ type PropertiesReduce<T extends TProperties, P extends unknown[]> = PropertiesReducer<T, {
83
+ [K in keyof T]: Static<T[K], P>;
84
+ }>;
85
+ type TProperties = Record<keyof any, TSchema>;
86
+ type TAdditionalProperties = undefined | TSchema | boolean;
87
+ interface ObjectOptions extends SchemaOptions {
88
+ additionalProperties?: TAdditionalProperties;
89
+ minProperties?: number;
90
+ maxProperties?: number;
91
+ }
92
+ interface TObject<T extends TProperties = TProperties> extends TSchema, ObjectOptions {
93
+ [Kind]: 'Object';
94
+ static: PropertiesReduce<T, this['params']>;
95
+ additionalProperties?: TAdditionalProperties;
96
+ type: 'object';
97
+ properties: T;
98
+ required?: string[];
99
+ }
100
+ interface StringOptions<Format extends string> extends SchemaOptions {
101
+ minLength?: number;
102
+ maxLength?: number;
103
+ pattern?: string;
104
+ format?: Format;
105
+ contentEncoding?: '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64';
106
+ contentMediaType?: string;
107
+ }
108
+ interface TString<Format extends string = string> extends TSchema, StringOptions<Format> {
109
+ [Kind]: 'String';
110
+ static: string;
111
+ type: 'string';
112
+ }
113
+ /** Creates a TypeScript static type from a TypeBox type */
114
+ type Static<T extends TSchema, P extends unknown[] = []> = (T & {
115
+ params: P;
116
+ })['static'];
117
+
118
+ /**
119
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
120
+ *
121
+ * This source code is licensed under the MIT license found in the
122
+ * LICENSE file in the root directory of this source tree.
123
+ */
124
+
125
+
126
+ declare const RawSnapshotFormat: TObject<{
127
+ callToJSON: TReadonlyOptional<TBoolean>;
128
+ compareKeys: TReadonlyOptional<TNull>;
129
+ escapeRegex: TReadonlyOptional<TBoolean>;
130
+ escapeString: TReadonlyOptional<TBoolean>;
131
+ highlight: TReadonlyOptional<TBoolean>;
132
+ indent: TReadonlyOptional<TNumber>;
133
+ maxDepth: TReadonlyOptional<TNumber>;
134
+ maxWidth: TReadonlyOptional<TNumber>;
135
+ min: TReadonlyOptional<TBoolean>;
136
+ printBasicPrototype: TReadonlyOptional<TBoolean>;
137
+ printFunctionName: TReadonlyOptional<TBoolean>;
138
+ theme: TReadonlyOptional<
139
+ TObject<{
140
+ comment: TReadonlyOptional<TString<string>>;
141
+ content: TReadonlyOptional<TString<string>>;
142
+ prop: TReadonlyOptional<TString<string>>;
143
+ tag: TReadonlyOptional<TString<string>>;
144
+ value: TReadonlyOptional<TString<string>>;
145
+ }>
146
+ >;
147
+ }>;
148
+
149
+ declare const SnapshotFormat: TObject<{
150
+ callToJSON: TReadonlyOptional<TBoolean>;
151
+ compareKeys: TReadonlyOptional<TNull>;
152
+ escapeRegex: TReadonlyOptional<TBoolean>;
153
+ escapeString: TReadonlyOptional<TBoolean>;
154
+ highlight: TReadonlyOptional<TBoolean>;
155
+ indent: TReadonlyOptional<TNumber>;
156
+ maxDepth: TReadonlyOptional<TNumber>;
157
+ maxWidth: TReadonlyOptional<TNumber>;
158
+ min: TReadonlyOptional<TBoolean>;
159
+ printBasicPrototype: TReadonlyOptional<TBoolean>;
160
+ printFunctionName: TReadonlyOptional<TBoolean>;
161
+ theme: TReadonlyOptional<
162
+ TObject<{
163
+ comment: TReadonlyOptional<TString<string>>;
164
+ content: TReadonlyOptional<TString<string>>;
165
+ prop: TReadonlyOptional<TString<string>>;
166
+ tag: TReadonlyOptional<TString<string>>;
167
+ value: TReadonlyOptional<TString<string>>;
168
+ }>
169
+ >;
170
+ }>;
171
+
172
+ declare type SnapshotFormat = Static<typeof RawSnapshotFormat>;
173
+
174
+ /**
175
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
176
+ *
177
+ * This source code is licensed under the MIT license found in the
178
+ * LICENSE file in the root directory of this source tree.
179
+ */
180
+
181
+
182
+ declare type Colors = {
183
+ comment: {
184
+ close: string;
185
+ open: string;
186
+ };
187
+ content: {
188
+ close: string;
189
+ open: string;
190
+ };
191
+ prop: {
192
+ close: string;
193
+ open: string;
194
+ };
195
+ tag: {
196
+ close: string;
197
+ open: string;
198
+ };
199
+ value: {
200
+ close: string;
201
+ open: string;
202
+ };
203
+ };
204
+
205
+ declare type CompareKeys =
206
+ | ((a: string, b: string) => number)
207
+ | null
208
+ | undefined;
209
+
210
+ declare type Config = {
211
+ callToJSON: boolean;
212
+ compareKeys: CompareKeys;
213
+ colors: Colors;
214
+ escapeRegex: boolean;
215
+ escapeString: boolean;
216
+ indent: string;
217
+ maxDepth: number;
218
+ maxWidth: number;
219
+ min: boolean;
220
+ plugins: Plugins;
221
+ printBasicPrototype: boolean;
222
+ printFunctionName: boolean;
223
+ spacingInner: string;
224
+ spacingOuter: string;
225
+ };
226
+
227
+ declare type Indent = (arg0: string) => string;
228
+
229
+ declare type NewPlugin = {
230
+ serialize: (
231
+ val: any,
232
+ config: Config,
233
+ indentation: string,
234
+ depth: number,
235
+ refs: Refs,
236
+ printer: Printer,
237
+ ) => string;
238
+ test: Test;
239
+ };
240
+
241
+ declare type OldPlugin = {
242
+ print: (
243
+ val: unknown,
244
+ print: Print,
245
+ indent: Indent,
246
+ options: PluginOptions,
247
+ colors: Colors,
248
+ ) => string;
249
+ test: Test;
250
+ };
251
+
252
+ declare type Plugin_2 = NewPlugin | OldPlugin;
253
+
254
+
255
+ declare type PluginOptions = {
256
+ edgeSpacing: string;
257
+ min: boolean;
258
+ spacing: string;
259
+ };
260
+
261
+ declare type Plugins = Array<Plugin_2>;
262
+
263
+ declare interface PrettyFormatOptions
264
+ extends Omit<SnapshotFormat, 'compareKeys'> {
265
+ compareKeys?: CompareKeys;
266
+ plugins?: Plugins;
267
+ }
268
+
269
+ declare type Print = (arg0: unknown) => string;
270
+
271
+ declare type Printer = (
272
+ val: unknown,
273
+ config: Config,
274
+ indentation: string,
275
+ depth: number,
276
+ refs: Refs,
277
+ hasCalledToJSON?: boolean,
278
+ ) => string;
279
+
280
+ declare type Refs = Array<unknown>;
281
+
282
+ declare type Test = (arg0: any) => boolean;
283
+
284
+ declare function stringify(object: unknown, maxDepth?: number, { maxLength, ...options }?: PrettyFormatOptions & {
285
+ maxLength?: number;
286
+ }): string;
287
+
288
+ /**
289
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
290
+ *
291
+ * This source code is licensed under the MIT license found in the
292
+ * LICENSE file in the root directory of this source tree.
293
+ */
294
+
295
+ /**
296
+ * @param a Expected value
297
+ * @param b Received value
298
+ * @param options Diff options
299
+ * @returns
300
+ */
301
+ declare function diff(a: any, b: any, options?: D): string | null;
302
+
303
+ type Formatter = (input: string | number | null | undefined) => string;
304
+
305
+ declare function getMatcherUtils(): {
306
+ EXPECTED_COLOR: {
307
+ (input: unknown): string;
308
+ open: string;
309
+ close: string;
310
+ };
311
+ RECEIVED_COLOR: {
312
+ (input: unknown): string;
313
+ open: string;
314
+ close: string;
315
+ };
316
+ INVERTED_COLOR: {
317
+ (input: unknown): string;
318
+ open: string;
319
+ close: string;
320
+ };
321
+ BOLD_WEIGHT: {
322
+ (input: unknown): string;
323
+ open: string;
324
+ close: string;
325
+ };
326
+ DIM_COLOR: {
327
+ (input: unknown): string;
328
+ open: string;
329
+ close: string;
330
+ };
331
+ matcherHint: (matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions) => string;
332
+ printReceived: (object: unknown) => string;
333
+ printExpected: (value: unknown) => string;
334
+ };
335
+ type Tester = (a: any, b: any) => boolean | undefined;
336
+
337
+ interface MatcherHintOptions {
338
+ comment?: string;
339
+ expectedColor?: Formatter;
340
+ isDirectExpectCall?: boolean;
341
+ isNot?: boolean;
342
+ promise?: string;
343
+ receivedColor?: Formatter;
344
+ secondArgument?: string;
345
+ secondArgumentColor?: Formatter;
346
+ }
347
+ interface MatcherState {
348
+ assertionCalls: number;
349
+ currentTestName?: string;
350
+ dontThrow?: () => void;
351
+ error?: Error;
352
+ equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
353
+ expand?: boolean;
354
+ expectedAssertionsNumber?: number | null;
355
+ expectedAssertionsNumberErrorGen?: (() => Error) | null;
356
+ isExpectingAssertions?: boolean;
357
+ isExpectingAssertionsError?: Error | null;
358
+ isNot: boolean;
359
+ promise: string;
360
+ suppressedErrors: Array<Error>;
361
+ testPath?: string;
362
+ utils: ReturnType<typeof getMatcherUtils> & {
363
+ diff: typeof diff;
364
+ stringify: typeof stringify;
365
+ iterableEquality: Tester;
366
+ subsetEquality: Tester;
367
+ };
368
+ soft?: boolean;
369
+ }
370
+ interface SyncExpectationResult {
371
+ pass: boolean;
372
+ message: () => string;
373
+ actual?: any;
374
+ expected?: any;
375
+ }
376
+ type AsyncExpectationResult = Promise<SyncExpectationResult>;
377
+ type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
378
+ interface RawMatcherFn<T extends MatcherState = MatcherState> {
379
+ (this: T, received: any, expected: any, options?: any): ExpectationResult;
380
+ }
381
+ type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;
382
+ interface ExpectStatic extends Chai.ExpectStatic, AsymmetricMatchersContaining {
383
+ <T>(actual: T, message?: string): Assertion$1<T>;
384
+ unreachable(message?: string): never;
385
+ soft<T>(actual: T, message?: string): Assertion$1<T>;
386
+ extend(expects: MatchersObject): void;
387
+ assertions(expected: number): void;
388
+ hasAssertions(): void;
389
+ anything(): any;
390
+ any(constructor: unknown): any;
391
+ getState(): MatcherState;
392
+ setState(state: Partial<MatcherState>): void;
393
+ not: AsymmetricMatchersContaining;
394
+ }
395
+ interface AsymmetricMatchersContaining {
396
+ stringContaining(expected: string): any;
397
+ objectContaining<T = any>(expected: T): any;
398
+ arrayContaining<T = unknown>(expected: Array<T>): any;
399
+ stringMatching(expected: string | RegExp): any;
400
+ }
401
+ interface JestAssertion<T = any> extends jest.Matchers<void, T> {
402
+ toEqual<E>(expected: E): void;
403
+ toStrictEqual<E>(expected: E): void;
404
+ toBe<E>(expected: E): void;
405
+ toMatch(expected: string | RegExp): void;
406
+ toMatchObject<E extends {} | any[]>(expected: E): void;
407
+ toContain<E>(item: E): void;
408
+ toContainEqual<E>(item: E): void;
409
+ toBeTruthy(): void;
410
+ toBeFalsy(): void;
411
+ toBeGreaterThan(num: number | bigint): void;
412
+ toBeGreaterThanOrEqual(num: number | bigint): void;
413
+ toBeLessThan(num: number | bigint): void;
414
+ toBeLessThanOrEqual(num: number | bigint): void;
415
+ toBeNaN(): void;
416
+ toBeUndefined(): void;
417
+ toBeNull(): void;
418
+ toBeDefined(): void;
419
+ toBeInstanceOf<E>(expected: E): void;
420
+ toBeCalledTimes(times: number): void;
421
+ toHaveLength(length: number): void;
422
+ toHaveProperty<E>(property: string | (string | number)[], value?: E): void;
423
+ toBeCloseTo(number: number, numDigits?: number): void;
424
+ toHaveBeenCalledTimes(times: number): void;
425
+ toHaveBeenCalled(): void;
426
+ toBeCalled(): void;
427
+ toHaveBeenCalledWith<E extends any[]>(...args: E): void;
428
+ toBeCalledWith<E extends any[]>(...args: E): void;
429
+ toHaveBeenNthCalledWith<E extends any[]>(n: number, ...args: E): void;
430
+ nthCalledWith<E extends any[]>(nthCall: number, ...args: E): void;
431
+ toHaveBeenLastCalledWith<E extends any[]>(...args: E): void;
432
+ lastCalledWith<E extends any[]>(...args: E): void;
433
+ toThrow(expected?: string | Constructable$1 | RegExp | Error): void;
434
+ toThrowError(expected?: string | Constructable$1 | RegExp | Error): void;
435
+ toReturn(): void;
436
+ toHaveReturned(): void;
437
+ toReturnTimes(times: number): void;
438
+ toHaveReturnedTimes(times: number): void;
439
+ toReturnWith<E>(value: E): void;
440
+ toHaveReturnedWith<E>(value: E): void;
441
+ toHaveLastReturnedWith<E>(value: E): void;
442
+ lastReturnedWith<E>(value: E): void;
443
+ toHaveNthReturnedWith<E>(nthCall: number, value: E): void;
444
+ nthReturnedWith<E>(nthCall: number, value: E): void;
445
+ }
446
+ type VitestAssertion<A, T> = {
447
+ [K in keyof A]: A[K] extends Chai.Assertion ? Assertion$1<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T>;
448
+ } & ((type: string, message?: string) => Assertion$1);
449
+ type Promisify$1<O> = {
450
+ [K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify$1<O[K]> : (...args: A) => Promise<R> : O[K];
451
+ };
452
+ interface Assertion$1<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T> {
453
+ toBeTypeOf(expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined'): void;
454
+ toHaveBeenCalledOnce(): void;
455
+ toSatisfy<E>(matcher: (value: E) => boolean, message?: string): void;
456
+ resolves: Promisify$1<Assertion$1<T>>;
457
+ rejects: Promisify$1<Assertion$1<T>>;
458
+ }
459
+ declare global {
460
+ namespace jest {
461
+ interface Matchers<R, T = {}> {
462
+ }
463
+ }
464
+ }
465
+
8
466
  type Promisify<Fn> = Fn extends (...args: infer A) => infer R ? (...args: A) => R extends Promise<any> ? R : Promise<R> : Fn;
9
467
  type PromisifyObject<O> = {
10
468
  [K in keyof O]: Promisify<O[K]>;
@@ -31,6 +489,136 @@ interface Expect extends AsymmetricMatchersContaining {
31
489
  not: AsymmetricMatchersContaining;
32
490
  }
33
491
 
492
+ declare const S: unique symbol;
493
+ declare type ReturnError = ['error', any];
494
+ declare type ReturnOk<R> = ['ok', R];
495
+ declare type ResultFn<R> = ReturnError | ReturnOk<R>;
496
+ interface SpyInternal<A extends any[] = any[], R = any> {
497
+ (this: any, ...args: A): R;
498
+ [S]: SpyInternalState<A, R>;
499
+ }
500
+ interface SpyInternalImpl<A extends any[] = any[], R = any> extends SpyInternal<A, R> {
501
+ [S]: SpyInternalImplState<A, R>;
502
+ }
503
+ interface SpyInternalState<A extends any[] = any[], R = any> {
504
+ called: boolean;
505
+ callCount: number;
506
+ calls: A[];
507
+ results: ResultFn<R>[];
508
+ reset(): void;
509
+ impl: ((...args: A) => R) | undefined;
510
+ next: ResultFn<R> | null;
511
+ }
512
+ interface SpyInternalImplState<A extends any[] = any[], R = any> extends SpyInternalState<A, R> {
513
+ getOriginal(): (...args: A) => R;
514
+ willCall(cb: (...args: A) => R): this;
515
+ restore(): void;
516
+ }
517
+
518
+ interface MockResultReturn<T> {
519
+ type: 'return';
520
+ value: T;
521
+ }
522
+ interface MockResultIncomplete {
523
+ type: 'incomplete';
524
+ value: undefined;
525
+ }
526
+ interface MockResultThrow {
527
+ type: 'throw';
528
+ value: any;
529
+ }
530
+ type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
531
+ interface MockContext<TArgs, TReturns> {
532
+ calls: TArgs[];
533
+ instances: TReturns[];
534
+ invocationCallOrder: number[];
535
+ results: MockResult<TReturns>[];
536
+ lastCall: TArgs | undefined;
537
+ }
538
+ type Procedure = (...args: any[]) => any;
539
+ type Methods<T> = {
540
+ [K in keyof T]: T[K] extends Procedure ? K : never;
541
+ }[keyof T] & (string | symbol);
542
+ type Properties<T> = {
543
+ [K in keyof T]: T[K] extends Procedure ? never : K;
544
+ }[keyof T] & (string | symbol);
545
+ type Classes<T> = {
546
+ [K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
547
+ }[keyof T] & (string | symbol);
548
+ interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
549
+ getMockName(): string;
550
+ mockName(n: string): this;
551
+ mock: MockContext<TArgs, TReturns>;
552
+ mockClear(): this;
553
+ mockReset(): this;
554
+ mockRestore(): void;
555
+ getMockImplementation(): ((...args: TArgs) => TReturns) | undefined;
556
+ mockImplementation(fn: ((...args: TArgs) => TReturns) | (() => Promise<TReturns>)): this;
557
+ mockImplementationOnce(fn: ((...args: TArgs) => TReturns) | (() => Promise<TReturns>)): this;
558
+ withImplementation<T>(fn: ((...args: TArgs) => TReturns), cb: () => T): T extends Promise<unknown> ? Promise<this> : this;
559
+ mockReturnThis(): this;
560
+ mockReturnValue(obj: TReturns): this;
561
+ mockReturnValueOnce(obj: TReturns): this;
562
+ mockResolvedValue(obj: Awaited<TReturns>): this;
563
+ mockResolvedValueOnce(obj: Awaited<TReturns>): this;
564
+ mockRejectedValue(obj: any): this;
565
+ mockRejectedValueOnce(obj: any): this;
566
+ }
567
+ interface MockInstance<A extends any[] = any[], R = any> extends SpyInstance<A, R> {
568
+ }
569
+ interface Mock<TArgs extends any[] = any, TReturns = any> extends SpyInstance<TArgs, TReturns> {
570
+ new (...args: TArgs): TReturns;
571
+ (...args: TArgs): TReturns;
572
+ }
573
+ interface PartialMock<TArgs extends any[] = any, TReturns = any> extends SpyInstance<TArgs, TReturns extends Promise<Awaited<TReturns>> ? Promise<Partial<Awaited<TReturns>>> : Partial<TReturns>> {
574
+ new (...args: TArgs): TReturns;
575
+ (...args: TArgs): TReturns;
576
+ }
577
+ type MaybeMockedConstructor<T> = T extends new (...args: Array<any>) => infer R ? Mock<ConstructorParameters<T>, R> : T;
578
+ type MockedFunction<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & {
579
+ [K in keyof T]: T[K];
580
+ };
581
+ type PartiallyMockedFunction<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & {
582
+ [K in keyof T]: T[K];
583
+ };
584
+ type MockedFunctionDeep<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
585
+ type PartiallyMockedFunctionDeep<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
586
+ type MockedObject<T> = MaybeMockedConstructor<T> & {
587
+ [K in Methods<T>]: T[K] extends Procedure ? MockedFunction<T[K]> : T[K];
588
+ } & {
589
+ [K in Properties<T>]: T[K];
590
+ };
591
+ type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
592
+ [K in Methods<T>]: T[K] extends Procedure ? MockedFunctionDeep<T[K]> : T[K];
593
+ } & {
594
+ [K in Properties<T>]: MaybeMockedDeep<T[K]>;
595
+ };
596
+ type MaybeMockedDeep<T> = T extends Procedure ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
597
+ type MaybePartiallyMockedDeep<T> = T extends Procedure ? PartiallyMockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
598
+ type MaybeMocked<T> = T extends Procedure ? MockedFunction<T> : T extends object ? MockedObject<T> : T;
599
+ type MaybePartiallyMocked<T> = T extends Procedure ? PartiallyMockedFunction<T> : T extends object ? MockedObject<T> : T;
600
+ interface Constructable {
601
+ new (...args: any[]): any;
602
+ }
603
+ type MockedClass<T extends Constructable> = MockInstance<T extends new (...args: infer P) => any ? P : never, InstanceType<T>> & {
604
+ prototype: T extends {
605
+ prototype: any;
606
+ } ? Mocked<T['prototype']> : never;
607
+ } & T;
608
+ type Mocked<T> = {
609
+ [P in keyof T]: T[P] extends (...args: infer Args) => infer Returns ? MockInstance<Args, Returns> : T[P] extends Constructable ? MockedClass<T[P]> : T[P];
610
+ } & T;
611
+ type EnhancedSpy<TArgs extends any[] = any[], TReturns = any> = SpyInstance<TArgs, TReturns> & SpyInternalImpl<TArgs, TReturns>;
612
+ declare const spies: Set<SpyInstance<any[], any>>;
613
+ declare function isMockFunction(fn: any): fn is EnhancedSpy;
614
+ declare function spyOn<T, S extends Properties<Required<T>>>(obj: T, methodName: S, accessType: 'get'): SpyInstance<[], T[S]>;
615
+ declare function spyOn<T, G extends Properties<Required<T>>>(obj: T, methodName: G, accessType: 'set'): SpyInstance<[T[G]], void>;
616
+ declare function spyOn<T, M extends (Classes<Required<T>> | Methods<Required<T>>)>(obj: T, methodName: M): Required<T>[M] extends ({
617
+ new (...args: infer A): infer R;
618
+ }) | ((...args: infer A) => infer R) ? SpyInstance<A, R> : never;
619
+ declare function fn<TArgs extends any[] = any, R = any>(): Mock<TArgs, R>;
620
+ declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...args: TArgs) => R): Mock<TArgs, R>;
621
+
34
622
  declare const buildQueries: typeof domTestingLibrary.buildQueries;
35
623
  declare const configure: typeof domTestingLibrary.configure;
36
624
  declare const createEvent: domTestingLibrary.CreateObject & domTestingLibrary.CreateFunction;
@@ -125,4 +713,4 @@ declare const userEvent: {
125
713
 
126
714
  declare const expect: Expect;
127
715
 
128
- export { buildQueries, configure, createEvent, expect, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, prettyDOM, prettyFormat, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, userEvent, waitFor, waitForElementToBeRemoved, within };
716
+ export { EnhancedSpy, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MaybePartiallyMocked, MaybePartiallyMockedDeep, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, PartialMock, PartiallyMockedFunction, PartiallyMockedFunctionDeep, SpyInstance, buildQueries, configure, createEvent, expect, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, fn, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, isMockFunction, logDOM, logRoles, prettyDOM, prettyFormat, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, spies, spyOn, userEvent, waitFor, waitForElementToBeRemoved, within };