@plyaz/types 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -271,7 +271,7 @@ export interface RetryOptions {
271
271
  */
272
272
  export interface MockAsync<T = void> {
273
273
  /** The mock function that returns promises */
274
- mock: Vitest.MockInstance;
274
+ mock: Vitest.Mock;
275
275
  /** Resolve the next pending promise with a value */
276
276
  resolve: (value: T) => void;
277
277
  /** Reject the next pending promise with an error */
@@ -555,19 +555,70 @@ export interface PollingTestOptions {
555
555
  /** Callback invoked after each poll */
556
556
  onPoll?: (attempt: number, result: unknown) => void;
557
557
  }
558
+ /**
559
+ * Manages cleanup tasks during testing.
560
+ * Ensures proper resource disposal after tests.
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * const cleanup: TestCleanup = {
565
+ * add: (fn) => cleanupTasks.push(fn),
566
+ * runAll: async () => {
567
+ * for (const task of cleanupTasks) {
568
+ * await task();
569
+ * }
570
+ * },
571
+ * clear: () => { cleanupTasks = []; }
572
+ * };
573
+ * ```
574
+ */
558
575
  export interface TestCleanup {
559
576
  add: (cleanup: () => void | Promise<void>) => void;
560
577
  runAll: () => Promise<void>;
561
578
  clear: () => void;
562
579
  }
580
+ /**
581
+ * Mock console interface for capturing console output.
582
+ * Provides methods to intercept and restore console methods.
583
+ *
584
+ * @example
585
+ * ```typescript
586
+ * const mockConsole: MockConsole = {
587
+ * log: vi.fn(),
588
+ * error: vi.fn(),
589
+ * warn: vi.fn(),
590
+ * info: vi.fn(),
591
+ * debug: vi.fn(),
592
+ * restore: () => {
593
+ * console.log = originalLog;
594
+ * console.error = originalError;
595
+ * }
596
+ * };
597
+ * ```
598
+ */
563
599
  export interface MockConsole {
564
- log: Vitest.MockInstance;
565
- error: Vitest.MockInstance;
566
- warn: Vitest.MockInstance;
567
- info: Vitest.MockInstance;
568
- debug: Vitest.MockInstance;
600
+ log: Vitest.Mock;
601
+ error: Vitest.Mock;
602
+ warn: Vitest.Mock;
603
+ info: Vitest.Mock;
604
+ debug: Vitest.Mock;
569
605
  restore: () => void;
570
606
  }
607
+ /**
608
+ * Mock environment variables for testing.
609
+ * Allows safe modification and restoration of process.env.
610
+ *
611
+ * @example
612
+ * ```typescript
613
+ * const mockEnv: MockEnv = {
614
+ * set: (key, value) => { process.env[key] = value; },
615
+ * get: (key) => process.env[key],
616
+ * delete: (key) => { delete process.env[key]; },
617
+ * clear: () => { // Clear all },
618
+ * restore: () => { // Restore original }
619
+ * };
620
+ * ```
621
+ */
571
622
  export interface MockEnv {
572
623
  set: (key: string, value: string) => void;
573
624
  get: (key: string) => string | undefined;
@@ -575,6 +626,28 @@ export interface MockEnv {
575
626
  clear: () => void;
576
627
  restore: () => void;
577
628
  }
629
+ /**
630
+ * Generic data cleanup manager for test data.
631
+ * Handles cleanup of created test resources.
632
+ *
633
+ * @template T - Type of data being cleaned up
634
+ *
635
+ * @example
636
+ * ```typescript
637
+ * const dataCleanup: TestDataCleanup<User> = {
638
+ * addResource: (user) => resources.push(user),
639
+ * cleanup: async (resource) => {
640
+ * await userService.delete(resource.id);
641
+ * },
642
+ * cleanupAll: async () => {
643
+ * for (const user of resources) {
644
+ * await userService.delete(user.id);
645
+ * }
646
+ * },
647
+ * reset: () => { resources = []; }
648
+ * };
649
+ * ```
650
+ */
578
651
  export interface TestDataCleanup<T> {
579
652
  register: (data: T) => T;
580
653
  cleanup: () => Promise<void>;
@@ -583,6 +656,22 @@ export interface TestDataCleanup<T> {
583
656
  export type RenderOptions = RTLRenderOptions;
584
657
  export type RenderHookOptions<TProps> = RTLRenderHookOptions<TProps>;
585
658
  export type SpyInstance = Vitest.MockedFunction<(...args: unknown[]) => unknown>;
659
+ /**
660
+ * Options for performance benchmarking.
661
+ * Configures benchmark execution parameters.
662
+ *
663
+ * @example
664
+ * ```typescript
665
+ * const benchmarkOptions: BenchmarkOptions = {
666
+ * iterations: 10000,
667
+ * warmup: 100,
668
+ * minTime: 1000, // Run for at least 1 second
669
+ * maxTime: 5000, // Stop after 5 seconds
670
+ * runs: 5,
671
+ * format: 'table'
672
+ * };
673
+ * ```
674
+ */
586
675
  export interface BenchmarkOptions {
587
676
  iterations?: number;
588
677
  time?: number;
@@ -592,6 +681,19 @@ export interface BenchmarkOptions {
592
681
  runs?: number;
593
682
  format?: 'table' | 'json';
594
683
  }
684
+ /**
685
+ * Configuration for test bed setup.
686
+ * Defines module dependencies and providers for testing.
687
+ *
688
+ * @example
689
+ * ```typescript
690
+ * const testBedConfig: TestBedConfig = {
691
+ * providers: [UserService, AuthService],
692
+ * imports: [HttpModule, ConfigModule],
693
+ * exports: [UserService]
694
+ * };
695
+ * ```
696
+ */
595
697
  export interface TestBedConfig {
596
698
  providers: Provider[];
597
699
  imports?: unknown[];
@@ -610,6 +712,24 @@ export interface ValidateMiddlwareResponseExpected {
610
712
  url?: string;
611
713
  status?: number;
612
714
  }
715
+ /**
716
+ * Options for creating service test harness.
717
+ * Configures mock providers and dependencies.
718
+ *
719
+ * @template T - Type of service being tested
720
+ *
721
+ * @example
722
+ * ```typescript
723
+ * const options: ServiceTestHarnessOptions<UserService> = {
724
+ * mockProviders: [
725
+ * { provide: DatabaseService, useValue: mockDb },
726
+ * { provide: CacheService, useValue: mockCache }
727
+ * ],
728
+ * spyMethods: ['create', 'update', 'delete'],
729
+ * mockLogger: true
730
+ * };
731
+ * ```
732
+ */
613
733
  export interface ServiceTestHarnessOptions<T> {
614
734
  Service: Type<T>;
615
735
  dependencies?: Array<{
@@ -633,6 +753,22 @@ export interface NextPageTestOptions extends RenderOptions {
633
753
  }
634
754
  export type NextApiRequest = NextJSApiRequest;
635
755
  export type NextApiResponse = NextJSApiResponse;
756
+ /**
757
+ * Test context for API route handlers.
758
+ * Provides utilities for testing Next.js API routes.
759
+ *
760
+ * @example
761
+ * ```typescript
762
+ * const context: ApiRouteTestContext = {
763
+ * req: createMockRequest({ method: 'POST', body: { name: 'Test' } }),
764
+ * res: createMockResponse(),
765
+ * expectStatus: (code) => expect(res.status).toHaveBeenCalledWith(code),
766
+ * expectJson: (data) => expect(res.json).toHaveBeenCalledWith(data),
767
+ * expectRedirect: (url) => expect(res.redirect).toHaveBeenCalledWith(url),
768
+ * expectHeader: (name, value) => expect(res.setHeader).toHaveBeenCalledWith(name, value)
769
+ * };
770
+ * ```
771
+ */
636
772
  export interface ApiRouteTestContext {
637
773
  req: NextApiRequest;
638
774
  res: NextApiResponse;
@@ -641,6 +777,23 @@ export interface ApiRouteTestContext {
641
777
  expectRedirect: (url: string, status?: number) => void;
642
778
  expectHeader: (name: string, value: string | string[]) => void;
643
779
  }
780
+ /**
781
+ * Test context for middleware functions.
782
+ * Provides utilities for testing Express/Next.js middleware.
783
+ *
784
+ * @example
785
+ * ```typescript
786
+ * const context: MiddlewareTestContext = {
787
+ * req: createMockRequest(),
788
+ * res: createMockResponse(),
789
+ * next: vi.fn(),
790
+ * expectStatus: (code) => expect(res.status).toHaveBeenCalledWith(code),
791
+ * expectRedirect: (url) => expect(res.redirect).toHaveBeenCalledWith(url),
792
+ * expectHeader: (name, value) => expect(res.setHeader).toHaveBeenCalledWith(name, value),
793
+ * expectNext: () => expect(next).toHaveBeenCalled()
794
+ * };
795
+ * ```
796
+ */
644
797
  export interface MiddlewareTestContext {
645
798
  request: Request;
646
799
  event: {
@@ -666,6 +819,23 @@ export interface UserEventConfig {
666
819
  skipAutoClose?: boolean;
667
820
  writeToClipboard?: boolean;
668
821
  }
822
+ /**
823
+ * Sequence of user interactions for testing.
824
+ * Defines ordered actions to simulate user behavior.
825
+ *
826
+ * @example
827
+ * ```typescript
828
+ * const sequence: InteractionSequence = {
829
+ * steps: [
830
+ * { type: 'click', target: '#login-btn' },
831
+ * { type: 'type', target: '#username', text: 'testuser' },
832
+ * { type: 'type', target: '#password', text: 'pass123' },
833
+ * { type: 'press', key: 'Enter' },
834
+ * { type: 'wait', duration: 1000 }
835
+ * ]
836
+ * };
837
+ * ```
838
+ */
669
839
  export interface InteractionSequence {
670
840
  type: 'click' | 'type' | 'select' | 'check' | 'focus' | 'blur' | 'hover' | 'key' | 'paste' | 'clear' | 'upload' | 'drag' | 'scroll' | 'wait' | 'tab' | 'keyboard';
671
841
  target?: string | HTMLElement;
@@ -807,6 +977,24 @@ export interface WaitForChangeOptions<T> {
807
977
  interval?: number;
808
978
  compareFn?: (a: T, b: T) => boolean;
809
979
  }
980
+ /**
981
+ * Performance metrics from test runs.
982
+ * Contains statistical data about execution performance.
983
+ *
984
+ * @example
985
+ * ```typescript
986
+ * const metrics: PerformanceMetrics = {
987
+ * mean: 25.5,
988
+ * median: 24,
989
+ * stdDev: 3.2,
990
+ * min: 18,
991
+ * max: 45,
992
+ * p95: 35,
993
+ * p99: 42,
994
+ * runs: [22, 24, 18, 25, 28, 45, 23, 24, 26, 21]
995
+ * };
996
+ * ```
997
+ */
810
998
  export interface PerformanceMetrics {
811
999
  min: number;
812
1000
  max: number;
@@ -841,6 +1029,23 @@ export interface LoadTestStats {
841
1029
  latencies: number[];
842
1030
  errors: Error[];
843
1031
  }
1032
+ /**
1033
+ * Results from load testing operations.
1034
+ * Contains throughput and performance data under load.
1035
+ *
1036
+ * @example
1037
+ * ```typescript
1038
+ * const loadTestResult: LoadTestResult = {
1039
+ * totalRequests: 10000,
1040
+ * successfulRequests: 9950,
1041
+ * failedRequests: 50,
1042
+ * averageLatency: 125,
1043
+ * p95Latency: 250,
1044
+ * throughput: 400, // requests per second
1045
+ * errors: [new Error('Connection timeout')]
1046
+ * };
1047
+ * ```
1048
+ */
844
1049
  export interface LoadTestResult {
845
1050
  totalRequests: number;
846
1051
  successfulRequests: number;
@@ -881,6 +1086,20 @@ export interface PerformanceComparisonInput<T> {
881
1086
  name: string;
882
1087
  value: T;
883
1088
  }
1089
+ /**
1090
+ * Memory measurement data from profiling.
1091
+ * Tracks memory usage before, after, and peak consumption.
1092
+ *
1093
+ * @example
1094
+ * ```typescript
1095
+ * const measurement: MemoryMeasurement = {
1096
+ * before: 50 * 1024 * 1024, // 50MB
1097
+ * after: 55 * 1024 * 1024, // 55MB
1098
+ * delta: 5 * 1024 * 1024, // 5MB increase
1099
+ * peak: 60 * 1024 * 1024 // 60MB peak
1100
+ * };
1101
+ * ```
1102
+ */
884
1103
  export interface MemoryMeasurement {
885
1104
  before: number;
886
1105
  after: number;
@@ -926,6 +1145,22 @@ export interface WebSocketServerMockOptions {
926
1145
  host?: string;
927
1146
  maxClients?: number;
928
1147
  }
1148
+ /**
1149
+ * Test scenario for WebSocket connections.
1150
+ * Defines connection behavior and message expectations.
1151
+ *
1152
+ * @example
1153
+ * ```typescript
1154
+ * const scenario: WebSocketTestScenario = {
1155
+ * url: 'ws://localhost:8080',
1156
+ * messages: ['ping', { type: 'subscribe', channel: 'updates' }],
1157
+ * expectedMessages: ['pong', { type: 'data', payload: {} }],
1158
+ * timeout: 5000,
1159
+ * shouldReconnect: true,
1160
+ * shouldError: false
1161
+ * };
1162
+ * ```
1163
+ */
929
1164
  export interface WebSocketTestScenario {
930
1165
  name: string;
931
1166
  message: unknown;
@@ -940,6 +1175,25 @@ export interface WebSocketConnectionOptions {
940
1175
  headers?: Record<string, string>;
941
1176
  timeout?: number;
942
1177
  }
1178
+ /**
1179
+ * Test configuration for file operations.
1180
+ * Defines expected file system state after operations.
1181
+ *
1182
+ * @example
1183
+ * ```typescript
1184
+ * const fileTest: FileOperationTest = {
1185
+ * operation: async () => {
1186
+ * await fs.writeFile('test.txt', 'content');
1187
+ * await fs.rename('test.txt', 'renamed.txt');
1188
+ * },
1189
+ * expectedFiles: new Map([
1190
+ * ['renamed.txt', 'content'],
1191
+ * ['log.txt', Buffer.from('log data')]
1192
+ * ]),
1193
+ * expectedError: undefined
1194
+ * };
1195
+ * ```
1196
+ */
943
1197
  export interface FileOperationTest {
944
1198
  name: string;
945
1199
  operation: (fs: unknown) => void | Promise<void>;
@@ -950,6 +1204,24 @@ export interface SignalTest {
950
1204
  signal: string;
951
1205
  expectedBehavior: () => void;
952
1206
  }
1207
+ /**
1208
+ * ARIA attributes for accessibility testing.
1209
+ * Defines accessibility properties for elements.
1210
+ *
1211
+ * @example
1212
+ * ```typescript
1213
+ * const ariaAttrs: AriaAttributes = {
1214
+ * 'aria-label': 'Submit form',
1215
+ * 'aria-describedby': 'form-help',
1216
+ * 'aria-required': 'true',
1217
+ * 'aria-invalid': 'false',
1218
+ * 'aria-expanded': 'false',
1219
+ * 'aria-hidden': 'false',
1220
+ * role: 'button',
1221
+ * tabIndex: 0
1222
+ * };
1223
+ * ```
1224
+ */
953
1225
  export interface AriaAttributes {
954
1226
  ariaLabel?: string;
955
1227
  ariaLabelledby?: string;
@@ -987,6 +1259,26 @@ export interface LifecycleHook {
987
1259
  required?: boolean;
988
1260
  async?: boolean;
989
1261
  }
1262
+ /**
1263
+ * Test configuration for component lifecycle.
1264
+ * Defines expected lifecycle hook sequences.
1265
+ *
1266
+ * @example
1267
+ * ```typescript
1268
+ * const lifecycleTest: ComponentLifecycleTest = {
1269
+ * component: UserProfile,
1270
+ * props: { userId: '123' },
1271
+ * expectedLifecycle: ['constructor', 'componentDidMount', 'render'],
1272
+ * actions: [
1273
+ * {
1274
+ * type: 'update',
1275
+ * props: { userId: '456' },
1276
+ * expectedHooksAfter: ['componentDidUpdate', 'render']
1277
+ * }
1278
+ * ]
1279
+ * };
1280
+ * ```
1281
+ */
990
1282
  export interface ComponentLifecycleTest {
991
1283
  name: string;
992
1284
  Component: React.ComponentType<unknown>;
@@ -1033,6 +1325,24 @@ export interface ApplicationLifecycleTest {
1033
1325
  expectedStartupSequence: string[];
1034
1326
  expectedShutdownSequence: string[];
1035
1327
  }
1328
+ /**
1329
+ * Configuration for test suite setup.
1330
+ * Defines shared setup and teardown for test groups.
1331
+ *
1332
+ * @template T - Type of test context data
1333
+ *
1334
+ * @example
1335
+ * ```typescript
1336
+ * const config: TestSuiteConfig<TestContext> = {
1337
+ * name: 'UserService Tests',
1338
+ * context: () => ({ db: null, service: null }),
1339
+ * setupBeforeAll: async () => { await db.connect(); },
1340
+ * setupBeforeEach: async () => { await db.clear(); },
1341
+ * teardownAfterEach: async () => { await db.rollback(); },
1342
+ * teardownAfterAll: async () => { await db.disconnect(); }
1343
+ * };
1344
+ * ```
1345
+ */
1036
1346
  export interface TestSuiteConfig<T> {
1037
1347
  name: string;
1038
1348
  createInstance: () => T;
@@ -1063,6 +1373,23 @@ export interface KeyframeTest {
1063
1373
  percentage: number;
1064
1374
  styles: Record<string, string>;
1065
1375
  }
1376
+ /**
1377
+ * Sequence of animation steps for testing.
1378
+ * Defines keyframes and timing for animations.
1379
+ *
1380
+ * @example
1381
+ * ```typescript
1382
+ * const sequence: AnimationSequence = {
1383
+ * name: 'slideIn',
1384
+ * duration: 500,
1385
+ * iterations: 1,
1386
+ * steps: [
1387
+ * { time: 0, styles: { opacity: 0, transform: 'translateX(-100%)' } },
1388
+ * { time: 500, styles: { opacity: 1, transform: 'translateX(0)' }, easing: 'ease-out' }
1389
+ * ]
1390
+ * };
1391
+ * ```
1392
+ */
1066
1393
  export interface AnimationSequence {
1067
1394
  name: string;
1068
1395
  steps: Array<{
@@ -1149,10 +1476,10 @@ export interface MockCallResult {
1149
1476
  error?: unknown;
1150
1477
  }
1151
1478
  export interface FileWatcher extends MockEventEmitter {
1152
- add: Vitest.MockInstance;
1153
- unwatch: Vitest.MockInstance;
1154
- close: Vitest.MockInstance;
1155
- getWatched: Vitest.MockInstance;
1479
+ add: Vitest.Mock;
1480
+ unwatch: Vitest.Mock;
1481
+ close: Vitest.Mock;
1482
+ getWatched: Vitest.Mock;
1156
1483
  simulateChange: (path: string) => void;
1157
1484
  simulateAdd: (path: string) => void;
1158
1485
  simulateUnlink: (path: string) => void;
@@ -1197,9 +1524,9 @@ export interface MockNextRequest {
1197
1524
  href: string;
1198
1525
  };
1199
1526
  cookies: {
1200
- get: Vitest.MockInstance;
1201
- set: Vitest.MockInstance;
1202
- delete: Vitest.MockInstance;
1527
+ get: Vitest.Mock;
1528
+ set: Vitest.Mock;
1529
+ delete: Vitest.Mock;
1203
1530
  };
1204
1531
  geo: {
1205
1532
  city: string;
@@ -1211,24 +1538,24 @@ export interface MockNextRequest {
1211
1538
  }
1212
1539
  export interface MockNextResponse {
1213
1540
  cookies: {
1214
- set: Vitest.MockInstance;
1215
- delete: Vitest.MockInstance;
1541
+ set: Vitest.Mock;
1542
+ delete: Vitest.Mock;
1216
1543
  };
1217
1544
  headers: Headers;
1218
1545
  status: number;
1219
- redirect: Vitest.MockInstance;
1220
- rewrite: Vitest.MockInstance;
1221
- next: Vitest.MockInstance;
1222
- json: Vitest.MockInstance;
1546
+ redirect: Vitest.Mock;
1547
+ rewrite: Vitest.Mock;
1548
+ next: Vitest.Mock;
1549
+ json: Vitest.Mock;
1223
1550
  }
1224
1551
  export interface MockWebSocketServer extends MockEventEmitter {
1225
1552
  clients: Set<CreateMockWebSocketReturn>;
1226
1553
  port: number;
1227
1554
  host: string;
1228
1555
  maxClients: number;
1229
- handleUpgrade: Vitest.MockInstance;
1230
- shouldHandle: Vitest.MockInstance;
1231
- close: Vitest.MockInstance;
1556
+ handleUpgrade: Vitest.Mock;
1557
+ shouldHandle: Vitest.Mock;
1558
+ close: Vitest.Mock;
1232
1559
  addClient: (client: CreateMockWebSocketReturn) => void;
1233
1560
  removeClient: (client: CreateMockWebSocketReturn) => void;
1234
1561
  simulateConnection: (clientId?: string) => CreateMockWebSocketReturn;
@@ -1409,6 +1736,25 @@ export type LoadingResult = {
1409
1736
  current: LoadingState;
1410
1737
  };
1411
1738
  };
1739
+ /**
1740
+ * Table-driven test case definition.
1741
+ * Defines input and expected output for parameterized tests.
1742
+ *
1743
+ * @template TInput - Type of test input
1744
+ * @template TExpected - Type of expected output
1745
+ *
1746
+ * @example
1747
+ * ```typescript
1748
+ * const testCase: TableTestCase<number, string> = {
1749
+ * name: 'converts positive number',
1750
+ * input: 42,
1751
+ * expected: 'forty-two',
1752
+ * only: false,
1753
+ * skip: false,
1754
+ * error: false
1755
+ * };
1756
+ * ```
1757
+ */
1412
1758
  export interface TableTestCase<TInput, TExpected> {
1413
1759
  name: string;
1414
1760
  input: TInput;
@@ -1961,40 +2307,35 @@ export interface ProviderInjection {
1961
2307
  testFn: (instance: unknown, deps: unknown[]) => void;
1962
2308
  }
1963
2309
  export interface CreateMockRedisClientMock {
1964
- set: Vitest.MockInstance;
1965
- get: Vitest.MockInstance;
1966
- del: Vitest.MockInstance;
1967
- keys: Vitest.MockInstance;
1968
- quit: Vitest.MockInstance;
1969
- on: Vitest.MockInstance;
1970
- multi: Vitest.MockInstance;
1971
- ping: Vitest.MockInstance;
2310
+ set: Vitest.Mock;
2311
+ get: Vitest.Mock;
2312
+ del: Vitest.Mock;
2313
+ keys: Vitest.Mock;
2314
+ quit: Vitest.Mock;
2315
+ on: Vitest.Mock;
2316
+ multi: Vitest.Mock;
2317
+ ping: Vitest.Mock;
1972
2318
  }
1973
2319
  /**
1974
2320
  * Call tracker interface
1975
2321
  * @interface CallTracker
1976
2322
  */
1977
2323
  export interface CallTracker {
1978
- /** Track function call */
1979
2324
  trackCall: (name: string, args: unknown[]) => void;
1980
- /** Get calls */
1981
2325
  getCalls: (name?: string) => Array<{
1982
2326
  name: string;
1983
2327
  args: unknown[];
1984
2328
  timestamp: number;
1985
2329
  }>;
1986
- /** Reset tracker */
1987
2330
  reset: () => void;
1988
2331
  }
1989
2332
  /**
1990
2333
  * Tracked spy with additional properties
1991
2334
  * @interface TrackedSpy
1992
- * @extends SpyInstance from @plyaz/types/testing
2335
+ * @extends SpyInstance
1993
2336
  */
1994
2337
  export interface TrackedSpy extends SpyInstance {
1995
- /** Get call count */
1996
2338
  getCallCount: () => number;
1997
- /** Get call history */
1998
2339
  getCallHistory: () => Array<{
1999
2340
  args: unknown[];
2000
2341
  result?: unknown;
@@ -2014,9 +2355,7 @@ export type SpyMap<T> = {
2014
2355
  * @typeParam T - Type of tracked data
2015
2356
  */
2016
2357
  export interface TrackedData<T> {
2017
- /** Data being tracked */
2018
2358
  data: T;
2019
- /** Access history */
2020
2359
  accesses: Array<{
2021
2360
  property: string | symbol;
2022
2361
  timestamp: number;
@@ -2027,11 +2366,8 @@ export interface TrackedData<T> {
2027
2366
  * @interface AccessInfo
2028
2367
  */
2029
2368
  export interface AccessInfo {
2030
- /** Property being accessed */
2031
2369
  property: string | symbol;
2032
- /** Access timestamp */
2033
2370
  timestamp: number;
2034
- /** Access count */
2035
2371
  count: number;
2036
2372
  }
2037
2373
  /**
@@ -2039,29 +2375,21 @@ export interface AccessInfo {
2039
2375
  * @interface WorkerLike
2040
2376
  */
2041
2377
  export interface WorkerLike {
2042
- /** Error handler */
2043
2378
  onError?: (error: Error) => void;
2044
- /** Error event handler */
2045
2379
  onerror?: (error: Error | ErrorEvent) => void;
2046
- /** Event emitter */
2047
2380
  emit?: (event: string, data: unknown) => void;
2048
- /** Post message */
2049
2381
  postMessage?: (message: unknown) => void;
2050
- /** Event listener */
2051
2382
  on?: {
2052
2383
  (event: 'message', handler: (data: unknown) => void): void;
2053
2384
  (event: 'error', handler: (error: unknown) => void): void;
2054
2385
  (event: string, handler: (data: unknown) => void): void;
2055
2386
  };
2056
- /** Add event listener */
2057
2387
  addEventListener?: {
2058
2388
  (event: 'message', handler: (event: MessageEvent) => void): void;
2059
2389
  (event: 'error', handler: (event: ErrorEvent) => void): void;
2060
2390
  (event: string, handler: (event: Event) => void): void;
2061
2391
  };
2062
- /** Message handler */
2063
2392
  onmessage?: (event: MessageEvent) => void;
2064
- /** Terminate worker */
2065
2393
  terminate?: () => void;
2066
2394
  }
2067
2395
  /**
@@ -2069,15 +2397,10 @@ export interface WorkerLike {
2069
2397
  * @interface WorkerPool
2070
2398
  */
2071
2399
  export interface WorkerPool {
2072
- /** Add task to pool */
2073
2400
  addTask: (task: () => Promise<void>) => void;
2074
- /** Start pool */
2075
2401
  start: () => Promise<void>;
2076
- /** Stop pool */
2077
2402
  stop: () => void;
2078
- /** Wait for completion */
2079
2403
  waitForCompletion: () => Promise<void>;
2080
- /** Get pool statistics */
2081
2404
  getStats: () => {
2082
2405
  totalWorkers: number;
2083
2406
  busyWorkers: number;
@@ -2097,21 +2420,13 @@ export interface WorkerPool {
2097
2420
  * @interface WorkerMetrics
2098
2421
  */
2099
2422
  export interface WorkerMetrics {
2100
- /** Worker ID */
2101
2423
  workerId: number;
2102
- /** Task count */
2103
2424
  taskCount: number;
2104
- /** Execution time */
2105
2425
  executionTime: number;
2106
- /** Errors encountered */
2107
2426
  errors: Error[];
2108
- /** Throughput */
2109
2427
  throughput: number;
2110
- /** Average task time */
2111
2428
  avgTaskTime?: number;
2112
- /** Memory usage */
2113
2429
  memoryUsage?: number;
2114
- /** CPU usage */
2115
2430
  cpuUsage?: number;
2116
2431
  }
2117
2432
  /**
@@ -2119,21 +2434,18 @@ export interface WorkerMetrics {
2119
2434
  * @interface WorkerTestHarness
2120
2435
  */
2121
2436
  export interface WorkerTestHarness {
2122
- /** Run test scenario */
2123
2437
  run: () => Promise<{
2124
2438
  metrics: WorkerMetrics[];
2125
2439
  totalExecutionTime: number;
2126
2440
  totalTasks: number;
2127
2441
  totalErrors: number;
2128
2442
  }>;
2129
- /** Assert test results */
2130
2443
  assertResults: (results: {
2131
2444
  metrics: WorkerMetrics[];
2132
2445
  totalExecutionTime: number;
2133
2446
  totalTasks: number;
2134
2447
  totalErrors: number;
2135
2448
  }) => void;
2136
- /** Get aggregated metrics */
2137
2449
  getMetrics: () => {
2138
2450
  workerCount: number;
2139
2451
  totalTasks: number;
@@ -2148,19 +2460,12 @@ export interface WorkerTestHarness {
2148
2460
  * @interface WorkerSpy
2149
2461
  */
2150
2462
  export interface WorkerSpy {
2151
- /** Get messages sent */
2152
2463
  getMessagesSent: () => unknown[];
2153
- /** Get messages received */
2154
2464
  getMessagesReceived: () => unknown[];
2155
- /** Get errors */
2156
2465
  getErrors: () => Error[];
2157
- /** Check if terminated */
2158
2466
  isTerminated: () => boolean;
2159
- /** Simulate message */
2160
2467
  simulateMessage: (message: unknown) => void;
2161
- /** Simulate error */
2162
2468
  simulateError: (error: Error) => void;
2163
- /** Reset spy */
2164
2469
  reset: () => void;
2165
2470
  }
2166
2471
  /**
@@ -2189,6 +2494,7 @@ export interface ProfileResult<T> {
2189
2494
  samples: number[];
2190
2495
  /** Sample timestamps */
2191
2496
  timestamps: number[];
2497
+ duration: number;
2192
2498
  };
2193
2499
  /** Memory profile data */
2194
2500
  memoryProfile?: {
@@ -2209,8 +2515,8 @@ export interface StressTestOptions {
2209
2515
  concurrency?: number;
2210
2516
  /** Ramp-up time */
2211
2517
  rampUp?: number;
2212
- /** Operation rate limit */
2213
- rate?: number;
2518
+ maxErrors?: number;
2519
+ errorThreshold?: number;
2214
2520
  }
2215
2521
  /**
2216
2522
  * Stress test result
@@ -2225,7 +2531,8 @@ export interface StressTestResult {
2225
2531
  failedOperations: number;
2226
2532
  /** Average response time */
2227
2533
  averageResponseTime: number;
2228
- /** Error details */
2534
+ operationsPerSecond: number;
2535
+ errorRate: number;
2229
2536
  errors: Error[];
2230
2537
  }
2231
2538
  /**
@@ -2239,8 +2546,9 @@ export interface ThroughputResult {
2239
2546
  duration: number;
2240
2547
  /** Throughput rate */
2241
2548
  throughput: number;
2242
- /** Peak throughput */
2243
- peakThroughput: number;
2549
+ averageLatency: number;
2550
+ minLatency: number;
2551
+ maxLatency: number;
2244
2552
  }
2245
2553
  /**
2246
2554
  * Performance monitoring options
@@ -2264,11 +2572,11 @@ export interface PerformanceMonitor {
2264
2572
  /** Get collected metrics */
2265
2573
  getMetrics: () => {
2266
2574
  /** CPU metrics */
2267
- cpu: number[];
2575
+ cpu?: number[];
2268
2576
  /** Memory metrics */
2269
- memory: number[];
2577
+ memory?: number[];
2270
2578
  /** Time metrics */
2271
- time: number[];
2579
+ timestamps: number[];
2272
2580
  };
2273
2581
  }
2274
2582
  /**
@@ -2298,8 +2606,6 @@ export interface LeakResult {
2298
2606
  iteration: number;
2299
2607
  /** Memory usage */
2300
2608
  memory: number;
2301
- /** Timestamp */
2302
- timestamp: number;
2303
2609
  }>;
2304
2610
  }
2305
2611
  /**
@@ -2307,103 +2613,65 @@ export interface LeakResult {
2307
2613
  * @interface HookScenario
2308
2614
  * @typeParam T - Type of hook result
2309
2615
  */
2310
- export interface HookScenario<T> {
2311
- /** Scenario name */
2616
+ export interface HookScenario {
2312
2617
  name: string;
2313
- /** Initial props */
2314
- initialProps?: Record<string, unknown>;
2315
- /** Hook function to test */
2316
- hook: () => T;
2317
- /** Expected result */
2318
- expected: T;
2319
- /** Setup function */
2320
- setup?: () => void;
2321
- /** Cleanup function */
2322
- cleanup?: () => void;
2618
+ action: () => void | Promise<void>;
2619
+ expectedState: Record<string, unknown>;
2620
+ expectedError?: Error | null;
2323
2621
  }
2324
2622
  /**
2325
2623
  * Context update configuration
2326
2624
  * @interface ContextUpdate
2327
2625
  * @typeParam T - Type of context value
2328
2626
  */
2329
- export interface ContextUpdate<T> {
2330
- /** New context value */
2331
- value: T;
2332
- /** Update delay */
2333
- delay?: number;
2334
- /** Callback after update */
2335
- callback?: (value: T) => void;
2627
+ export interface ContextUpdate {
2628
+ value: unknown;
2629
+ expectedConsumerValue: unknown;
2630
+ description?: string;
2336
2631
  }
2337
2632
  /**
2338
2633
  * Suspense testing options
2339
2634
  * @interface SuspenseOptions
2340
2635
  */
2341
2636
  export interface SuspenseOptions {
2342
- /** Fallback component */
2343
2637
  fallback?: React.ReactNode;
2344
- /** Timeout for suspense */
2345
2638
  timeout?: number;
2346
- /** Error boundary */
2347
- errorBoundary?: boolean;
2348
2639
  }
2349
2640
  /**
2350
2641
  * Concurrent rendering scenario
2351
2642
  * @interface ConcurrentScenario
2352
2643
  */
2353
2644
  export interface ConcurrentScenario {
2354
- /** Scenario name */
2355
2645
  name: string;
2356
- /** Component to render */
2357
- component: React.ReactNode;
2358
- /** Props updates */
2359
- updates: Array<{
2360
- /** Props to update */
2361
- props: Record<string, unknown>;
2362
- /** Update delay */
2363
- delay: number;
2364
- }>;
2365
- /** Expected renders count */
2366
- expectedRenders: number;
2646
+ priority: 'high' | 'low' | 'normal';
2647
+ action: () => void | Promise<void>;
2648
+ expectedBehavior: () => void;
2367
2649
  }
2368
2650
  /**
2369
2651
  * Accessibility testing options
2370
2652
  * @interface A11yOptions
2371
2653
  */
2372
2654
  export interface A11yOptions {
2373
- /** ARIA rules to check */
2374
- rules?: string[];
2375
- /** Elements to include */
2376
- include?: string[];
2377
- /** Elements to exclude */
2378
- exclude?: string[];
2379
- /** Severity levels */
2380
- level?: 'AA' | 'AAA';
2381
- /** Tags to test */
2382
- tags?: string[];
2655
+ runOnly?: string[];
2656
+ rules?: Record<string, {
2657
+ enabled: boolean;
2658
+ }>;
2659
+ resultTypes?: Array<'violations' | 'passes' | 'incomplete' | 'inapplicable'>;
2383
2660
  }
2384
2661
  /**
2385
2662
  * Accessibility violation
2386
2663
  * @interface A11yViolation
2387
2664
  */
2388
2665
  export interface A11yViolation {
2389
- /** Rule ID */
2390
2666
  id: string;
2391
- /** Violation description */
2667
+ impact?: 'minor' | 'moderate' | 'serious' | 'critical';
2392
2668
  description: string;
2393
- /** Help text */
2394
2669
  help: string;
2395
- /** Help URL */
2396
2670
  helpUrl: string;
2397
- /** Impact level */
2398
- impact: 'minor' | 'moderate' | 'serious' | 'critical';
2399
- /** Affected nodes */
2400
2671
  nodes: Array<{
2401
- /** Element HTML */
2402
- html: string;
2403
- /** Element selector */
2404
2672
  target: string[];
2405
- /** Failure summary */
2406
- failureSummary: string;
2673
+ html: string;
2674
+ failureSummary?: string;
2407
2675
  }>;
2408
2676
  }
2409
2677
  /**
@@ -2411,16 +2679,13 @@ export interface A11yViolation {
2411
2679
  * @interface A11yPass
2412
2680
  */
2413
2681
  export interface A11yPass {
2414
- /** Rule ID */
2415
2682
  id: string;
2416
- /** Rule description */
2417
2683
  description: string;
2418
- /** Passed nodes */
2684
+ help: string;
2685
+ helpUrl: string;
2419
2686
  nodes: Array<{
2420
- /** Element HTML */
2421
- html: string;
2422
- /** Element selector */
2423
2687
  target: string[];
2688
+ html: string;
2424
2689
  }>;
2425
2690
  }
2426
2691
  /**
@@ -2428,16 +2693,14 @@ export interface A11yPass {
2428
2693
  * @interface A11yIncomplete
2429
2694
  */
2430
2695
  export interface A11yIncomplete {
2431
- /** Rule ID */
2432
2696
  id: string;
2433
- /** Rule description */
2434
2697
  description: string;
2435
- /** Incomplete nodes */
2698
+ help: string;
2699
+ helpUrl: string;
2436
2700
  nodes: Array<{
2437
- /** Element HTML */
2438
- html: string;
2439
- /** Element selector */
2440
2701
  target: string[];
2702
+ html: string;
2703
+ message?: string;
2441
2704
  }>;
2442
2705
  }
2443
2706
  /**
@@ -2445,146 +2708,139 @@ export interface A11yIncomplete {
2445
2708
  * @interface A11yReport
2446
2709
  */
2447
2710
  export interface A11yReport {
2448
- /** Violations found */
2449
2711
  violations: A11yViolation[];
2450
- /** Tests that passed */
2451
2712
  passes: A11yPass[];
2452
- /** Incomplete tests */
2453
2713
  incomplete: A11yIncomplete[];
2454
- /** Test URL */
2455
- url: string;
2456
- /** Timestamp */
2457
- timestamp: Date;
2714
+ inapplicable: Array<{
2715
+ id: string;
2716
+ description: string;
2717
+ }>;
2458
2718
  }
2459
2719
  /**
2460
2720
  * Keyboard sequence for testing
2461
2721
  * @interface KeySequence
2462
2722
  */
2463
2723
  export interface KeySequence {
2464
- /** Keys to press */
2465
- keys: string[];
2466
- /** Delay between keys */
2467
- delay?: number;
2468
- /** Modifier keys */
2469
- modifiers?: Array<'shift' | 'ctrl' | 'alt' | 'meta'>;
2724
+ key: string;
2725
+ modifiers?: string[];
2470
2726
  }
2471
2727
  /**
2472
2728
  * Color contrast test result
2473
2729
  * @interface ContrastResult
2474
2730
  */
2475
2731
  export interface ContrastResult {
2476
- /** Foreground color */
2477
- foreground: string;
2478
- /** Background color */
2479
- background: string;
2480
- /** Contrast ratio */
2732
+ passes: boolean;
2481
2733
  ratio: number;
2482
- /** WCAG AA compliance */
2483
- AA: boolean;
2484
- /** WCAG AAA compliance */
2485
- AAA: boolean;
2734
+ standard: 'AA' | 'AAA';
2735
+ largeText: boolean;
2736
+ recommendation?: string;
2486
2737
  }
2487
2738
  /**
2488
2739
  * User session options
2489
2740
  * @interface SessionOptions
2490
2741
  */
2491
2742
  export interface SessionOptions {
2492
- /** Pointer events API */
2493
- pointerEventsCheck?: number;
2494
- /** Advanced timer */
2495
- advanceTimers?: () => void;
2496
- /** Skip hover */
2497
- skipHover?: boolean;
2498
- /** Skip click */
2499
- skipClick?: boolean;
2500
- /** Auto cleanup */
2501
- autoCleanup?: boolean;
2743
+ userId?: string;
2744
+ deviceType?: 'desktop' | 'mobile' | 'tablet';
2745
+ browser?: string;
2746
+ viewport?: {
2747
+ width: number;
2748
+ height: number;
2749
+ };
2750
+ locale?: string;
2751
+ timezone?: string;
2502
2752
  }
2503
2753
  /**
2504
2754
  * User event session
2505
2755
  * @interface UserSession
2506
2756
  */
2507
2757
  export interface UserSession {
2508
- /** Click element */
2509
- click: (element: Element, options?: ClickOptions) => Promise<void>;
2510
- /** Double click element */
2511
- dblClick: (element: Element, options?: ClickOptions) => Promise<void>;
2512
- /** Type into element */
2513
- type: (element: Element, text: string, options?: TypeOptions) => Promise<void>;
2514
- /** Clear input */
2515
- clear: (element: Element) => Promise<void>;
2516
- /** Tab navigation */
2517
- tab: (options?: {
2518
- shift?: boolean;
2519
- }) => Promise<void>;
2520
- /** Hover element */
2521
- hover: (element: Element) => Promise<void>;
2522
- /** Unhover element */
2523
- unhover: (element: Element) => Promise<void>;
2758
+ id: string;
2759
+ userId: string;
2760
+ deviceType: 'desktop' | 'mobile' | 'tablet';
2761
+ browser: string;
2762
+ viewport: {
2763
+ width: number;
2764
+ height: number;
2765
+ };
2766
+ locale: string;
2767
+ timezone: string;
2768
+ startTime: Date;
2769
+ interactions: Interaction[];
2770
+ endSession: () => void;
2524
2771
  }
2525
2772
  /**
2526
2773
  * Click options
2527
2774
  * @interface ClickOptions
2528
2775
  */
2529
2776
  export interface ClickOptions {
2530
- /** Button to click */
2531
- button?: 'left' | 'middle' | 'right';
2532
- /** Click count */
2533
- clickCount?: number;
2534
- /** Skip hover */
2535
- skipHover?: boolean;
2536
- /** Click delay */
2537
2777
  delay?: number;
2778
+ moveSpeed?: number;
2779
+ pressure?: number;
2780
+ jitter?: boolean;
2538
2781
  }
2539
2782
  /**
2540
2783
  * Type options
2541
2784
  * @interface TypeOptions
2542
2785
  */
2543
2786
  export interface TypeOptions {
2544
- /** Typing delay */
2545
2787
  delay?: number;
2546
- /** Skip click */
2547
- skipClick?: boolean;
2548
- /** Skip auto close */
2549
- skipAutoClose?: boolean;
2550
- /** Initial selection */
2551
- initialSelectionStart?: number;
2552
- /** Initial selection end */
2553
- initialSelectionEnd?: number;
2788
+ typos?: boolean;
2789
+ corrections?: boolean;
2790
+ variableSpeed?: boolean;
2554
2791
  }
2555
2792
  /**
2556
2793
  * Drag options
2557
2794
  * @interface DragOptions
2558
2795
  */
2559
2796
  export interface DragOptions {
2560
- /** Delta coordinates */
2561
- delta?: {
2562
- x: number;
2563
- y: number;
2564
- };
2565
- /** Target element */
2566
- target?: Element;
2567
- /** Data transfer */
2568
- dataTransfer?: {
2569
- /** Transfer data */
2570
- getData: (format: string) => string;
2571
- /** Set transfer data */
2572
- setData: (format: string, data: string) => void;
2573
- };
2797
+ duration?: number;
2798
+ steps?: number;
2799
+ dropEffect?: 'move' | 'copy' | 'link' | 'none';
2574
2800
  }
2801
+ export type TouchGestureAdvancedAdvanced = {
2802
+ type: 'tap';
2803
+ x: number;
2804
+ y: number;
2805
+ } | {
2806
+ type: 'doubleTap';
2807
+ x: number;
2808
+ y: number;
2809
+ } | {
2810
+ type: 'longPress';
2811
+ x: number;
2812
+ y: number;
2813
+ duration: number;
2814
+ } | {
2815
+ type: 'swipe';
2816
+ startX: number;
2817
+ startY: number;
2818
+ endX: number;
2819
+ endY: number;
2820
+ duration: number;
2821
+ } | {
2822
+ type: 'pinch';
2823
+ centerX: number;
2824
+ centerY: number;
2825
+ startDistance: number;
2826
+ endDistance: number;
2827
+ } | {
2828
+ type: 'rotate';
2829
+ centerX: number;
2830
+ centerY: number;
2831
+ startAngle: number;
2832
+ endAngle: number;
2833
+ };
2575
2834
  /**
2576
2835
  * User interaction record
2577
2836
  * @interface Interaction
2578
2837
  */
2579
2838
  export interface Interaction {
2580
- /** Interaction type */
2581
- type: 'click' | 'type' | 'hover' | 'focus' | 'blur';
2582
- /** Target element */
2583
- element: Element;
2584
- /** Interaction data */
2839
+ timestamp: Date;
2840
+ type: string;
2841
+ target: string;
2585
2842
  data?: unknown;
2586
- /** Timestamp */
2587
- timestamp: number;
2843
+ duration?: number;
2588
2844
  }
2589
2845
  /**
2590
2846
  * Swipe gesture parameters
@@ -2628,70 +2884,44 @@ export interface PinchGestureParams {
2628
2884
  * @interface Frame
2629
2885
  */
2630
2886
  export interface Frame {
2631
- /** Frame timestamp */
2632
2887
  timestamp: number;
2633
- /** Frame progress */
2634
- progress: number;
2635
- /** Frame values */
2636
- values: Record<string, number>;
2888
+ styles: Record<string, string>;
2637
2889
  }
2638
2890
  /**
2639
2891
  * Animation performance metrics
2640
2892
  * @interface AnimationMetrics
2641
2893
  */
2642
2894
  export interface AnimationMetrics {
2643
- /** Total duration */
2644
2895
  duration: number;
2645
- /** Frame count */
2646
2896
  frameCount: number;
2647
- /** Dropped frames */
2648
- droppedFrames: number;
2649
- /** Average FPS */
2650
2897
  averageFPS: number;
2651
- /** Minimum FPS */
2652
- minFPS: number;
2653
- /** Maximum FPS */
2654
- maxFPS: number;
2898
+ paintTime: number;
2899
+ layoutTime: number;
2655
2900
  }
2656
2901
  /**
2657
2902
  * RequestAnimationFrame options
2658
2903
  * @interface RAFOptions
2659
2904
  */
2660
2905
  export interface RAFOptions {
2661
- /** Auto start */
2662
- autoStart?: boolean;
2663
- /** Frame limit */
2664
- frameLimit?: number;
2665
- /** FPS target */
2666
- targetFPS?: number;
2906
+ autoAdvance?: boolean;
2907
+ frameTime?: number;
2667
2908
  }
2668
2909
  /**
2669
2910
  * RequestAnimationFrame mock
2670
2911
  * @interface RAFMock
2671
2912
  */
2672
2913
  export interface RAFMock {
2673
- /** Start animation */
2674
- start: () => void;
2675
- /** Stop animation */
2676
- stop: () => void;
2677
- /** Step to next frame */
2678
- step: () => void;
2679
- /** Get current time */
2680
- now: () => number;
2681
- /** Set frame rate */
2682
- setFrameRate: (fps: number) => void;
2914
+ tick: (time?: number) => void;
2915
+ reset: () => void;
2916
+ getCallCount: () => number;
2683
2917
  }
2684
2918
  /**
2685
2919
  * Interval handle
2686
2920
  * @interface IntervalHandle
2687
2921
  */
2688
2922
  export interface IntervalHandle {
2689
- /** Interval ID */
2690
- id: number;
2691
- /** Clear interval */
2692
- clear: () => void;
2693
- /** Check if active */
2694
- isActive: () => boolean;
2923
+ stop: () => void;
2924
+ isRunning: () => boolean;
2695
2925
  }
2696
2926
  /**
2697
2927
  * Schedule handle
@@ -2710,36 +2940,26 @@ export interface ScheduleHandle {
2710
2940
  * @interface Timer
2711
2941
  */
2712
2942
  export interface Timer {
2713
- /** Start time */
2714
- startTime: number;
2715
- /** End time */
2716
- endTime?: number;
2717
- /** Elapsed time */
2718
- elapsed: number;
2719
- /** Timer label */
2720
- label?: string;
2943
+ start: () => void;
2944
+ stop: () => number;
2945
+ pause: () => void;
2946
+ resume: () => void;
2947
+ getElapsed: () => number;
2948
+ reset: () => void;
2721
2949
  }
2722
- /**
2723
- * Countdown timer
2724
- * @interface Countdown
2725
- */
2726
2950
  export interface Countdown {
2727
- /** Remaining time */
2728
- remaining: number;
2729
- /** Total duration */
2730
- duration: number;
2731
- /** Is running */
2732
- isRunning: boolean;
2733
- /** Is complete */
2734
- isComplete: boolean;
2735
- /** Completion callback */
2736
- onComplete?: () => void;
2951
+ start: () => void;
2952
+ pause: () => void;
2953
+ resume: () => void;
2954
+ getRemaining: () => number;
2955
+ onComplete: (callback: () => void) => void;
2956
+ cancel: () => void;
2737
2957
  }
2738
2958
  /**
2739
2959
  * History entry
2740
2960
  * @interface HistoryEntry
2741
2961
  */
2742
- export interface HistoryEntry {
2962
+ export interface MockHistoryEntry {
2743
2963
  /** Entry URL */
2744
2964
  url: string;
2745
2965
  /** Entry state */
@@ -2754,20 +2974,19 @@ export interface HistoryEntry {
2754
2974
  * @interface MockHistory
2755
2975
  */
2756
2976
  export interface MockHistory {
2757
- /** History entries */
2758
- entries: HistoryEntry[];
2759
- /** Current index */
2977
+ entries: MockHistoryEntry[];
2760
2978
  index: number;
2761
- /** Push entry */
2762
- push: (url: string, state?: unknown) => void;
2763
- /** Replace entry */
2764
- replace: (url: string, state?: unknown) => void;
2765
- /** Go back */
2766
- back: () => void;
2767
- /** Go forward */
2768
- forward: () => void;
2769
- /** Go to index */
2770
- go: (delta: number) => void;
2979
+ push: (path: string, state?: unknown) => void;
2980
+ replace: (path: string, state?: unknown) => void;
2981
+ go: (n: number) => void;
2982
+ goBack: () => void;
2983
+ goForward: () => void;
2984
+ canGo: (n: number) => boolean;
2985
+ block: (blocker: (location: MockHistoryEntry, action: string) => string | false) => () => void;
2986
+ listen: (listener: (location: MockHistoryEntry, action: string) => void) => () => void;
2987
+ createHref: (location: Partial<MockHistoryEntry>) => string;
2988
+ location: MockHistoryEntry;
2989
+ length: number;
2771
2990
  }
2772
2991
  /**
2773
2992
  * Mock location object
@@ -2781,51 +3000,44 @@ export interface MockLocation {
2781
3000
  /** Current hash */
2782
3001
  hash: string;
2783
3002
  /** Current state */
2784
- state?: unknown;
3003
+ state: unknown;
2785
3004
  /** Location key */
2786
3005
  key: string;
3006
+ href: string;
3007
+ origin: string;
3008
+ protocol: string;
3009
+ host: string;
3010
+ hostname: string;
3011
+ port: string;
2787
3012
  }
2788
3013
  /**
2789
3014
  * Route expectation
2790
3015
  * @interface RouteExpectation
2791
3016
  */
2792
3017
  export interface RouteExpectation {
2793
- /** Expected path */
2794
- path: string;
2795
- /** Expected params */
2796
- params?: Record<string, string>;
2797
- /** Expected query */
2798
- query?: Record<string, string>;
2799
- /** Should match exactly */
2800
- exact?: boolean;
3018
+ params?: Record<string, string | string[]>;
3019
+ query?: Record<string, string | string[]>;
3020
+ beforeTransition?: () => void | Promise<void>;
3021
+ afterTransition?: () => void | Promise<void>;
2801
3022
  }
2802
3023
  /**
2803
3024
  * Route guard configuration
2804
3025
  * @interface RouteGuard
2805
3026
  */
2806
3027
  export interface RouteGuard {
2807
- /** Guard name */
2808
- name: string;
2809
- /** Guard function */
2810
- guard: (route: string) => boolean | Promise<boolean>;
2811
- /** Redirect path */
2812
- redirectTo?: string;
2813
- /** Guard priority */
2814
- priority?: number;
3028
+ canActivate?: (to: string, from: string) => boolean | Promise<boolean>;
3029
+ canDeactivate?: (from: string, to: string) => boolean | Promise<boolean>;
2815
3030
  }
2816
3031
  /**
2817
3032
  * Guard scenario for testing
2818
3033
  * @interface GuardScenario
2819
3034
  */
2820
3035
  export interface GuardScenario {
2821
- /** Scenario name */
2822
3036
  name: string;
2823
- /** Route to test */
2824
- route: string;
2825
- /** Expected guard result */
2826
- expectedResult: boolean;
2827
- /** Expected redirect */
2828
- expectedRedirect?: string;
3037
+ from: string;
3038
+ to: string;
3039
+ shouldAllow: boolean;
3040
+ guardType: 'canActivate' | 'canDeactivate';
2829
3041
  }
2830
3042
  /**
2831
3043
  * Navigation options
@@ -2836,21 +3048,16 @@ export interface NavOptions {
2836
3048
  replace?: boolean;
2837
3049
  /** Navigation state */
2838
3050
  state?: unknown;
2839
- /** Prevent default */
2840
- preventDefault?: boolean;
3051
+ shallow?: boolean;
2841
3052
  }
2842
3053
  /**
2843
3054
  * Next.js testing options
2844
3055
  * @interface NextOptions
2845
3056
  */
2846
3057
  export interface NextOptions {
2847
- /** Router configuration */
2848
- router?: Partial<unknown>;
2849
- /** Current pathname */
3058
+ router?: Partial<MockNextRouter>;
2850
3059
  pathname?: string;
2851
- /** Search parameters */
2852
3060
  searchParams?: Record<string, string>;
2853
- /** Request cookies */
2854
3061
  cookies?: Record<string, string>;
2855
3062
  }
2856
3063
  /**
@@ -2858,83 +3065,52 @@ export interface NextOptions {
2858
3065
  * @interface NextTestContext
2859
3066
  */
2860
3067
  export interface NextTestContext {
2861
- /** Mock router instance */
2862
- router: unknown;
2863
- /** Navigation mock */
2864
- navigation: unknown;
2865
- /** Request mock */
2866
- req: unknown;
2867
- /** Response mock */
2868
- res: unknown;
2869
- /** Reset function */
3068
+ router: MockNextRouter & NextRouterHelpers;
3069
+ navigation: MockNextNavigationResult;
3070
+ req: MockNextApiRequest;
3071
+ res: MockNextApiResponse;
2870
3072
  reset: () => void;
2871
3073
  }
2872
3074
  /**
2873
3075
  * Server-side props context for testing
2874
3076
  * @interface SSPContext
2875
3077
  */
2876
- export interface SSPContext {
2877
- /** Test scenario name */
3078
+ export interface SSPContext extends Partial<MockGetServerSidePropsContext> {
2878
3079
  scenario?: string;
2879
- /** Expected props */
2880
3080
  expectedProps?: Record<string, unknown>;
2881
- /** Expected redirect */
2882
3081
  expectedRedirect?: {
2883
3082
  destination: string;
2884
3083
  permanent?: boolean;
2885
3084
  };
2886
- /** Expect not found */
2887
3085
  expectNotFound?: boolean;
2888
- /** Request parameters */
2889
- params?: Record<string, string>;
2890
- /** Query parameters */
2891
- query?: Record<string, string>;
2892
- /** Request headers */
2893
- headers?: Record<string, string>;
2894
3086
  }
2895
3087
  /**
2896
3088
  * Static props context for testing
2897
3089
  * @interface SPContext
2898
3090
  */
2899
- export interface SPContext {
2900
- /** Test scenario name */
3091
+ export interface SPContext extends Partial<MockGetStaticPropsContext> {
2901
3092
  scenario?: string;
2902
- /** Expected props */
2903
3093
  expectedProps?: Record<string, unknown>;
2904
- /** Expected revalidation time */
2905
3094
  expectedRevalidate?: number;
2906
- /** Expected redirect */
2907
3095
  expectedRedirect?: {
2908
3096
  destination: string;
2909
3097
  permanent?: boolean;
2910
3098
  };
2911
- /** Expect not found */
2912
3099
  expectNotFound?: boolean;
2913
- /** Route parameters */
2914
- params?: Record<string, string>;
2915
3100
  }
2916
3101
  /**
2917
3102
  * API request test configuration
2918
3103
  * @interface APIRequest
2919
3104
  */
2920
3105
  export interface APIRequest {
2921
- /** Test scenario name */
2922
3106
  scenario?: string;
2923
- /** HTTP method */
2924
3107
  method?: string;
2925
- /** Request headers */
2926
3108
  headers?: Record<string, string>;
2927
- /** Request body */
2928
3109
  body?: unknown;
2929
- /** Query parameters */
2930
3110
  query?: Record<string, string>;
2931
- /** Request cookies */
2932
3111
  cookies?: Record<string, string>;
2933
- /** Expected status code */
2934
3112
  expectedStatus?: number;
2935
- /** Expected response body */
2936
3113
  expectedBody?: unknown;
2937
- /** Expected response headers */
2938
3114
  expectedHeaders?: Record<string, string>;
2939
3115
  }
2940
3116
  /**
@@ -3010,6 +3186,8 @@ export interface LifecycleMetrics {
3010
3186
  updateTime: number;
3011
3187
  /** Unmount time */
3012
3188
  unmountTime: number;
3189
+ totalLifecycleTime: number;
3190
+ renderCount: number;
3013
3191
  }
3014
3192
  /**
3015
3193
  * File snapshot for testing
@@ -3031,14 +3209,10 @@ export interface FileSnapshot {
3031
3209
  * Environment configuration
3032
3210
  * @interface EnvConfig
3033
3211
  */
3034
- export interface EnvConfig {
3035
- /** Base directory */
3212
+ interface EnvConfig {
3036
3213
  baseDir?: string;
3037
- /** Environment file path */
3038
3214
  envFile?: string;
3039
- /** Override existing values */
3040
3215
  override?: boolean;
3041
- /** Default values */
3042
3216
  defaults?: Record<string, string>;
3043
3217
  }
3044
3218
  /**
@@ -3048,11 +3222,8 @@ export interface EnvConfig {
3048
3222
  export interface TestEnvironment {
3049
3223
  /** Get environment variable */
3050
3224
  get: (key: string) => string | undefined;
3051
- /** Set environment variable */
3052
3225
  set: (key: string, value: string) => void;
3053
- /** Reset environment */
3054
3226
  reset: () => void;
3055
- /** Load environment configuration */
3056
3227
  load: (config: EnvConfig) => void;
3057
3228
  }
3058
3229
  /**
@@ -3062,9 +3233,7 @@ export interface TestEnvironment {
3062
3233
  export interface EnvMock {
3063
3234
  /** Restore original environment */
3064
3235
  restore: () => void;
3065
- /** Update environment variables */
3066
3236
  update: (vars: Record<string, string>) => void;
3067
- /** Clear environment variables */
3068
3237
  clear: () => void;
3069
3238
  }
3070
3239
  /**
@@ -3074,7 +3243,6 @@ export interface EnvMock {
3074
3243
  export interface EnvSnapshot {
3075
3244
  /** Environment variables */
3076
3245
  variables: Record<string, string | undefined>;
3077
- /** Snapshot timestamp */
3078
3246
  timestamp: number;
3079
3247
  }
3080
3248
  /**
@@ -3098,18 +3266,18 @@ export type ComponentType<P = Record<string, unknown>> = new (props: P) => React
3098
3266
  * @type GSSP
3099
3267
  * @typeParam T - Props type
3100
3268
  */
3101
- export type GSSP<T = unknown> = (context: T) => Promise<T>;
3269
+ export type GSSP<T = unknown> = (context: MockGetServerSidePropsContext) => Promise<ServerSidePropsResult<T>>;
3102
3270
  /**
3103
3271
  * Next.js Get Static Props function
3104
3272
  * @type GSP
3105
3273
  * @typeParam T - Props type
3106
3274
  */
3107
- export type GSP<T = unknown> = (context: T) => Promise<T>;
3275
+ export type GSP<T = unknown> = (context: MockGetStaticPropsContext) => Promise<StaticPropsResult<T>>;
3108
3276
  /**
3109
3277
  * Next.js API handler function
3110
3278
  * @type APIHandler
3111
3279
  */
3112
- export type APIHandler = (req: unknown, res: unknown) => Promise<void> | void;
3280
+ export type APIHandler = (req: NextApiRequest, res: NextApiResponse) => Promise<void> | void;
3113
3281
  /**
3114
3282
  * Touch gesture type
3115
3283
  * @type TouchGesture
@@ -3125,11 +3293,8 @@ export type WatchCallback = (event: string, filename: string | null) => void;
3125
3293
  * @interface PipelineResult
3126
3294
  */
3127
3295
  export interface PipelineResult {
3128
- /** Output buffer */
3129
3296
  output: globalThis.Buffer;
3130
- /** Errors array */
3131
3297
  errors: Error[];
3132
- /** Duration in milliseconds */
3133
3298
  duration: number;
3134
3299
  }
3135
3300
  /**
@@ -3137,11 +3302,8 @@ export interface PipelineResult {
3137
3302
  * @interface ModuleMocks
3138
3303
  */
3139
3304
  export interface ModuleMocks {
3140
- /** Restore function */
3141
3305
  restore: () => void;
3142
- /** Get call count for module */
3143
3306
  getCallCount: (moduleName: string) => number;
3144
- /** Get last call for module */
3145
3307
  getLastCall: (moduleName: string) => unknown[];
3146
3308
  }
3147
3309
  /**
@@ -3149,12 +3311,9 @@ export interface ModuleMocks {
3149
3311
  * @interface AsyncHook
3150
3312
  */
3151
3313
  export interface AsyncHook {
3152
- /** Init callback */
3153
3314
  init?: (asyncId: number, type: string, triggerAsyncId: number) => void;
3154
- /** Before callback */
3155
3315
  before?: (asyncId: number) => void;
3156
- /** After callback */
3157
3316
  after?: (asyncId: number) => void;
3158
- /** Destroy callback */
3159
3317
  destroy?: (asyncId: number) => void;
3160
3318
  }
3319
+ export {};