@plyaz/types 1.6.0 → 1.7.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.
@@ -52,7 +52,8 @@ import type { Provider, Type } from '@nestjs/common';
52
52
  import type { RenderOptions as RTLRenderOptions, RenderHookOptions as RTLRenderHookOptions } from '@testing-library/react';
53
53
  import type { UserEvent as UserEventLib } from '@testing-library/user-event';
54
54
  import type { MockEventEmitter, MockNextRouter, MockGetServerSidePropsContext, MockGetStaticPropsContext, MockNextApiResponse, MockNextApiRequest, TestScenario, CreateMockUseRouterReturn, CreateMockWebSocketReturn, CreateMockNextRequestFunction } from '..';
55
- import type { UnknownRecord } from 'type-fest';
55
+ import type { UnknownRecord, UnknownArray, Promisable, Arrayable } from 'type-fest';
56
+ import type { KeyValueStore, Identifiable, WithUrl, WithHttpMethod, WithHeaders, WithIpAddress, WithQueryParams, WithBody, Named, Clearable, Resettable, Describable, WithImpact, WithElement, WithDuration, IntervalControl, WithTimestamp, WithParams, WithKeyValues, WithTimeout, WithStatus, WithLocale, WithUserId, WithMessage } from '../../../common';
56
57
  /**
57
58
  * Subscription information for tracking subscriptions in tests
58
59
  *
@@ -67,8 +68,7 @@ import type { UnknownRecord } from 'type-fest';
67
68
  * };
68
69
  * ```
69
70
  */
70
- export interface SubscriptionInfo<T = unknown> {
71
- id: string;
71
+ export interface SubscriptionInfo<T = unknown> extends Identifiable {
72
72
  callback: Vitest.MockedFunction<(data: T) => void>;
73
73
  unsubscribe: () => void;
74
74
  }
@@ -179,10 +179,8 @@ export interface DeferredPromise<T = void> {
179
179
  * await waitFor(() => document.querySelector('.loaded'), options);
180
180
  * ```
181
181
  */
182
- export interface WaitOptions {
183
- timeout?: number;
182
+ export interface WaitOptions extends Partial<WithMessage & WithTimeout> {
184
183
  interval?: number;
185
- message?: string;
186
184
  }
187
185
  /**
188
186
  * Options for retry operations
@@ -262,11 +260,10 @@ export interface MockAsync<T = void> {
262
260
  * expect(timer.elapsed).toBe(500);
263
261
  * ```
264
262
  */
265
- export interface ControllableTimer {
263
+ export interface ControllableTimer extends Resettable {
266
264
  start: () => void;
267
265
  stop: () => void;
268
266
  tick: (ms: number) => void;
269
- reset: () => void;
270
267
  elapsed: number;
271
268
  }
272
269
  /**
@@ -330,9 +327,9 @@ export interface TestEventEmitter<T = unknown> {
330
327
  */
331
328
  export interface AsyncTestStep<T = unknown> {
332
329
  name: string;
333
- action: () => Promise<T> | T;
330
+ action: () => Promisable<T>;
334
331
  delay?: number;
335
- assertion?: (result: T) => void | Promise<void>;
332
+ assertion?: (result: T) => Promisable<void>;
336
333
  onError?: (error: Error) => void;
337
334
  }
338
335
  /**
@@ -497,7 +494,7 @@ export interface PollingTestOptions {
497
494
  * ```
498
495
  */
499
496
  export interface TestCleanup {
500
- add: (cleanup: () => void | Promise<void>) => void;
497
+ add: (cleanup: () => Promisable<void>) => void;
501
498
  runAll: () => Promise<void>;
502
499
  clear: () => void;
503
500
  }
@@ -543,11 +540,7 @@ export interface MockConsole {
543
540
  * };
544
541
  * ```
545
542
  */
546
- export interface MockEnv {
547
- set: (key: string, value: string) => void;
548
- get: (key: string) => string | undefined;
549
- delete: (key: string) => void;
550
- clear: () => void;
543
+ export interface MockEnv extends KeyValueStore<string, string> {
551
544
  restore: () => void;
552
545
  }
553
546
  /**
@@ -600,8 +593,8 @@ export interface BenchmarkOptions {
600
593
  iterations?: number;
601
594
  time?: number;
602
595
  warmup?: number;
603
- setup?: () => void | Promise<void>;
604
- teardown?: () => void | Promise<void>;
596
+ setup?: () => Promisable<void>;
597
+ teardown?: () => Promisable<void>;
605
598
  runs?: number;
606
599
  format?: 'table' | 'json';
607
600
  }
@@ -620,8 +613,8 @@ export interface BenchmarkOptions {
620
613
  */
621
614
  export interface TestBedConfig {
622
615
  providers: Provider[];
623
- imports?: unknown[];
624
- exports?: unknown[];
616
+ imports?: UnknownArray;
617
+ exports?: UnknownArray;
625
618
  }
626
619
  /**
627
620
  * Options for testing NestJS controllers.
@@ -662,10 +655,8 @@ export interface ControllerTestHarnessOptions<T> {
662
655
  * };
663
656
  * ```
664
657
  */
665
- export interface ValidateMiddlwareResponseExpected {
658
+ export interface ValidateMiddlwareResponseExpected extends Partial<WithUrl & WithStatus> {
666
659
  type: 'next' | 'redirect' | 'rewrite' | 'response';
667
- url?: string;
668
- status?: number;
669
660
  }
670
661
  /**
671
662
  * Options for creating service test harness.
@@ -757,7 +748,7 @@ export interface ApiRouteTestContext {
757
748
  expectStatus: (status: number) => void;
758
749
  expectJson: (data: unknown) => void;
759
750
  expectRedirect: (url: string, status?: number) => void;
760
- expectHeader: (name: string, value: string | string[]) => void;
751
+ expectHeader: (name: string, value: Arrayable<string>) => void;
761
752
  }
762
753
  /**
763
754
  * Test context for middleware functions.
@@ -804,8 +795,8 @@ export interface MiddlewareTestContext {
804
795
  */
805
796
  export interface AppRouterHookTestOptions<TProps> extends RenderHookOptions<TProps> {
806
797
  pathname?: string;
807
- searchParams?: Record<string, string | string[]>;
808
- params?: Record<string, string | string[]>;
798
+ searchParams?: Record<string, Arrayable<string>>;
799
+ params?: Record<string, Arrayable<string>>;
809
800
  }
810
801
  export type UserEvent = UserEventLib;
811
802
  /**
@@ -826,7 +817,7 @@ export type UserEvent = UserEventLib;
826
817
  */
827
818
  export interface UserEventConfig {
828
819
  delay?: number;
829
- advanceTimers?: (ms: number) => void | Promise<void>;
820
+ advanceTimers?: (ms: number) => Promisable<void>;
830
821
  applyAccept?: boolean;
831
822
  autoModify?: boolean;
832
823
  skipAutoClose?: boolean;
@@ -852,7 +843,7 @@ export interface UserEventConfig {
852
843
  export interface InteractionSequence {
853
844
  type: 'click' | 'type' | 'select' | 'check' | 'focus' | 'blur' | 'hover' | 'key' | 'paste' | 'clear' | 'upload' | 'drag' | 'scroll' | 'wait' | 'tab' | 'keyboard';
854
845
  target?: string | HTMLElement;
855
- value?: string | string[] | boolean | File | File[];
846
+ value?: Arrayable<string> | boolean | Arrayable<File>;
856
847
  wait?: number;
857
848
  options?: {
858
849
  delay?: number;
@@ -1010,8 +1001,7 @@ export interface EventDrivenTestUtils {
1010
1001
  * };
1011
1002
  * ```
1012
1003
  */
1013
- export interface TestServer {
1014
- url: string;
1004
+ export interface TestServer extends WithUrl {
1015
1005
  port: number;
1016
1006
  close: () => Promise<void>;
1017
1007
  on: (event: string, handler: Function) => void;
@@ -1069,8 +1059,7 @@ export interface ConcurrentTestResult {
1069
1059
  * };
1070
1060
  * ```
1071
1061
  */
1072
- export interface RateLimitResult {
1073
- timestamp: number;
1062
+ export interface RateLimitResult extends WithTimestamp<number> {
1074
1063
  success: boolean;
1075
1064
  error?: Error;
1076
1065
  }
@@ -1105,10 +1094,9 @@ export interface RateLimitTestResult {
1105
1094
  * };
1106
1095
  * ```
1107
1096
  */
1108
- export interface PollingAttempt {
1097
+ export interface PollingAttempt extends WithTimestamp<number> {
1109
1098
  attempt: number;
1110
1099
  result: unknown;
1111
- timestamp: number;
1112
1100
  }
1113
1101
  /**
1114
1102
  * Results from polling operation testing.
@@ -1159,7 +1147,7 @@ export interface DebounceTestResult {
1159
1147
  * ```
1160
1148
  */
1161
1149
  export interface ThrottleCall {
1162
- args: unknown[];
1150
+ args: UnknownArray;
1163
1151
  delay: number;
1164
1152
  }
1165
1153
  /**
@@ -1176,7 +1164,7 @@ export interface ThrottleCall {
1176
1164
  */
1177
1165
  export interface ThrottleResult {
1178
1166
  called: boolean;
1179
- args?: unknown[];
1167
+ args?: UnknownArray;
1180
1168
  }
1181
1169
  /**
1182
1170
  * Async testing scenario definition.
@@ -1196,11 +1184,10 @@ export interface ThrottleResult {
1196
1184
  * };
1197
1185
  * ```
1198
1186
  */
1199
- export interface AsyncScenario<T = void> {
1200
- name: string;
1187
+ export interface AsyncScenario<T = void> extends Named {
1201
1188
  setup: () => Promise<void>;
1202
1189
  action: () => Promise<T>;
1203
- verify: (result: T) => void | Promise<void>;
1190
+ verify: (result: T) => Promisable<void>;
1204
1191
  cleanup?: () => Promise<void>;
1205
1192
  expectedHooks: string[];
1206
1193
  }
@@ -1219,8 +1206,7 @@ export interface AsyncScenario<T = void> {
1219
1206
  * };
1220
1207
  * ```
1221
1208
  */
1222
- export interface WaitForChangeOptions<T> {
1223
- timeout?: number;
1209
+ export interface WaitForChangeOptions<T> extends Partial<WithTimeout> {
1224
1210
  interval?: number;
1225
1211
  compareFn?: (a: T, b: T) => boolean;
1226
1212
  }
@@ -1721,10 +1707,9 @@ export interface AssertPerformanceOptions {
1721
1707
  * };
1722
1708
  * ```
1723
1709
  */
1724
- export interface EventHistoryEntry {
1710
+ export interface EventHistoryEntry extends WithTimestamp<number> {
1725
1711
  event: string;
1726
1712
  payload: unknown;
1727
- timestamp: number;
1728
1713
  }
1729
1714
  /**
1730
1715
  * Configuration for simulating events in tests.
@@ -1771,8 +1756,7 @@ export interface SimulatedEvent {
1771
1756
  * const mockWS = createMockWebSocket(options);
1772
1757
  * ```
1773
1758
  */
1774
- export interface WebSocketMockOptions {
1775
- url?: string;
1759
+ export interface WebSocketMockOptions extends Partial<WithUrl> {
1776
1760
  protocol?: string;
1777
1761
  extensions?: string;
1778
1762
  readyState?: number;
@@ -1814,8 +1798,7 @@ export interface WebSocketServerMockOptions {
1814
1798
  * };
1815
1799
  * ```
1816
1800
  */
1817
- export interface WebSocketTestScenario {
1818
- name: string;
1801
+ export interface WebSocketTestScenario extends Named {
1819
1802
  message: unknown;
1820
1803
  expectedResponse?: unknown;
1821
1804
  expectedBroadcast?: unknown;
@@ -1840,11 +1823,8 @@ export interface WebSocketTestScenario {
1840
1823
  * const ws = await connectWebSocket(connectionOptions);
1841
1824
  * ```
1842
1825
  */
1843
- export interface WebSocketConnectionOptions {
1844
- url: string;
1845
- protocols?: string | string[];
1846
- headers?: Record<string, string>;
1847
- timeout?: number;
1826
+ export interface WebSocketConnectionOptions extends Partial<WithTimeout>, WithUrl, WithHeaders {
1827
+ protocols?: Arrayable<string>;
1848
1828
  }
1849
1829
  /**
1850
1830
  * Test configuration for file operations.
@@ -1865,9 +1845,8 @@ export interface WebSocketConnectionOptions {
1865
1845
  * };
1866
1846
  * ```
1867
1847
  */
1868
- export interface FileOperationTest {
1869
- name: string;
1870
- operation: (fs: unknown) => void | Promise<void>;
1848
+ export interface FileOperationTest extends Named {
1849
+ operation: (fs: unknown) => Promisable<void>;
1871
1850
  expectedFiles?: Map<string, string | globalThis.Buffer>;
1872
1851
  expectedError?: string | RegExp;
1873
1852
  }
@@ -1955,8 +1934,7 @@ export interface AriaAttributes {
1955
1934
  * ];
1956
1935
  * ```
1957
1936
  */
1958
- export interface KeyboardNavigationTest {
1959
- element: HTMLElement;
1937
+ export interface KeyboardNavigationTest extends WithElement {
1960
1938
  key: string;
1961
1939
  expectedBehavior: 'focus' | 'activate' | 'navigate' | 'ignore';
1962
1940
  expectedTarget?: HTMLElement;
@@ -1981,8 +1959,7 @@ export interface KeyboardNavigationTest {
1981
1959
  * ];
1982
1960
  * ```
1983
1961
  */
1984
- export interface ScreenReaderTest {
1985
- element: HTMLElement;
1962
+ export interface ScreenReaderTest extends WithElement {
1986
1963
  expectedText: string | RegExp;
1987
1964
  includeHidden?: boolean;
1988
1965
  }
@@ -2010,8 +1987,7 @@ export interface ScreenReaderTest {
2010
1987
  * ];
2011
1988
  * ```
2012
1989
  */
2013
- export interface LifecycleHook {
2014
- name: string;
1990
+ export interface LifecycleHook extends Named {
2015
1991
  method: string;
2016
1992
  phase: 'mount' | 'update' | 'unmount' | 'init' | 'destroy';
2017
1993
  required?: boolean;
@@ -2037,13 +2013,12 @@ export interface LifecycleHook {
2037
2013
  * };
2038
2014
  * ```
2039
2015
  */
2040
- export interface ComponentLifecycleTest {
2041
- name: string;
2016
+ export interface ComponentLifecycleTest extends Named {
2042
2017
  Component: React.ComponentType<unknown>;
2043
- props?: Record<string, unknown>;
2018
+ props?: UnknownRecord;
2044
2019
  expectedHooks: LifecycleHook[];
2045
2020
  interactions?: Array<{
2046
- action: () => void | Promise<void>;
2021
+ action: () => Promisable<void>;
2047
2022
  expectedHooksAfter: string[];
2048
2023
  }>;
2049
2024
  }
@@ -2097,10 +2072,9 @@ export interface ServiceWithLifecycle {
2097
2072
  * };
2098
2073
  * ```
2099
2074
  */
2100
- export interface ServiceLifecycleTest {
2101
- name: string;
2075
+ export interface ServiceLifecycleTest extends Named {
2102
2076
  Service: new (...args: unknown[]) => ServiceWithLifecycle;
2103
- dependencies?: unknown[];
2077
+ dependencies?: UnknownArray;
2104
2078
  expectedHooks: LifecycleHook[];
2105
2079
  cleanupExpected?: boolean;
2106
2080
  }
@@ -2118,9 +2092,7 @@ export interface ServiceLifecycleTest {
2118
2092
  * ```
2119
2093
  */
2120
2094
  export interface ProviderWithLifecycle {
2121
- constructor: {
2122
- name: string;
2123
- };
2095
+ constructor: Named;
2124
2096
  onModuleInit?: () => Promise<void>;
2125
2097
  onModuleDestroy?: () => Promise<void>;
2126
2098
  [key: string]: unknown;
@@ -2140,8 +2112,7 @@ export interface ProviderWithLifecycle {
2140
2112
  * };
2141
2113
  * ```
2142
2114
  */
2143
- export interface ModuleLifecycleTest {
2144
- name: string;
2115
+ export interface ModuleLifecycleTest extends Named {
2145
2116
  Module: new (...args: unknown[]) => unknown;
2146
2117
  providers: ProviderWithLifecycle[];
2147
2118
  expectedInitOrder: string[];
@@ -2162,10 +2133,9 @@ export interface ModuleLifecycleTest {
2162
2133
  * };
2163
2134
  * ```
2164
2135
  */
2165
- export interface ApplicationLifecycleTest {
2166
- name: string;
2167
- app: Record<string, unknown>;
2168
- modules: unknown[];
2136
+ export interface ApplicationLifecycleTest extends Named {
2137
+ app: UnknownRecord;
2138
+ modules: UnknownArray;
2169
2139
  expectedStartupSequence: string[];
2170
2140
  expectedShutdownSequence: string[];
2171
2141
  }
@@ -2187,14 +2157,13 @@ export interface ApplicationLifecycleTest {
2187
2157
  * };
2188
2158
  * ```
2189
2159
  */
2190
- export interface TestSuiteConfig<T> {
2191
- name: string;
2160
+ export interface TestSuiteConfig<T> extends Named {
2192
2161
  createInstance: () => T;
2193
2162
  defaultProps?: unknown;
2194
- setupBeforeAll?: () => void | Promise<void>;
2195
- setupBeforeEach?: () => void | Promise<void>;
2196
- teardownAfterEach?: () => void | Promise<void>;
2197
- teardownAfterAll?: () => void | Promise<void>;
2163
+ setupBeforeAll?: () => Promisable<void>;
2164
+ setupBeforeEach?: () => Promisable<void>;
2165
+ teardownAfterEach?: () => Promisable<void>;
2166
+ teardownAfterAll?: () => Promisable<void>;
2198
2167
  }
2199
2168
  /**
2200
2169
  * Environment configuration for testing.
@@ -2228,8 +2197,7 @@ export interface EnvironmentConfig {
2228
2197
  * };
2229
2198
  * ```
2230
2199
  */
2231
- export interface AnimationTestOptions {
2232
- duration?: number;
2200
+ export interface AnimationTestOptions extends Partial<WithDuration> {
2233
2201
  easing?: string;
2234
2202
  delay?: number;
2235
2203
  iterations?: number;
@@ -2250,9 +2218,8 @@ export interface AnimationTestOptions {
2250
2218
  * };
2251
2219
  * ```
2252
2220
  */
2253
- export interface TransitionTestOptions {
2221
+ export interface TransitionTestOptions extends Partial<WithDuration> {
2254
2222
  property?: string;
2255
- duration?: number;
2256
2223
  timingFunction?: string;
2257
2224
  delay?: number;
2258
2225
  }
@@ -2292,8 +2259,7 @@ export interface KeyframeTest {
2292
2259
  * };
2293
2260
  * ```
2294
2261
  */
2295
- export interface AnimationSequence {
2296
- name: string;
2262
+ export interface AnimationSequence extends Named {
2297
2263
  steps: Array<{
2298
2264
  delay?: number;
2299
2265
  duration: number;
@@ -2317,11 +2283,10 @@ export interface AnimationSequence {
2317
2283
  * };
2318
2284
  * ```
2319
2285
  */
2320
- export interface EnvironmentTestCase {
2321
- name: string;
2286
+ export interface EnvironmentTestCase extends Named {
2322
2287
  environment: EnvironmentConfig;
2323
- expectedBehavior: () => void | Promise<void>;
2324
- cleanup?: () => void | Promise<void>;
2288
+ expectedBehavior: () => Promisable<void>;
2289
+ cleanup?: () => Promisable<void>;
2325
2290
  }
2326
2291
  /**
2327
2292
  * Configuration test scenario.
@@ -2339,11 +2304,10 @@ export interface EnvironmentTestCase {
2339
2304
  * };
2340
2305
  * ```
2341
2306
  */
2342
- export interface ConfigTestScenario {
2343
- name: string;
2344
- config: Record<string, unknown>;
2307
+ export interface ConfigTestScenario extends Named {
2308
+ config: UnknownRecord;
2345
2309
  environment?: EnvironmentConfig;
2346
- expectedValues: Record<string, unknown>;
2310
+ expectedValues: UnknownRecord;
2347
2311
  shouldThrow?: boolean;
2348
2312
  expectedError?: string | RegExp;
2349
2313
  }
@@ -2377,8 +2341,7 @@ export interface SpringConfig {
2377
2341
  * };
2378
2342
  * ```
2379
2343
  */
2380
- export interface RAFCallback {
2381
- id: number;
2344
+ export interface RAFCallback extends Identifiable<number> {
2382
2345
  callback: FrameRequestCallback;
2383
2346
  }
2384
2347
  /**
@@ -2408,9 +2371,7 @@ export interface LoadingState {
2408
2371
  * };
2409
2372
  * ```
2410
2373
  */
2411
- export interface ForTextOptions {
2412
- timeout?: number;
2413
- }
2374
+ export type ForTextOptions = WithTimeout;
2414
2375
  /**
2415
2376
  * Test value with index wrapper.
2416
2377
  * Associates test values with their position.
@@ -2442,10 +2403,9 @@ export interface TestValueWithIndex<T> {
2442
2403
  * };
2443
2404
  * ```
2444
2405
  */
2445
- export interface CallRecord {
2406
+ export interface CallRecord extends WithTimestamp<number> {
2446
2407
  method: string;
2447
- args: unknown[];
2448
- timestamp: number;
2408
+ args: UnknownArray;
2449
2409
  }
2450
2410
  /**
2451
2411
  * Module spy for tracking calls.
@@ -2480,8 +2440,7 @@ export interface ModuleSpy<T> {
2480
2440
  * };
2481
2441
  * ```
2482
2442
  */
2483
- export interface NamedTestCase<T> {
2484
- name: string;
2443
+ export interface NamedTestCase<T> extends Named {
2485
2444
  input: T;
2486
2445
  expected: unknown;
2487
2446
  }
@@ -2537,7 +2496,7 @@ export interface NextPageResult {
2537
2496
  * ```
2538
2497
  */
2539
2498
  export interface MockCallResult {
2540
- args: unknown[];
2499
+ args: UnknownArray;
2541
2500
  result: unknown;
2542
2501
  error?: unknown;
2543
2502
  }
@@ -2652,12 +2611,7 @@ export interface MockNextRouterReturn {
2652
2611
  * };
2653
2612
  * ```
2654
2613
  */
2655
- export interface MockNextRequest {
2656
- url: string;
2657
- method: string;
2658
- headers: Headers;
2659
- body: unknown;
2660
- ip: string;
2614
+ export interface MockNextRequest extends WithUrl, WithHttpMethod, WithHeaders, WithIpAddress, WithBody {
2661
2615
  searchParams?: Record<string, string>;
2662
2616
  nextUrl: {
2663
2617
  pathname: string;
@@ -2690,13 +2644,12 @@ export interface MockNextRequest {
2690
2644
  * response.redirect('/login');
2691
2645
  * ```
2692
2646
  */
2693
- export interface MockNextResponse {
2647
+ export interface MockNextResponse extends WithStatus<number> {
2694
2648
  cookies: {
2695
2649
  set: Vitest.Mock;
2696
2650
  delete: Vitest.Mock;
2697
2651
  };
2698
2652
  headers: Headers;
2699
- status: number;
2700
2653
  redirect: Vitest.Mock;
2701
2654
  rewrite: Vitest.Mock;
2702
2655
  next: Vitest.Mock;
@@ -2778,7 +2731,7 @@ export interface GetStaticPathsExpectations {
2778
2731
  pathCount?: number;
2779
2732
  fallback: boolean | 'blocking';
2780
2733
  validatePaths?: (paths: Array<string | {
2781
- params: Record<string, string | string[] | undefined>;
2734
+ params: Record<string, Arrayable<string> | undefined>;
2782
2735
  }>) => void;
2783
2736
  }
2784
2737
  /**
@@ -2875,15 +2828,13 @@ export interface LoadingComponentExpectations {
2875
2828
  * };
2876
2829
  * ```
2877
2830
  */
2878
- export interface MiddlewareTestScenarioWithRequest {
2879
- name: string;
2831
+ export interface MiddlewareTestExpectedResponse extends Partial<WithUrl & WithStatus> {
2832
+ type: 'next' | 'redirect' | 'rewrite' | 'response';
2833
+ headers?: Record<string, string>;
2834
+ }
2835
+ export interface MiddlewareTestScenarioWithRequest extends Named {
2880
2836
  request: Parameters<CreateMockNextRequestFunction>;
2881
- expected: {
2882
- type: 'next' | 'redirect' | 'rewrite' | 'response';
2883
- url?: string;
2884
- headers?: Record<string, string>;
2885
- status?: number;
2886
- };
2837
+ expected: MiddlewareTestExpectedResponse;
2887
2838
  }
2888
2839
  /**
2889
2840
  * API route handler methods for Next.js.
@@ -2919,8 +2870,7 @@ export interface ApiRouteHandlerMethods {
2919
2870
  * };
2920
2871
  * ```
2921
2872
  */
2922
- export interface RouteHandlerTestScenario {
2923
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
2873
+ export interface RouteHandlerTestScenario extends WithHttpMethod {
2924
2874
  request: Parameters<CreateMockNextRequestFunction>;
2925
2875
  expectedStatus: number;
2926
2876
  expectedBody?: unknown;
@@ -2957,7 +2907,7 @@ export interface ImageLoaderTestScenario {
2957
2907
  * ```
2958
2908
  */
2959
2909
  export interface ParameterizedTest<T> {
2960
- test: (name: string, fn: (input: T, expected: unknown) => void | Promise<void>) => void;
2910
+ test: (name: string, fn: (input: T, expected: unknown) => Promisable<void>) => void;
2961
2911
  }
2962
2912
  /**
2963
2913
  * Test suite for service testing.
@@ -2990,7 +2940,7 @@ export interface ServiceTestSuite<T> {
2990
2940
  * ```
2991
2941
  */
2992
2942
  export interface NestJSTestSuiteReturn {
2993
- testProviderRegistration: (providerTokens: unknown[]) => void;
2943
+ testProviderRegistration: (providerTokens: UnknownArray) => void;
2994
2944
  testProviderInjection: (injectionTests: Array<ProviderInjectionTest>) => void;
2995
2945
  }
2996
2946
  /**
@@ -3091,8 +3041,7 @@ export interface MockManyResult {
3091
3041
  * };
3092
3042
  * ```
3093
3043
  */
3094
- export interface RouteMatchResult {
3095
- params: Record<string, string | string[]>;
3044
+ export interface RouteMatchResult extends WithParams {
3096
3045
  isMatch: boolean;
3097
3046
  }
3098
3047
  /**
@@ -3107,8 +3056,7 @@ export interface RouteMatchResult {
3107
3056
  * };
3108
3057
  * ```
3109
3058
  */
3110
- export interface PerformanceEntryResult {
3111
- name: string;
3059
+ export interface PerformanceEntryResult extends Named {
3112
3060
  metrics: PerformanceMetrics;
3113
3061
  }
3114
3062
  /**
@@ -3183,9 +3131,8 @@ export interface MemoryLeakTestResult {
3183
3131
  * };
3184
3132
  * ```
3185
3133
  */
3186
- export interface PropVariation {
3187
- name: string;
3188
- props: Record<string, unknown>;
3134
+ export interface PropVariation extends Named {
3135
+ props: UnknownRecord;
3189
3136
  expectation: () => void;
3190
3137
  }
3191
3138
  /**
@@ -3203,8 +3150,7 @@ export interface PropVariation {
3203
3150
  * };
3204
3151
  * ```
3205
3152
  */
3206
- export interface ValidTestCase<T> {
3207
- name: string;
3153
+ export interface ValidTestCase<T> extends Named {
3208
3154
  input: unknown;
3209
3155
  expected?: T;
3210
3156
  }
@@ -3221,8 +3167,7 @@ export interface ValidTestCase<T> {
3221
3167
  * };
3222
3168
  * ```
3223
3169
  */
3224
- export interface InvalidTestCase {
3225
- name: string;
3170
+ export interface InvalidTestCase extends Named {
3226
3171
  input: unknown;
3227
3172
  expectedError: string | RegExp;
3228
3173
  }
@@ -3238,8 +3183,7 @@ export interface InvalidTestCase {
3238
3183
  * };
3239
3184
  * ```
3240
3185
  */
3241
- export interface CreatedResource {
3242
- name: string;
3186
+ export interface CreatedResource extends Named {
3243
3187
  resource: unknown;
3244
3188
  }
3245
3189
  /**
@@ -3255,10 +3199,9 @@ export interface CreatedResource {
3255
3199
  * };
3256
3200
  * ```
3257
3201
  */
3258
- export interface LifecycleHookRecord {
3202
+ export interface LifecycleHookRecord extends WithTimestamp<number> {
3259
3203
  phase: string;
3260
3204
  method: string;
3261
- timestamp: number;
3262
3205
  }
3263
3206
  /**
3264
3207
  * Test case for path matching.
@@ -3309,7 +3252,7 @@ export interface ErrorScenario<T> {
3309
3252
  * ```
3310
3253
  */
3311
3254
  export interface PropsTestScenario {
3312
- props: Record<string, unknown>;
3255
+ props: UnknownRecord;
3313
3256
  expectedContent?: string;
3314
3257
  }
3315
3258
  /**
@@ -3332,7 +3275,7 @@ export interface ResponsiveBreakpoint {
3332
3275
  height: number;
3333
3276
  expectations: () => void;
3334
3277
  }
3335
- export type TestCombination<T extends Record<string, unknown[]>> = {
3278
+ export type TestCombination<T extends Record<string, UnknownArray>> = {
3336
3279
  [K in keyof T]: T[K][number];
3337
3280
  };
3338
3281
  /**
@@ -3377,8 +3320,7 @@ export type LoadingResult = {
3377
3320
  * };
3378
3321
  * ```
3379
3322
  */
3380
- export interface TableTestCase<TInput, TExpected> {
3381
- name: string;
3323
+ export interface TableTestCase<TInput, TExpected> extends Named {
3382
3324
  input: TInput;
3383
3325
  expected: TExpected;
3384
3326
  skip?: boolean;
@@ -3401,8 +3343,7 @@ export interface TableTestCase<TInput, TExpected> {
3401
3343
  * };
3402
3344
  * ```
3403
3345
  */
3404
- export interface EdgeCaseTest<T, R> {
3405
- name: string;
3346
+ export interface EdgeCaseTest<T, R> extends Named {
3406
3347
  input: T;
3407
3348
  expected?: R;
3408
3349
  shouldThrow?: string | RegExp | Error;
@@ -3565,8 +3506,7 @@ export interface BoundaryValueTest<T> {
3565
3506
  * };
3566
3507
  * ```
3567
3508
  */
3568
- export interface EquivalenceClassTest<T, R> {
3569
- name: string;
3509
+ export interface EquivalenceClassTest<T, R> extends Named {
3570
3510
  samples: T[];
3571
3511
  expected: R;
3572
3512
  }
@@ -3608,12 +3548,11 @@ export interface StateTransitionTest<TState, TAction> {
3608
3548
  * };
3609
3549
  * ```
3610
3550
  */
3611
- export interface SnapshotTestCase<T> {
3612
- name: string;
3551
+ export interface SnapshotTestCase<T> extends Named {
3613
3552
  input: T;
3614
3553
  transform?: (input: T) => unknown;
3615
3554
  }
3616
- export interface CombinationTestOptions<T extends Record<string, unknown[]>> {
3555
+ export interface CombinationTestOptions<T extends Record<string, UnknownArray>> {
3617
3556
  filter?: (combination: TestCombination<T>) => boolean;
3618
3557
  maxCombinations?: number;
3619
3558
  }
@@ -3639,8 +3578,7 @@ export interface ParallaxElement {
3639
3578
  element: HTMLElement;
3640
3579
  speed: number;
3641
3580
  }
3642
- export interface SpringAnimationConfigTest {
3643
- name: string;
3581
+ export interface SpringAnimationConfigTest extends Named {
3644
3582
  tension: number;
3645
3583
  friction: number;
3646
3584
  mass: number;
@@ -3680,8 +3618,7 @@ export interface EnvironmentHooks {
3680
3618
  getManager: () => EnvironmentManager;
3681
3619
  useEnvironment: (env: EnvironmentConfig) => void;
3682
3620
  }
3683
- export interface EnvironmentValidationTestCase {
3684
- name: string;
3621
+ export interface EnvironmentValidationTestCase extends Named {
3685
3622
  environment: EnvironmentConfig;
3686
3623
  shouldPass: boolean;
3687
3624
  expectedErrors?: string[];
@@ -3692,49 +3629,39 @@ export interface EnvironmentFeatureFlagScenario {
3692
3629
  defaultValue?: boolean;
3693
3630
  expectedValue: boolean;
3694
3631
  }
3695
- export interface DatabaseEnvironmentTest {
3696
- name: string;
3632
+ export interface DatabaseEnvironmentTest extends Named {
3697
3633
  environment: EnvironmentConfig;
3698
- expectedConfig: Record<string, unknown>;
3634
+ expectedConfig: UnknownRecord;
3699
3635
  shouldConnect: boolean;
3700
3636
  }
3701
- export interface LoggingEnvironmentTest {
3702
- name: string;
3637
+ export interface LoggingEnvironmentTest extends Named {
3703
3638
  environment: EnvironmentConfig;
3704
3639
  expectedLevel: string;
3705
3640
  expectedFormat?: string;
3706
3641
  expectedTransports?: string[];
3707
3642
  }
3708
- export interface APIClientEnvironmentTest {
3709
- name: string;
3643
+ export interface APIClientEnvironmentTest extends Named {
3710
3644
  environment: EnvironmentConfig;
3711
3645
  expectedBaseURL: string;
3712
3646
  expectedTimeout: number;
3713
3647
  expectedHeaders?: Record<string, string>;
3714
3648
  }
3715
- export interface SecretsManagementTest {
3716
- name: string;
3649
+ export interface SecretsManagementTest extends Named {
3717
3650
  environment: EnvironmentConfig;
3718
3651
  secrets: Record<string, string>;
3719
3652
  expectedBehavior: 'store' | 'mock' | 'error';
3720
3653
  }
3721
- export interface SecretsManager {
3722
- get: (key: string) => Promise<string | undefined>;
3723
- set: (key: string, value: string) => Promise<void>;
3724
- delete: (key: string) => Promise<void>;
3654
+ export interface SecretsManager extends KeyValueStore<string, string> {
3725
3655
  }
3726
- export interface MockEnvironment {
3656
+ export interface MockEnvironment extends KeyValueStore<string, string> {
3727
3657
  update: (updates: EnvironmentConfig) => void;
3728
- get: (key: string) => string | undefined;
3729
- set: (key: string, value: string) => void;
3730
3658
  unset: (key: string) => void;
3731
3659
  restore: () => void;
3732
3660
  getAll: () => EnvironmentConfig;
3733
- clear: () => void;
3734
3661
  }
3735
3662
  export interface EnvironmentTransformationTestCase {
3736
3663
  input: EnvironmentConfig;
3737
- expectedOutput: Record<string, unknown>;
3664
+ expectedOutput: UnknownRecord;
3738
3665
  description: string;
3739
3666
  }
3740
3667
  export interface UserInteraction {
@@ -3754,7 +3681,7 @@ export interface AccessibilityReport {
3754
3681
  }
3755
3682
  export interface MockNextNavigationOptions {
3756
3683
  pathname?: string;
3757
- searchParams?: Record<string, string | string[]>;
3684
+ searchParams?: Record<string, Arrayable<string>>;
3758
3685
  push?: ReturnType<typeof Vitest.vi.fn>;
3759
3686
  replace?: ReturnType<typeof Vitest.vi.fn>;
3760
3687
  refresh?: ReturnType<typeof Vitest.vi.fn>;
@@ -3762,13 +3689,12 @@ export interface MockNextNavigationOptions {
3762
3689
  forward?: ReturnType<typeof Vitest.vi.fn>;
3763
3690
  }
3764
3691
  export interface SRTestOptions {
3765
- initialProps: Record<string, unknown>;
3692
+ initialProps: UnknownRecord;
3766
3693
  revalidate: number;
3767
- newProps: Record<string, unknown>;
3694
+ newProps: UnknownRecord;
3768
3695
  waitTime?: number;
3769
3696
  }
3770
- export interface ApiRouteTestScenario {
3771
- name: string;
3697
+ export interface ApiRouteTestScenario extends Named {
3772
3698
  request: Partial<MockNextApiRequest>;
3773
3699
  expectedStatus: number;
3774
3700
  expectedBody?: unknown;
@@ -3796,17 +3722,15 @@ export interface ApiAuthScenario {
3796
3722
  expectedStatus: number;
3797
3723
  expectedMessage?: string;
3798
3724
  }
3799
- export interface ApiRouteOptions {
3725
+ export interface ApiRouteOptions extends Partial<WithUrl> {
3800
3726
  method?: string;
3801
- url?: string;
3802
- headers?: Record<string, string | string[]>;
3803
- query?: Record<string, string | string[]>;
3727
+ headers?: Record<string, Arrayable<string>>;
3728
+ query?: Record<string, Arrayable<string>>;
3804
3729
  body?: unknown;
3805
3730
  cookies?: Record<string, string>;
3806
3731
  }
3807
- export interface ServerComponentTestScenario {
3808
- name: string;
3809
- props: Record<string, unknown>;
3732
+ export interface ServerComponentTestScenario extends Named {
3733
+ props: UnknownRecord;
3810
3734
  searchParams?: Record<string, string>;
3811
3735
  params?: Record<string, string>;
3812
3736
  expectedContent?: string | RegExp;
@@ -3823,7 +3747,7 @@ export interface ServerComponentTestScenario {
3823
3747
  * ```
3824
3748
  */
3825
3749
  export interface MiddlewareMatcherConfig {
3826
- matcher: string | string[];
3750
+ matcher: Arrayable<string>;
3827
3751
  }
3828
3752
  /**
3829
3753
  * Result from mocking Next.js navigation.
@@ -3957,7 +3881,7 @@ export interface ComponentWithLoading {
3957
3881
  * ```
3958
3882
  */
3959
3883
  export interface ConditionalRenderingTest {
3960
- props: Record<string, unknown>;
3884
+ props: UnknownRecord;
3961
3885
  shouldRender: string[];
3962
3886
  shouldNotRender: string[];
3963
3887
  }
@@ -3978,7 +3902,7 @@ export interface ProviderConfig {
3978
3902
  children: React.ReactNode;
3979
3903
  [key: string]: unknown;
3980
3904
  }>;
3981
- props?: Record<string, unknown>;
3905
+ props?: UnknownRecord;
3982
3906
  }
3983
3907
  /**
3984
3908
  * Test case for user interactions.
@@ -3993,8 +3917,7 @@ export interface ProviderConfig {
3993
3917
  * };
3994
3918
  * ```
3995
3919
  */
3996
- export interface UserInteractionTest {
3997
- name: string;
3920
+ export interface UserInteractionTest extends Named {
3998
3921
  action: (user: unknown) => Promise<void>;
3999
3922
  expectation: () => void;
4000
3923
  }
@@ -4048,8 +3971,7 @@ export interface ComponentTestSuiteResult {
4048
3971
  * };
4049
3972
  * ```
4050
3973
  */
4051
- export interface ResourceCleanupTest {
4052
- name: string;
3974
+ export interface ResourceCleanupTest extends Named {
4053
3975
  create: () => unknown;
4054
3976
  cleanup: (resource: unknown) => Promise<void> | void;
4055
3977
  isCleanedUp: (resource: unknown) => boolean;
@@ -4070,7 +3992,7 @@ export interface ResourceCleanupTest {
4070
3992
  export interface DependencyInjectionContainer {
4071
3993
  register: (token: unknown, factory: () => unknown, options: {
4072
3994
  lifecycle: 'singleton' | 'transient' | 'scoped';
4073
- dependencies?: unknown[];
3995
+ dependencies?: UnknownArray;
4074
3996
  }) => void;
4075
3997
  resolve: (token: unknown) => unknown;
4076
3998
  dispose: () => Promise<void>;
@@ -4093,7 +4015,7 @@ export interface DependencyInjectionContainer {
4093
4015
  export interface DependencyInjectionConfig {
4094
4016
  token: unknown;
4095
4017
  factory: () => unknown;
4096
- dependencies?: unknown[];
4018
+ dependencies?: UnknownArray;
4097
4019
  lifecycle: 'singleton' | 'transient' | 'scoped';
4098
4020
  cleanup?: (instance: unknown) => void;
4099
4021
  }
@@ -4112,10 +4034,8 @@ export interface DependencyInjectionConfig {
4112
4034
  * };
4113
4035
  * ```
4114
4036
  */
4115
- export interface AsyncLifecycleHook {
4116
- name: string;
4037
+ export interface AsyncLifecycleHook extends Named, Partial<WithTimeout> {
4117
4038
  method: string;
4118
- timeout?: number;
4119
4039
  shouldReject?: boolean;
4120
4040
  expectedError?: string | RegExp;
4121
4041
  }
@@ -4199,26 +4119,26 @@ export interface MockIntersectionObserverEntry {
4199
4119
  intersectionRatio: number;
4200
4120
  boundingClientRect: DOMRect;
4201
4121
  }
4202
- export type ConfigObject = Record<string, unknown>;
4122
+ export type ConfigObject = UnknownRecord;
4203
4123
  export type ConfigLoader = (env: string) => unknown;
4204
4124
  export type EnvironmentTransformer = (env: EnvironmentConfig) => ConfigObject;
4205
4125
  export type KeyboardUserInteraction = Pick<UserInteraction, 'keyboard'>;
4206
4126
  export type FocusUserInteraction = Required<Pick<UserInteraction, 'keyboard' | 'tab'>>;
4207
4127
  export type SkipLinkUserInteraction = Required<Pick<UserInteraction, 'click' | 'tab'>>;
4208
4128
  export type AccessibilityAttributesMap = Record<string, string>;
4209
- export type TestParameters = Record<string, unknown>;
4210
- export type TestMatrixInputs<T extends Record<string, unknown[]>> = {
4129
+ export type TestParameters = UnknownRecord;
4130
+ export type TestMatrixInputs<T extends Record<string, UnknownArray>> = {
4211
4131
  [K in keyof T]: T[K][];
4212
4132
  };
4213
- export type TestMatrixCombination<T extends Record<string, unknown[]>> = {
4133
+ export type TestMatrixCombination<T extends Record<string, UnknownArray>> = {
4214
4134
  [K in keyof T]: T[K][number];
4215
4135
  };
4216
- export type PartialTestMatrixCombination<T extends Record<string, unknown[]>> = Partial<{
4136
+ export type PartialTestMatrixCombination<T extends Record<string, UnknownArray>> = Partial<{
4217
4137
  [K in keyof T]: T[K][number];
4218
4138
  }>;
4219
- export type PropertyTestFunction<T> = (value: T) => boolean | Promise<boolean>;
4139
+ export type PropertyTestFunction<T> = (value: T) => Promisable<boolean>;
4220
4140
  export type StateTransitionApplyFunction<TState, TAction> = (state: TState, action: TAction) => TState;
4221
- export type CombinationTestFunction<T extends Record<string, unknown[]>> = (combination: TestCombination<T>) => void | Promise<void>;
4141
+ export type CombinationTestFunction<T extends Record<string, UnknownArray>> = (combination: TestCombination<T>) => Promisable<void>;
4222
4142
  export type UnknownFunction = (...args: unknown[]) => unknown;
4223
4143
  /**
4224
4144
  * Configuration for spy target.
@@ -4255,9 +4175,8 @@ export type ModuleMockFactories = Record<string, () => UnknownRecord>;
4255
4175
  * };
4256
4176
  * ```
4257
4177
  */
4258
- export interface TestCaseWithSetup<T> {
4259
- name: string;
4260
- args: unknown[];
4178
+ export interface TestCaseWithSetup<T> extends Named {
4179
+ args: UnknownArray;
4261
4180
  expected: unknown;
4262
4181
  setup?: (instance: T) => void;
4263
4182
  }
@@ -4277,8 +4196,7 @@ export interface TestCaseWithSetup<T> {
4277
4196
  * };
4278
4197
  * ```
4279
4198
  */
4280
- export interface LifecycleHookTestConfig<T> {
4281
- name: string;
4199
+ export interface LifecycleHookTestConfig<T> extends Named {
4282
4200
  hook: keyof T;
4283
4201
  expectedCalls?: number;
4284
4202
  expectError?: boolean;
@@ -4301,7 +4219,7 @@ export interface LifecycleHookTestConfig<T> {
4301
4219
  */
4302
4220
  export interface ErrorHandlingScenario<T> {
4303
4221
  method: keyof T;
4304
- args: unknown[];
4222
+ args: UnknownArray;
4305
4223
  expectedError: string | RegExp | typeof Error;
4306
4224
  setup?: (instance: T) => void;
4307
4225
  }
@@ -4484,7 +4402,7 @@ export interface ServiceTestHarnessReturn<T> {
4484
4402
  * ```
4485
4403
  */
4486
4404
  export interface DynamicModuleClass {
4487
- forRoot: (config: unknown) => Record<string, unknown>;
4405
+ forRoot: (config: unknown) => UnknownRecord;
4488
4406
  }
4489
4407
  /**
4490
4408
  * Expectations for dynamic module testing.
@@ -4500,9 +4418,9 @@ export interface DynamicModuleClass {
4500
4418
  * ```
4501
4419
  */
4502
4420
  export interface DynamicModuleExpectations {
4503
- providers?: unknown[];
4504
- imports?: unknown[];
4505
- exports?: unknown[];
4421
+ providers?: UnknownArray;
4422
+ imports?: UnknownArray;
4423
+ exports?: UnknownArray;
4506
4424
  }
4507
4425
  /**
4508
4426
  * Return value from NestJS test suite setup.
@@ -4538,8 +4456,8 @@ export interface NestJSTestSuiteSetupReturn {
4538
4456
  */
4539
4457
  export interface ProviderInjectionTest {
4540
4458
  token: unknown;
4541
- dependencies: unknown[];
4542
- testFn: (instance: unknown, deps: unknown[]) => void;
4459
+ dependencies: UnknownArray;
4460
+ testFn: (instance: unknown, deps: UnknownArray) => void;
4543
4461
  }
4544
4462
  /**
4545
4463
  * WebSocket ping message.
@@ -4638,10 +4556,9 @@ export interface ImageLoaderInput {
4638
4556
  * };
4639
4557
  * ```
4640
4558
  */
4641
- export interface UserFlowStep {
4642
- name: string;
4559
+ export interface UserFlowStep extends Named {
4643
4560
  interactions: InteractionSequence[];
4644
- assertions: () => void | Promise<void>;
4561
+ assertions: () => Promisable<void>;
4645
4562
  navigation?: {
4646
4563
  expectedUrl?: string;
4647
4564
  waitForNavigation?: boolean;
@@ -4690,8 +4607,8 @@ export interface MockNextRequestCreatorParams {
4690
4607
  */
4691
4608
  export interface ProviderInjection {
4692
4609
  token: unknown;
4693
- dependencies: unknown[];
4694
- testFn: (instance: unknown, deps: unknown[]) => void;
4610
+ dependencies: UnknownArray;
4611
+ testFn: (instance: unknown, deps: UnknownArray) => void;
4695
4612
  }
4696
4613
  /**
4697
4614
  * Mock Redis client interface.
@@ -4735,10 +4652,10 @@ export interface CreateMockRedisClientMock {
4735
4652
  * ```
4736
4653
  */
4737
4654
  export interface CallTracker {
4738
- trackCall: (name: string, args: unknown[]) => void;
4655
+ trackCall: (name: string, args: UnknownArray) => void;
4739
4656
  getCalls: (name?: string) => Array<{
4740
4657
  name: string;
4741
- args: unknown[];
4658
+ args: UnknownArray;
4742
4659
  timestamp: number;
4743
4660
  }>;
4744
4661
  reset: () => void;
@@ -4762,7 +4679,7 @@ export interface CallTracker {
4762
4679
  export interface TrackedSpy extends SpyInstance {
4763
4680
  getCallCount: () => number;
4764
4681
  getCallHistory: () => Array<{
4765
- args: unknown[];
4682
+ args: UnknownArray;
4766
4683
  result?: unknown;
4767
4684
  error?: unknown;
4768
4685
  }>;
@@ -4811,9 +4728,8 @@ export interface TrackedData<T> {
4811
4728
  * };
4812
4729
  * ```
4813
4730
  */
4814
- export interface AccessInfo {
4731
+ export interface AccessInfo extends WithTimestamp<number> {
4815
4732
  property: string | symbol;
4816
- timestamp: number;
4817
4733
  count: number;
4818
4734
  }
4819
4735
  /**
@@ -4985,8 +4901,8 @@ export interface WorkerTestHarness {
4985
4901
  * ```
4986
4902
  */
4987
4903
  export interface WorkerSpy {
4988
- getMessagesSent: () => unknown[];
4989
- getMessagesReceived: () => unknown[];
4904
+ getMessagesSent: () => UnknownArray;
4905
+ getMessagesReceived: () => UnknownArray;
4990
4906
  getErrors: () => Error[];
4991
4907
  isTerminated: () => boolean;
4992
4908
  simulateMessage: (message: unknown) => void;
@@ -5150,7 +5066,7 @@ export interface MonitorOptions {
5150
5066
  * };
5151
5067
  * ```
5152
5068
  */
5153
- export interface PerformanceMonitor {
5069
+ export interface PerformanceMonitor extends Resettable {
5154
5070
  start: () => void;
5155
5071
  stop: () => void;
5156
5072
  getMetrics: () => {
@@ -5158,7 +5074,6 @@ export interface PerformanceMonitor {
5158
5074
  memory?: number[];
5159
5075
  timestamps: number[];
5160
5076
  };
5161
- reset: () => void;
5162
5077
  }
5163
5078
  /**
5164
5079
  * Options for memory leak testing.
@@ -5217,10 +5132,9 @@ export interface LeakResult {
5217
5132
  * };
5218
5133
  * ```
5219
5134
  */
5220
- export interface HookScenario {
5221
- name: string;
5222
- action: () => void | Promise<void>;
5223
- expectedState: Record<string, unknown>;
5135
+ export interface HookScenario extends Named {
5136
+ action: () => Promisable<void>;
5137
+ expectedState: UnknownRecord;
5224
5138
  expectedError?: Error | null;
5225
5139
  }
5226
5140
  /**
@@ -5245,10 +5159,9 @@ export interface SuspenseOptions {
5245
5159
  * Concurrent rendering scenario
5246
5160
  * @interface ConcurrentScenario
5247
5161
  */
5248
- export interface ConcurrentScenario {
5249
- name: string;
5162
+ export interface ConcurrentScenario extends Named {
5250
5163
  priority: 'high' | 'low' | 'normal';
5251
- action: () => void | Promise<void>;
5164
+ action: () => Promisable<void>;
5252
5165
  expectedBehavior: () => void;
5253
5166
  }
5254
5167
  /**
@@ -5266,10 +5179,7 @@ export interface A11yOptions {
5266
5179
  * Accessibility violation
5267
5180
  * @interface A11yViolation
5268
5181
  */
5269
- export interface A11yViolation {
5270
- id: string;
5271
- impact?: 'minor' | 'moderate' | 'serious' | 'critical';
5272
- description: string;
5182
+ export interface A11yViolation extends Identifiable, Describable, Partial<WithImpact> {
5273
5183
  help: string;
5274
5184
  helpUrl: string;
5275
5185
  nodes: Array<{
@@ -5343,31 +5253,26 @@ export interface ContrastResult {
5343
5253
  * User session options
5344
5254
  * @interface SessionOptions
5345
5255
  */
5346
- export interface SessionOptions {
5347
- userId?: string;
5256
+ export interface SessionOptions extends Partial<WithUserId & WithLocale> {
5348
5257
  deviceType?: 'desktop' | 'mobile' | 'tablet';
5349
5258
  browser?: string;
5350
5259
  viewport?: {
5351
5260
  width: number;
5352
5261
  height: number;
5353
5262
  };
5354
- locale?: string;
5355
5263
  timezone?: string;
5356
5264
  }
5357
5265
  /**
5358
5266
  * User event session
5359
5267
  * @interface UserSession
5360
5268
  */
5361
- export interface UserSession {
5362
- id: string;
5363
- userId: string;
5269
+ export interface UserSession extends Identifiable, WithLocale, WithUserId {
5364
5270
  deviceType: 'desktop' | 'mobile' | 'tablet';
5365
5271
  browser: string;
5366
5272
  viewport: {
5367
5273
  width: number;
5368
5274
  height: number;
5369
5275
  };
5370
- locale: string;
5371
5276
  timezone: string;
5372
5277
  startTime: Date;
5373
5278
  interactions: Interaction[];
@@ -5397,8 +5302,7 @@ export interface TypeOptions {
5397
5302
  * Drag options
5398
5303
  * @interface DragOptions
5399
5304
  */
5400
- export interface DragOptions {
5401
- duration?: number;
5305
+ export interface DragOptions extends Partial<WithDuration> {
5402
5306
  steps?: number;
5403
5307
  dropEffect?: 'move' | 'copy' | 'link' | 'none';
5404
5308
  }
@@ -5439,24 +5343,20 @@ export type TouchGestureAdvanced = {
5439
5343
  * User interaction record
5440
5344
  * @interface Interaction
5441
5345
  */
5442
- export interface Interaction {
5443
- timestamp: Date;
5346
+ export interface Interaction extends WithTimestamp<Date>, WithDuration {
5444
5347
  type: string;
5445
5348
  target: string;
5446
5349
  data?: unknown;
5447
- duration?: number;
5448
5350
  }
5449
5351
  /**
5450
5352
  * Swipe gesture parameters
5451
5353
  * @interface SwipeGestureParams
5452
5354
  */
5453
- export interface SwipeGestureParams {
5454
- element: Element;
5355
+ export interface SwipeGestureParams extends WithElement<Element>, WithDuration {
5455
5356
  startX: number;
5456
5357
  startY: number;
5457
5358
  endX: number;
5458
5359
  endY: number;
5459
- duration: number;
5460
5360
  }
5461
5361
  /**
5462
5362
  * Pinch gesture parameters
@@ -5473,8 +5373,7 @@ export interface PinchGestureParams {
5473
5373
  * Animation frame data
5474
5374
  * @interface Frame
5475
5375
  */
5476
- export interface Frame {
5477
- timestamp: number;
5376
+ export interface Frame extends WithTimestamp<number> {
5478
5377
  styles: Record<string, string>;
5479
5378
  }
5480
5379
  /**
@@ -5509,9 +5408,7 @@ export interface RAFMock {
5509
5408
  * Interval handle
5510
5409
  * @interface IntervalHandle
5511
5410
  */
5512
- export interface IntervalHandle {
5513
- stop: () => void;
5514
- isRunning: () => boolean;
5411
+ export interface IntervalHandle extends Pick<IntervalControl, 'stop' | 'isRunning'> {
5515
5412
  }
5516
5413
  /**
5517
5414
  * Schedule handle
@@ -5594,25 +5491,24 @@ export interface MockLocation {
5594
5491
  * @interface RouteExpectation
5595
5492
  */
5596
5493
  export interface RouteExpectation {
5597
- params?: Record<string, string | string[]>;
5598
- query?: Record<string, string | string[]>;
5599
- beforeTransition?: () => void | Promise<void>;
5600
- afterTransition?: () => void | Promise<void>;
5494
+ params?: Record<string, Arrayable<string>>;
5495
+ query?: Record<string, Arrayable<string>>;
5496
+ beforeTransition?: () => Promisable<void>;
5497
+ afterTransition?: () => Promisable<void>;
5601
5498
  }
5602
5499
  /**
5603
5500
  * Route guard configuration
5604
5501
  * @interface RouteGuard
5605
5502
  */
5606
5503
  export interface RouteGuard {
5607
- canActivate?: (to: string, from: string) => boolean | Promise<boolean>;
5608
- canDeactivate?: (from: string, to: string) => boolean | Promise<boolean>;
5504
+ canActivate?: (to: string, from: string) => Promisable<boolean>;
5505
+ canDeactivate?: (from: string, to: string) => Promisable<boolean>;
5609
5506
  }
5610
5507
  /**
5611
5508
  * Guard scenario for testing
5612
5509
  * @interface GuardScenario
5613
5510
  */
5614
- export interface GuardScenario {
5615
- name: string;
5511
+ export interface GuardScenario extends Named {
5616
5512
  from: string;
5617
5513
  to: string;
5618
5514
  shouldAllow: boolean;
@@ -5654,7 +5550,7 @@ export interface NextTestContext {
5654
5550
  */
5655
5551
  export interface SSPContext extends Partial<MockGetServerSidePropsContext> {
5656
5552
  scenario?: string;
5657
- expectedProps?: Record<string, unknown>;
5553
+ expectedProps?: UnknownRecord;
5658
5554
  expectedRedirect?: {
5659
5555
  destination: string;
5660
5556
  permanent?: boolean;
@@ -5667,7 +5563,7 @@ export interface SSPContext extends Partial<MockGetServerSidePropsContext> {
5667
5563
  */
5668
5564
  export interface SPContext extends Partial<MockGetStaticPropsContext> {
5669
5565
  scenario?: string;
5670
- expectedProps?: Record<string, unknown>;
5566
+ expectedProps?: UnknownRecord;
5671
5567
  expectedRevalidate?: number;
5672
5568
  expectedRedirect?: {
5673
5569
  destination: string;
@@ -5679,12 +5575,8 @@ export interface SPContext extends Partial<MockGetStaticPropsContext> {
5679
5575
  * API request test configuration
5680
5576
  * @interface APIRequest
5681
5577
  */
5682
- export interface APIRequest {
5578
+ export interface APIRequest extends Partial<WithHttpMethod>, Partial<WithHeaders>, Partial<WithBody>, Partial<WithQueryParams> {
5683
5579
  scenario?: string;
5684
- method?: string;
5685
- headers?: Record<string, string>;
5686
- body?: unknown;
5687
- query?: Record<string, string>;
5688
5580
  cookies?: Record<string, string>;
5689
5581
  expectedStatus?: number;
5690
5582
  expectedBody?: unknown;
@@ -5694,23 +5586,21 @@ export interface APIRequest {
5694
5586
  * Lifecycle testing scenario
5695
5587
  * @interface LifecycleScenario
5696
5588
  */
5697
- export interface LifecycleScenario {
5698
- name: string;
5699
- action: () => void | Promise<void>;
5700
- expectedState?: Record<string, unknown>;
5589
+ export interface LifecycleScenario extends Named {
5590
+ action: () => Promisable<void>;
5591
+ expectedState?: UnknownRecord;
5701
5592
  expectedEvents?: string[];
5702
5593
  }
5703
5594
  /**
5704
5595
  * Lifecycle event tracker
5705
5596
  * @interface LifecycleTracker
5706
5597
  */
5707
- export interface LifecycleTracker {
5598
+ export interface LifecycleTracker extends Clearable {
5708
5599
  events: Array<{
5709
5600
  type: string;
5710
5601
  timestamp: number;
5711
5602
  data?: unknown;
5712
5603
  }>;
5713
- clear: () => void;
5714
5604
  getEvents: () => Array<{
5715
5605
  type: string;
5716
5606
  timestamp: number;
@@ -5794,9 +5684,8 @@ export interface EnvMock {
5794
5684
  * Environment snapshot
5795
5685
  * @interface EnvSnapshot
5796
5686
  */
5797
- export interface EnvSnapshot {
5687
+ export interface EnvSnapshot extends WithKeyValues<string | undefined>, WithTimestamp<number> {
5798
5688
  variables: Record<string, string | undefined>;
5799
- timestamp: number;
5800
5689
  }
5801
5690
  /**
5802
5691
  * System signal type
@@ -5807,13 +5696,13 @@ export type Signal = 'SIGTERM' | 'SIGINT' | 'SIGHUP' | 'SIGUSR1' | 'SIGUSR2';
5807
5696
  * Signal handler function
5808
5697
  * @type SignalHandler
5809
5698
  */
5810
- export type SignalHandler = (signal: Signal) => void | Promise<void>;
5699
+ export type SignalHandler = (signal: Signal) => Promisable<void>;
5811
5700
  /**
5812
5701
  * Component type for lifecycle testing
5813
5702
  * @type ComponentType
5814
5703
  * @typeParam P - Props type
5815
5704
  */
5816
- export type ComponentType<P = Record<string, unknown>> = new (props: P) => React.Component<P>;
5705
+ export type ComponentType<P = UnknownRecord> = new (props: P) => React.Component<P>;
5817
5706
  /**
5818
5707
  * Next.js Get Server-Side Props function
5819
5708
  * @type GSSP
@@ -5857,7 +5746,7 @@ export interface PipelineResult {
5857
5746
  export interface ModuleMocks {
5858
5747
  restore: () => void;
5859
5748
  getCallCount: (moduleName: string) => number;
5860
- getLastCall: (moduleName: string) => unknown[];
5749
+ getLastCall: (moduleName: string) => UnknownArray;
5861
5750
  }
5862
5751
  /**
5863
5752
  * Async hook interface