1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import type {Arguments} from 'yargs';
|
10 | import type {CoverageMapData} from 'istanbul-lib-coverage';
|
11 | import type {ForegroundColor} from 'chalk';
|
12 | import type {ReportOptions} from 'istanbul-reports';
|
13 | import type {SnapshotFormat} from '@jest/schemas';
|
14 |
|
15 | declare type Argv = Arguments<
|
16 | Partial<{
|
17 | all: boolean;
|
18 | automock: boolean;
|
19 | bail: boolean | number;
|
20 | cache: boolean;
|
21 | cacheDirectory: string;
|
22 | changedFilesWithAncestor: boolean;
|
23 | changedSince: string;
|
24 | ci: boolean;
|
25 | clearCache: boolean;
|
26 | clearMocks: boolean;
|
27 | collectCoverage: boolean;
|
28 | collectCoverageFrom: string;
|
29 | color: boolean;
|
30 | colors: boolean;
|
31 | config: string;
|
32 | coverage: boolean;
|
33 | coverageDirectory: string;
|
34 | coveragePathIgnorePatterns: Array<string>;
|
35 | coverageReporters: Array<string>;
|
36 | coverageThreshold: string;
|
37 | debug: boolean;
|
38 | env: string;
|
39 | expand: boolean;
|
40 | findRelatedTests: boolean;
|
41 | forceExit: boolean;
|
42 | globals: string;
|
43 | globalSetup: string | null | undefined;
|
44 | globalTeardown: string | null | undefined;
|
45 | haste: string;
|
46 | ignoreProjects: Array<string>;
|
47 | init: boolean;
|
48 | injectGlobals: boolean;
|
49 | json: boolean;
|
50 | lastCommit: boolean;
|
51 | logHeapUsage: boolean;
|
52 | maxWorkers: number | string;
|
53 | moduleDirectories: Array<string>;
|
54 | moduleFileExtensions: Array<string>;
|
55 | moduleNameMapper: string;
|
56 | modulePathIgnorePatterns: Array<string>;
|
57 | modulePaths: Array<string>;
|
58 | noStackTrace: boolean;
|
59 | notify: boolean;
|
60 | notifyMode: string;
|
61 | onlyChanged: boolean;
|
62 | onlyFailures: boolean;
|
63 | outputFile: string;
|
64 | preset: string | null | undefined;
|
65 | prettierPath: string | null | undefined;
|
66 | projects: Array<string>;
|
67 | reporters: Array<string>;
|
68 | resetMocks: boolean;
|
69 | resetModules: boolean;
|
70 | resolver: string | null | undefined;
|
71 | restoreMocks: boolean;
|
72 | rootDir: string;
|
73 | roots: Array<string>;
|
74 | runInBand: boolean;
|
75 | selectProjects: Array<string>;
|
76 | setupFiles: Array<string>;
|
77 | setupFilesAfterEnv: Array<string>;
|
78 | shard: string;
|
79 | showConfig: boolean;
|
80 | silent: boolean;
|
81 | snapshotSerializers: Array<string>;
|
82 | testEnvironment: string;
|
83 | testEnvironmentOptions: string;
|
84 | testFailureExitCode: string | null | undefined;
|
85 | testMatch: Array<string>;
|
86 | testNamePattern: string;
|
87 | testPathIgnorePatterns: Array<string>;
|
88 | testPathPattern: Array<string>;
|
89 | testRegex: string | Array<string>;
|
90 | testResultsProcessor: string;
|
91 | testRunner: string;
|
92 | testSequencer: string;
|
93 | testTimeout: number | null | undefined;
|
94 | transform: string;
|
95 | transformIgnorePatterns: Array<string>;
|
96 | unmockedModulePathPatterns: Array<string> | null | undefined;
|
97 | updateSnapshot: boolean;
|
98 | useStderr: boolean;
|
99 | verbose: boolean;
|
100 | version: boolean;
|
101 | watch: boolean;
|
102 | watchAll: boolean;
|
103 | watchman: boolean;
|
104 | watchPathIgnorePatterns: Array<string>;
|
105 | workerIdleMemoryLimit: number | string;
|
106 | }>
|
107 | >;
|
108 |
|
109 | declare type ArrayTable = Table | Row;
|
110 |
|
111 | declare type AssertionResult = {
|
112 | ancestorTitles: Array<string>;
|
113 | duration?: number | null;
|
114 | failureDetails: Array<unknown>;
|
115 | failureMessages: Array<string>;
|
116 | fullName: string;
|
117 | invocations?: number;
|
118 | location?: Callsite | null;
|
119 | numPassingAsserts: number;
|
120 | retryReasons?: Array<string>;
|
121 | status: Status;
|
122 | title: string;
|
123 | };
|
124 |
|
125 | declare type AsyncEvent =
|
126 | | {
|
127 | name: 'setup';
|
128 | testNamePattern?: string;
|
129 | runtimeGlobals: JestGlobals;
|
130 | parentProcess: Process;
|
131 | }
|
132 | | {
|
133 | name: 'include_test_location_in_result';
|
134 | }
|
135 | | {
|
136 | name: 'hook_start';
|
137 | hook: Hook;
|
138 | }
|
139 | | {
|
140 | name: 'hook_success';
|
141 | describeBlock?: DescribeBlock;
|
142 | test?: TestEntry;
|
143 | hook: Hook;
|
144 | }
|
145 | | {
|
146 | name: 'hook_failure';
|
147 | error: string | Exception;
|
148 | describeBlock?: DescribeBlock;
|
149 | test?: TestEntry;
|
150 | hook: Hook;
|
151 | }
|
152 | | {
|
153 | name: 'test_fn_start';
|
154 | test: TestEntry;
|
155 | }
|
156 | | {
|
157 | name: 'test_fn_success';
|
158 | test: TestEntry;
|
159 | }
|
160 | | {
|
161 | name: 'test_fn_failure';
|
162 | error: Exception;
|
163 | test: TestEntry;
|
164 | }
|
165 | | {
|
166 | name: 'test_retry';
|
167 | test: TestEntry;
|
168 | }
|
169 | | {
|
170 | name: 'test_start';
|
171 | test: TestEntry;
|
172 | }
|
173 | | {
|
174 | name: 'test_skip';
|
175 | test: TestEntry;
|
176 | }
|
177 | | {
|
178 | name: 'test_todo';
|
179 | test: TestEntry;
|
180 | }
|
181 | | {
|
182 | name: 'test_done';
|
183 | test: TestEntry;
|
184 | }
|
185 | | {
|
186 | name: 'run_describe_start';
|
187 | describeBlock: DescribeBlock;
|
188 | }
|
189 | | {
|
190 | name: 'run_describe_finish';
|
191 | describeBlock: DescribeBlock;
|
192 | }
|
193 | | {
|
194 | name: 'run_start';
|
195 | }
|
196 | | {
|
197 | name: 'run_finish';
|
198 | }
|
199 | | {
|
200 | name: 'teardown';
|
201 | };
|
202 |
|
203 | declare type AsyncFn = TestFn_2 | HookFn_2;
|
204 |
|
205 | declare type BlockFn = () => void;
|
206 |
|
207 | declare type BlockFn_2 = Global.BlockFn;
|
208 |
|
209 | declare type BlockMode = void | 'skip' | 'only' | 'todo';
|
210 |
|
211 | declare type BlockName = string;
|
212 |
|
213 | declare type BlockName_2 = Global.BlockName;
|
214 |
|
215 | declare type BlockNameLike = BlockName | NameLike;
|
216 |
|
217 | declare type BlockNameLike_2 = Global.BlockNameLike;
|
218 |
|
219 | declare type Callsite = {
|
220 | column: number;
|
221 | line: number;
|
222 | };
|
223 |
|
224 | declare namespace Circus {
|
225 | export {
|
226 | DoneFn,
|
227 | BlockFn_2 as BlockFn,
|
228 | BlockName_2 as BlockName,
|
229 | BlockNameLike_2 as BlockNameLike,
|
230 | BlockMode,
|
231 | TestMode,
|
232 | TestName_2 as TestName,
|
233 | TestNameLike_2 as TestNameLike,
|
234 | TestFn_2 as TestFn,
|
235 | ConcurrentTestFn_2 as ConcurrentTestFn,
|
236 | HookFn_2 as HookFn,
|
237 | AsyncFn,
|
238 | SharedHookType,
|
239 | HookType,
|
240 | TestContext_2 as TestContext,
|
241 | Exception,
|
242 | FormattedError,
|
243 | Hook,
|
244 | EventHandler,
|
245 | Event_2 as Event,
|
246 | SyncEvent,
|
247 | AsyncEvent,
|
248 | MatcherResults,
|
249 | TestStatus,
|
250 | TestResult_2 as TestResult,
|
251 | RunResult,
|
252 | TestResults,
|
253 | GlobalErrorHandlers,
|
254 | State,
|
255 | DescribeBlock,
|
256 | TestError,
|
257 | TestEntry,
|
258 | };
|
259 | }
|
260 | export {Circus};
|
261 |
|
262 | declare type Col = unknown;
|
263 |
|
264 | declare type ConcurrentTestFn = () => TestReturnValuePromise;
|
265 |
|
266 | declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn;
|
267 |
|
268 | declare namespace Config {
|
269 | export {
|
270 | FakeableAPI,
|
271 | GlobalFakeTimersConfig,
|
272 | FakeTimersConfig,
|
273 | LegacyFakeTimersConfig,
|
274 | HasteConfig,
|
275 | CoverageReporterName,
|
276 | CoverageReporterWithOptions,
|
277 | CoverageReporters,
|
278 | ReporterConfig,
|
279 | TransformerConfig,
|
280 | ConfigGlobals,
|
281 | DefaultOptions,
|
282 | DisplayName,
|
283 | InitialOptionsWithRootDir,
|
284 | InitialProjectOptions,
|
285 | InitialOptions,
|
286 | SnapshotUpdateState,
|
287 | CoverageThresholdValue,
|
288 | GlobalConfig,
|
289 | ProjectConfig,
|
290 | Argv,
|
291 | };
|
292 | }
|
293 | export {Config};
|
294 |
|
295 | declare interface ConfigGlobals {
|
296 | [K: string]: unknown;
|
297 | }
|
298 |
|
299 | declare type CoverageProvider = 'babel' | 'v8';
|
300 |
|
301 | declare type CoverageReporterName = keyof ReportOptions;
|
302 |
|
303 | declare type CoverageReporters = Array<
|
304 | CoverageReporterName | CoverageReporterWithOptions
|
305 | >;
|
306 |
|
307 | declare type CoverageReporterWithOptions<K = CoverageReporterName> =
|
308 | K extends CoverageReporterName
|
309 | ? ReportOptions[K] extends never
|
310 | ? never
|
311 | : [K, Partial<ReportOptions[K]>]
|
312 | : never;
|
313 |
|
314 | declare type CoverageThreshold = {
|
315 | [path: string]: CoverageThresholdValue;
|
316 | global: CoverageThresholdValue;
|
317 | };
|
318 |
|
319 | declare type CoverageThresholdValue = {
|
320 | branches?: number;
|
321 | functions?: number;
|
322 | lines?: number;
|
323 | statements?: number;
|
324 | };
|
325 |
|
326 | declare type DefaultOptions = {
|
327 | automock: boolean;
|
328 | bail: number;
|
329 | cache: boolean;
|
330 | cacheDirectory: string;
|
331 | changedFilesWithAncestor: boolean;
|
332 | ci: boolean;
|
333 | clearMocks: boolean;
|
334 | collectCoverage: boolean;
|
335 | coveragePathIgnorePatterns: Array<string>;
|
336 | coverageReporters: Array<CoverageReporterName>;
|
337 | coverageProvider: CoverageProvider;
|
338 | detectLeaks: boolean;
|
339 | detectOpenHandles: boolean;
|
340 | errorOnDeprecated: boolean;
|
341 | expand: boolean;
|
342 | extensionsToTreatAsEsm: Array<string>;
|
343 | fakeTimers: FakeTimers;
|
344 | forceCoverageMatch: Array<string>;
|
345 | globals: ConfigGlobals;
|
346 | haste: HasteConfig;
|
347 | injectGlobals: boolean;
|
348 | listTests: boolean;
|
349 | maxConcurrency: number;
|
350 | maxWorkers: number | string;
|
351 | moduleDirectories: Array<string>;
|
352 | moduleFileExtensions: Array<string>;
|
353 | moduleNameMapper: Record<string, string | Array<string>>;
|
354 | modulePathIgnorePatterns: Array<string>;
|
355 | noStackTrace: boolean;
|
356 | notify: boolean;
|
357 | notifyMode: NotifyMode;
|
358 | passWithNoTests: boolean;
|
359 | prettierPath: string;
|
360 | resetMocks: boolean;
|
361 | resetModules: boolean;
|
362 | restoreMocks: boolean;
|
363 | roots: Array<string>;
|
364 | runTestsByPath: boolean;
|
365 | runner: string;
|
366 | setupFiles: Array<string>;
|
367 | setupFilesAfterEnv: Array<string>;
|
368 | skipFilter: boolean;
|
369 | slowTestThreshold: number;
|
370 | snapshotFormat: SnapshotFormat;
|
371 | snapshotSerializers: Array<string>;
|
372 | testEnvironment: string;
|
373 | testEnvironmentOptions: Record<string, unknown>;
|
374 | testFailureExitCode: string | number;
|
375 | testLocationInResults: boolean;
|
376 | testMatch: Array<string>;
|
377 | testPathIgnorePatterns: Array<string>;
|
378 | testRegex: Array<string>;
|
379 | testRunner: string;
|
380 | testSequencer: string;
|
381 | transformIgnorePatterns: Array<string>;
|
382 | useStderr: boolean;
|
383 | watch: boolean;
|
384 | watchPathIgnorePatterns: Array<string>;
|
385 | watchman: boolean;
|
386 | };
|
387 |
|
388 | declare interface Describe extends DescribeBase {
|
389 | only: DescribeBase;
|
390 | skip: DescribeBase;
|
391 | }
|
392 |
|
393 | declare interface DescribeBase {
|
394 | (blockName: BlockNameLike, blockFn: BlockFn): void;
|
395 | each: Each<BlockFn>;
|
396 | }
|
397 |
|
398 | declare type DescribeBlock = {
|
399 | type: 'describeBlock';
|
400 | children: Array<DescribeBlock | TestEntry>;
|
401 | hooks: Array<Hook>;
|
402 | mode: BlockMode;
|
403 | name: BlockName_2;
|
404 | parent?: DescribeBlock;
|
405 |
|
406 | tests: Array<TestEntry>;
|
407 | };
|
408 |
|
409 | declare type DisplayName = {
|
410 | name: string;
|
411 | color: typeof ForegroundColor;
|
412 | };
|
413 |
|
414 | declare type DoneFn = Global.DoneFn;
|
415 |
|
416 | declare type DoneFn_2 = (reason?: string | Error) => void;
|
417 |
|
418 | declare type DoneTakingTestFn = (
|
419 | this: TestContext,
|
420 | done: DoneFn_2,
|
421 | ) => ValidTestReturnValues;
|
422 |
|
423 | declare interface Each<EachFn extends TestFn | BlockFn> {
|
424 | <T extends Record<string, unknown>>(table: ReadonlyArray<T>): (
|
425 | name: string | NameLike,
|
426 | fn: (arg: T) => ReturnType<EachFn>,
|
427 | timeout?: number,
|
428 | ) => void;
|
429 | <T extends readonly [unknown, ...Array<unknown>]>(table: ReadonlyArray<T>): (
|
430 | name: string | NameLike,
|
431 | fn: (...args: T) => ReturnType<EachFn>,
|
432 | timeout?: number,
|
433 | ) => void;
|
434 | <T extends readonly [unknown, ...Array<unknown>]>(table: T): (
|
435 | name: string | NameLike,
|
436 | fn: (...args: T) => ReturnType<EachFn>,
|
437 | timeout?: number,
|
438 | ) => void;
|
439 | <T extends ReadonlyArray<unknown>>(table: ReadonlyArray<T>): (
|
440 | name: string | NameLike,
|
441 | fn: (...args: T) => ReturnType<EachFn>,
|
442 | timeout?: number,
|
443 | ) => void;
|
444 | <T extends ReadonlyArray<unknown>>(table: T): (
|
445 | name: string | NameLike,
|
446 | fn: (...args: T) => ReturnType<EachFn>,
|
447 | timeout?: number,
|
448 | ) => void;
|
449 | <T = unknown>(strings: TemplateStringsArray, ...expressions: Array<T>): (
|
450 | name: string | NameLike,
|
451 | fn: (arg: Record<string, T>) => ReturnType<EachFn>,
|
452 | timeout?: number,
|
453 | ) => void;
|
454 | <T extends Record<string, unknown>>(
|
455 | strings: TemplateStringsArray,
|
456 | ...expressions: Array<unknown>
|
457 | ): (
|
458 | name: string | NameLike,
|
459 | fn: (arg: T) => ReturnType<EachFn>,
|
460 | timeout?: number,
|
461 | ) => void;
|
462 | }
|
463 |
|
464 | declare type EachTable = ArrayTable | TemplateTable;
|
465 |
|
466 | declare type EachTestFn<EachCallback extends TestCallback> = (
|
467 | ...args: ReadonlyArray<any>
|
468 | ) => ReturnType<EachCallback>;
|
469 |
|
470 | declare type Event_2 = SyncEvent | AsyncEvent;
|
471 |
|
472 | declare interface EventHandler {
|
473 | (event: AsyncEvent, state: State): void | Promise<void>;
|
474 | (event: SyncEvent, state: State): void;
|
475 | }
|
476 |
|
477 | declare type Exception = any;
|
478 |
|
479 | declare interface Failing<T extends TestFn> {
|
480 | (testName: TestNameLike, fn: T, timeout?: number): void;
|
481 | each: Each<T>;
|
482 | }
|
483 |
|
484 | declare type FakeableAPI =
|
485 | | 'Date'
|
486 | | 'hrtime'
|
487 | | 'nextTick'
|
488 | | 'performance'
|
489 | | 'queueMicrotask'
|
490 | | 'requestAnimationFrame'
|
491 | | 'cancelAnimationFrame'
|
492 | | 'requestIdleCallback'
|
493 | | 'cancelIdleCallback'
|
494 | | 'setImmediate'
|
495 | | 'clearImmediate'
|
496 | | 'setInterval'
|
497 | | 'clearInterval'
|
498 | | 'setTimeout'
|
499 | | 'clearTimeout';
|
500 |
|
501 | declare type FakeTimers = GlobalFakeTimersConfig &
|
502 | (
|
503 | | (FakeTimersConfig & {
|
504 | now?: Exclude<FakeTimersConfig['now'], Date>;
|
505 | })
|
506 | | LegacyFakeTimersConfig
|
507 | );
|
508 |
|
509 | declare type FakeTimersConfig = {
|
510 | |
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 | advanceTimers?: boolean | number;
|
519 | |
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 | doNotFake?: Array<FakeableAPI>;
|
527 | |
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 | now?: number | Date;
|
534 | |
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 | timerLimit?: number;
|
542 | |
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 | legacyFakeTimers?: false;
|
550 | };
|
551 |
|
552 | declare type FormattedError = string;
|
553 |
|
554 | declare type GeneratorReturningTestFn = (
|
555 | this: TestContext,
|
556 | ) => TestReturnValueGenerator;
|
557 |
|
558 | declare namespace Global {
|
559 | export {
|
560 | ValidTestReturnValues,
|
561 | TestReturnValue,
|
562 | TestContext,
|
563 | DoneFn_2 as DoneFn,
|
564 | DoneTakingTestFn,
|
565 | PromiseReturningTestFn,
|
566 | GeneratorReturningTestFn,
|
567 | NameLike,
|
568 | TestName,
|
569 | TestNameLike,
|
570 | TestFn,
|
571 | ConcurrentTestFn,
|
572 | BlockFn,
|
573 | BlockName,
|
574 | BlockNameLike,
|
575 | HookFn,
|
576 | Col,
|
577 | Row,
|
578 | Table,
|
579 | ArrayTable,
|
580 | TemplateTable,
|
581 | TemplateData,
|
582 | EachTable,
|
583 | TestCallback,
|
584 | EachTestFn,
|
585 | HookBase,
|
586 | Failing,
|
587 | ItBase,
|
588 | It,
|
589 | ItConcurrentBase,
|
590 | ItConcurrentExtended,
|
591 | ItConcurrent,
|
592 | DescribeBase,
|
593 | Describe,
|
594 | TestFrameworkGlobals,
|
595 | GlobalAdditions,
|
596 | Global_2 as Global,
|
597 | };
|
598 | }
|
599 | export {Global};
|
600 |
|
601 | declare interface Global_2
|
602 | extends GlobalAdditions,
|
603 | Omit<typeof globalThis, keyof GlobalAdditions> {
|
604 | [extras: PropertyKey]: unknown;
|
605 | }
|
606 |
|
607 | declare interface GlobalAdditions extends TestFrameworkGlobals {
|
608 | __coverage__: CoverageMapData;
|
609 | }
|
610 |
|
611 | declare type GlobalConfig = {
|
612 | bail: number;
|
613 | changedSince?: string;
|
614 | changedFilesWithAncestor: boolean;
|
615 | ci: boolean;
|
616 | collectCoverage: boolean;
|
617 | collectCoverageFrom: Array<string>;
|
618 | coverageDirectory: string;
|
619 | coveragePathIgnorePatterns?: Array<string>;
|
620 | coverageProvider: CoverageProvider;
|
621 | coverageReporters: CoverageReporters;
|
622 | coverageThreshold?: CoverageThreshold;
|
623 | detectLeaks: boolean;
|
624 | detectOpenHandles: boolean;
|
625 | expand: boolean;
|
626 | filter?: string;
|
627 | findRelatedTests: boolean;
|
628 | forceExit: boolean;
|
629 | json: boolean;
|
630 | globalSetup?: string;
|
631 | globalTeardown?: string;
|
632 | lastCommit: boolean;
|
633 | logHeapUsage: boolean;
|
634 | listTests: boolean;
|
635 | maxConcurrency: number;
|
636 | maxWorkers: number;
|
637 | noStackTrace: boolean;
|
638 | nonFlagArgs: Array<string>;
|
639 | noSCM?: boolean;
|
640 | notify: boolean;
|
641 | notifyMode: NotifyMode;
|
642 | outputFile?: string;
|
643 | onlyChanged: boolean;
|
644 | onlyFailures: boolean;
|
645 | passWithNoTests: boolean;
|
646 | projects: Array<string>;
|
647 | replname?: string;
|
648 | reporters?: Array<ReporterConfig>;
|
649 | runTestsByPath: boolean;
|
650 | rootDir: string;
|
651 | shard?: ShardConfig;
|
652 | silent?: boolean;
|
653 | skipFilter: boolean;
|
654 | snapshotFormat: SnapshotFormat;
|
655 | errorOnDeprecated: boolean;
|
656 | testFailureExitCode: number;
|
657 | testNamePattern?: string;
|
658 | testPathPattern: string;
|
659 | testResultsProcessor?: string;
|
660 | testSequencer: string;
|
661 | testTimeout?: number;
|
662 | updateSnapshot: SnapshotUpdateState;
|
663 | useStderr: boolean;
|
664 | verbose?: boolean;
|
665 | watch: boolean;
|
666 | watchAll: boolean;
|
667 | watchman: boolean;
|
668 | watchPlugins?: Array<{
|
669 | path: string;
|
670 | config: Record<string, unknown>;
|
671 | }> | null;
|
672 | workerIdleMemoryLimit?: number;
|
673 | };
|
674 |
|
675 | declare type GlobalErrorHandlers = {
|
676 | uncaughtException: Array<(exception: Exception) => void>;
|
677 | unhandledRejection: Array<
|
678 | (exception: Exception, promise: Promise<unknown>) => void
|
679 | >;
|
680 | };
|
681 |
|
682 | declare type GlobalFakeTimersConfig = {
|
683 | |
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 | enableGlobally?: boolean;
|
690 | };
|
691 |
|
692 | declare type HasteConfig = {
|
693 |
|
694 | computeSha1?: boolean;
|
695 |
|
696 | defaultPlatform?: string | null;
|
697 |
|
698 | forceNodeFilesystemAPI?: boolean;
|
699 | |
700 |
|
701 |
|
702 |
|
703 |
|
704 | enableSymlinks?: boolean;
|
705 |
|
706 | hasteImplModulePath?: string;
|
707 |
|
708 | platforms?: Array<string>;
|
709 |
|
710 | throwOnModuleCollision?: boolean;
|
711 |
|
712 | hasteMapModulePath?: string;
|
713 |
|
714 | retainAllFiles?: boolean;
|
715 | };
|
716 |
|
717 | declare type Hook = {
|
718 | asyncError: Error;
|
719 | fn: HookFn_2;
|
720 | type: HookType;
|
721 | parent: DescribeBlock;
|
722 | seenDone: boolean;
|
723 | timeout: number | undefined | null;
|
724 | };
|
725 |
|
726 | declare interface HookBase {
|
727 | (fn: HookFn, timeout?: number): void;
|
728 | }
|
729 |
|
730 | declare type HookFn = TestFn;
|
731 |
|
732 | declare type HookFn_2 = Global.HookFn;
|
733 |
|
734 | declare type HookType = SharedHookType | 'afterEach' | 'beforeEach';
|
735 |
|
736 | declare type InitialOptions = Partial<{
|
737 | automock: boolean;
|
738 | bail: boolean | number;
|
739 | cache: boolean;
|
740 | cacheDirectory: string;
|
741 | ci: boolean;
|
742 | clearMocks: boolean;
|
743 | changedFilesWithAncestor: boolean;
|
744 | changedSince: string;
|
745 | collectCoverage: boolean;
|
746 | collectCoverageFrom: Array<string>;
|
747 | coverageDirectory: string;
|
748 | coveragePathIgnorePatterns: Array<string>;
|
749 | coverageProvider: CoverageProvider;
|
750 | coverageReporters: CoverageReporters;
|
751 | coverageThreshold: CoverageThreshold;
|
752 | dependencyExtractor: string;
|
753 | detectLeaks: boolean;
|
754 | detectOpenHandles: boolean;
|
755 | displayName: string | DisplayName;
|
756 | expand: boolean;
|
757 | extensionsToTreatAsEsm: Array<string>;
|
758 | fakeTimers: FakeTimers;
|
759 | filter: string;
|
760 | findRelatedTests: boolean;
|
761 | forceCoverageMatch: Array<string>;
|
762 | forceExit: boolean;
|
763 | json: boolean;
|
764 | globals: ConfigGlobals;
|
765 | globalSetup: string | null | undefined;
|
766 | globalTeardown: string | null | undefined;
|
767 | haste: HasteConfig;
|
768 | id: string;
|
769 | injectGlobals: boolean;
|
770 | reporters: Array<string | ReporterConfig>;
|
771 | logHeapUsage: boolean;
|
772 | lastCommit: boolean;
|
773 | listTests: boolean;
|
774 | maxConcurrency: number;
|
775 | maxWorkers: number | string;
|
776 | moduleDirectories: Array<string>;
|
777 | moduleFileExtensions: Array<string>;
|
778 | moduleNameMapper: {
|
779 | [key: string]: string | Array<string>;
|
780 | };
|
781 | modulePathIgnorePatterns: Array<string>;
|
782 | modulePaths: Array<string>;
|
783 | noStackTrace: boolean;
|
784 | notify: boolean;
|
785 | notifyMode: string;
|
786 | onlyChanged: boolean;
|
787 | onlyFailures: boolean;
|
788 | outputFile: string;
|
789 | passWithNoTests: boolean;
|
790 | preset: string | null | undefined;
|
791 | prettierPath: string | null | undefined;
|
792 | projects: Array<string | InitialProjectOptions>;
|
793 | replname: string | null | undefined;
|
794 | resetMocks: boolean;
|
795 | resetModules: boolean;
|
796 | resolver: string | null | undefined;
|
797 | restoreMocks: boolean;
|
798 | rootDir: string;
|
799 | roots: Array<string>;
|
800 | runner: string;
|
801 | runTestsByPath: boolean;
|
802 | runtime: string;
|
803 | sandboxInjectedGlobals: Array<string>;
|
804 | setupFiles: Array<string>;
|
805 | setupFilesAfterEnv: Array<string>;
|
806 | silent: boolean;
|
807 | skipFilter: boolean;
|
808 | skipNodeResolution: boolean;
|
809 | slowTestThreshold: number;
|
810 | snapshotResolver: string;
|
811 | snapshotSerializers: Array<string>;
|
812 | snapshotFormat: SnapshotFormat;
|
813 | errorOnDeprecated: boolean;
|
814 | testEnvironment: string;
|
815 | testEnvironmentOptions: Record<string, unknown>;
|
816 | testFailureExitCode: string | number;
|
817 | testLocationInResults: boolean;
|
818 | testMatch: Array<string>;
|
819 | testNamePattern: string;
|
820 | testPathIgnorePatterns: Array<string>;
|
821 | testRegex: string | Array<string>;
|
822 | testResultsProcessor: string;
|
823 | testRunner: string;
|
824 | testSequencer: string;
|
825 | testTimeout: number;
|
826 | transform: {
|
827 | [regex: string]: string | TransformerConfig;
|
828 | };
|
829 | transformIgnorePatterns: Array<string>;
|
830 | watchPathIgnorePatterns: Array<string>;
|
831 | unmockedModulePathPatterns: Array<string>;
|
832 | updateSnapshot: boolean;
|
833 | useStderr: boolean;
|
834 | verbose?: boolean;
|
835 | watch: boolean;
|
836 | watchAll: boolean;
|
837 | watchman: boolean;
|
838 | watchPlugins: Array<string | [string, Record<string, unknown>]>;
|
839 | workerIdleMemoryLimit: number | string;
|
840 | }>;
|
841 |
|
842 | declare type InitialOptionsWithRootDir = InitialOptions &
|
843 | Required<Pick<InitialOptions, 'rootDir'>>;
|
844 |
|
845 | declare type InitialProjectOptions = Pick<
|
846 | InitialOptions & {
|
847 | cwd?: string;
|
848 | },
|
849 | keyof ProjectConfig
|
850 | >;
|
851 |
|
852 | declare interface It extends ItBase {
|
853 | only: ItBase;
|
854 | skip: ItBase;
|
855 | todo: (testName: TestNameLike) => void;
|
856 | }
|
857 |
|
858 | declare interface ItBase {
|
859 | (testName: TestNameLike, fn: TestFn, timeout?: number): void;
|
860 | each: Each<TestFn>;
|
861 | failing: Failing<TestFn>;
|
862 | }
|
863 |
|
864 | declare interface ItConcurrent extends It {
|
865 | concurrent: ItConcurrentExtended;
|
866 | }
|
867 |
|
868 | declare interface ItConcurrentBase {
|
869 | (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void;
|
870 | each: Each<ConcurrentTestFn>;
|
871 | failing: Failing<ConcurrentTestFn>;
|
872 | }
|
873 |
|
874 | declare interface ItConcurrentExtended extends ItConcurrentBase {
|
875 | only: ItConcurrentBase;
|
876 | skip: ItConcurrentBase;
|
877 | }
|
878 |
|
879 | declare interface JestGlobals extends Global.TestFrameworkGlobals {
|
880 | expect: unknown;
|
881 | }
|
882 |
|
883 | declare type LegacyFakeTimersConfig = {
|
884 | |
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 | legacyFakeTimers?: true;
|
892 | };
|
893 |
|
894 | declare type MatcherResults = {
|
895 | actual: unknown;
|
896 | expected: unknown;
|
897 | name: string;
|
898 | pass: boolean;
|
899 | };
|
900 |
|
901 | declare type NameLike = number | Function;
|
902 |
|
903 | declare type NotifyMode =
|
904 | | 'always'
|
905 | | 'failure'
|
906 | | 'success'
|
907 | | 'change'
|
908 | | 'success-change'
|
909 | | 'failure-change';
|
910 |
|
911 | declare type Process = NodeJS.Process;
|
912 |
|
913 | declare type ProjectConfig = {
|
914 | automock: boolean;
|
915 | cache: boolean;
|
916 | cacheDirectory: string;
|
917 | clearMocks: boolean;
|
918 | coveragePathIgnorePatterns: Array<string>;
|
919 | cwd: string;
|
920 | dependencyExtractor?: string;
|
921 | detectLeaks: boolean;
|
922 | detectOpenHandles: boolean;
|
923 | displayName?: DisplayName;
|
924 | errorOnDeprecated: boolean;
|
925 | extensionsToTreatAsEsm: Array<string>;
|
926 | fakeTimers: FakeTimers;
|
927 | filter?: string;
|
928 | forceCoverageMatch: Array<string>;
|
929 | globalSetup?: string;
|
930 | globalTeardown?: string;
|
931 | globals: ConfigGlobals;
|
932 | haste: HasteConfig;
|
933 | id: string;
|
934 | injectGlobals: boolean;
|
935 | moduleDirectories: Array<string>;
|
936 | moduleFileExtensions: Array<string>;
|
937 | moduleNameMapper: Array<[string, string]>;
|
938 | modulePathIgnorePatterns: Array<string>;
|
939 | modulePaths?: Array<string>;
|
940 | prettierPath: string;
|
941 | resetMocks: boolean;
|
942 | resetModules: boolean;
|
943 | resolver?: string;
|
944 | restoreMocks: boolean;
|
945 | rootDir: string;
|
946 | roots: Array<string>;
|
947 | runner: string;
|
948 | runtime?: string;
|
949 | sandboxInjectedGlobals: Array<keyof typeof globalThis>;
|
950 | setupFiles: Array<string>;
|
951 | setupFilesAfterEnv: Array<string>;
|
952 | skipFilter: boolean;
|
953 | skipNodeResolution?: boolean;
|
954 | slowTestThreshold: number;
|
955 | snapshotResolver?: string;
|
956 | snapshotSerializers: Array<string>;
|
957 | snapshotFormat: SnapshotFormat;
|
958 | testEnvironment: string;
|
959 | testEnvironmentOptions: Record<string, unknown>;
|
960 | testMatch: Array<string>;
|
961 | testLocationInResults: boolean;
|
962 | testPathIgnorePatterns: Array<string>;
|
963 | testRegex: Array<string | RegExp>;
|
964 | testRunner: string;
|
965 | transform: Array<[string, string, Record<string, unknown>]>;
|
966 | transformIgnorePatterns: Array<string>;
|
967 | watchPathIgnorePatterns: Array<string>;
|
968 | unmockedModulePathPatterns?: Array<string>;
|
969 | workerIdleMemoryLimit?: number;
|
970 | };
|
971 |
|
972 | declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue;
|
973 |
|
974 | declare type ReporterConfig = [string, Record<string, unknown>];
|
975 |
|
976 | declare type Row = ReadonlyArray<Col>;
|
977 |
|
978 | declare type RunResult = {
|
979 | unhandledErrors: Array<FormattedError>;
|
980 | testResults: TestResults;
|
981 | };
|
982 |
|
983 | declare type SerializableError = {
|
984 | code?: unknown;
|
985 | message: string;
|
986 | stack: string | null | undefined;
|
987 | type?: string;
|
988 | };
|
989 |
|
990 | declare type ShardConfig = {
|
991 | shardIndex: number;
|
992 | shardCount: number;
|
993 | };
|
994 |
|
995 | declare type SharedHookType = 'afterAll' | 'beforeAll';
|
996 |
|
997 | declare type SnapshotUpdateState = 'all' | 'new' | 'none';
|
998 |
|
999 | declare type State = {
|
1000 | currentDescribeBlock: DescribeBlock;
|
1001 | currentlyRunningTest?: TestEntry | null;
|
1002 | expand?: boolean;
|
1003 | hasFocusedTests: boolean;
|
1004 | hasStarted: boolean;
|
1005 | originalGlobalErrorHandlers?: GlobalErrorHandlers;
|
1006 | parentProcess: Process | null;
|
1007 | rootDescribeBlock: DescribeBlock;
|
1008 | testNamePattern?: RegExp | null;
|
1009 | testTimeout: number;
|
1010 | unhandledErrors: Array<Exception>;
|
1011 | includeTestLocationInResult: boolean;
|
1012 | maxConcurrency: number;
|
1013 | };
|
1014 |
|
1015 | declare type Status =
|
1016 | | 'passed'
|
1017 | | 'failed'
|
1018 | | 'skipped'
|
1019 | | 'pending'
|
1020 | | 'todo'
|
1021 | | 'disabled';
|
1022 |
|
1023 | declare type SyncEvent =
|
1024 | | {
|
1025 | asyncError: Error;
|
1026 | mode: BlockMode;
|
1027 | name: 'start_describe_definition';
|
1028 | blockName: BlockName_2;
|
1029 | }
|
1030 | | {
|
1031 | mode: BlockMode;
|
1032 | name: 'finish_describe_definition';
|
1033 | blockName: BlockName_2;
|
1034 | }
|
1035 | | {
|
1036 | asyncError: Error;
|
1037 | name: 'add_hook';
|
1038 | hookType: HookType;
|
1039 | fn: HookFn_2;
|
1040 | timeout: number | undefined;
|
1041 | }
|
1042 | | {
|
1043 | asyncError: Error;
|
1044 | name: 'add_test';
|
1045 | testName: TestName_2;
|
1046 | fn: TestFn_2;
|
1047 | mode?: TestMode;
|
1048 | concurrent: boolean;
|
1049 | timeout: number | undefined;
|
1050 | failing: boolean;
|
1051 | }
|
1052 | | {
|
1053 | name: 'error';
|
1054 | error: Exception;
|
1055 | };
|
1056 |
|
1057 | declare type Table = ReadonlyArray<Row>;
|
1058 |
|
1059 | declare type TemplateData = ReadonlyArray<unknown>;
|
1060 |
|
1061 | declare type TemplateTable = TemplateStringsArray;
|
1062 |
|
1063 | declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn;
|
1064 |
|
1065 | declare type TestContext = Record<string, unknown>;
|
1066 |
|
1067 | declare type TestContext_2 = Global.TestContext;
|
1068 |
|
1069 | declare type TestEntry = {
|
1070 | type: 'test';
|
1071 | asyncError: Exception;
|
1072 | errors: Array<TestError>;
|
1073 | retryReasons: Array<TestError>;
|
1074 | fn: TestFn_2;
|
1075 | invocations: number;
|
1076 | mode: TestMode;
|
1077 | concurrent: boolean;
|
1078 | name: TestName_2;
|
1079 | parent: DescribeBlock;
|
1080 | startedAt?: number | null;
|
1081 | duration?: number | null;
|
1082 | seenDone: boolean;
|
1083 | status?: TestStatus | null;
|
1084 | timeout?: number;
|
1085 | failing: boolean;
|
1086 | };
|
1087 |
|
1088 | declare type TestError = Exception | [Exception | undefined, Exception];
|
1089 |
|
1090 | declare type TestFn =
|
1091 | | PromiseReturningTestFn
|
1092 | | GeneratorReturningTestFn
|
1093 | | DoneTakingTestFn;
|
1094 |
|
1095 | declare type TestFn_2 = Global.TestFn;
|
1096 |
|
1097 | declare interface TestFrameworkGlobals {
|
1098 | it: ItConcurrent;
|
1099 | test: ItConcurrent;
|
1100 | fit: ItBase & {
|
1101 | concurrent?: ItConcurrentBase;
|
1102 | };
|
1103 | xit: ItBase;
|
1104 | xtest: ItBase;
|
1105 | describe: Describe;
|
1106 | xdescribe: DescribeBase;
|
1107 | fdescribe: DescribeBase;
|
1108 | beforeAll: HookBase;
|
1109 | beforeEach: HookBase;
|
1110 | afterEach: HookBase;
|
1111 | afterAll: HookBase;
|
1112 | }
|
1113 |
|
1114 | declare type TestMode = BlockMode;
|
1115 |
|
1116 | declare type TestName = string;
|
1117 |
|
1118 | declare type TestName_2 = Global.TestName;
|
1119 |
|
1120 | declare type TestNameLike = TestName | NameLike;
|
1121 |
|
1122 | declare type TestNameLike_2 = Global.TestNameLike;
|
1123 |
|
1124 | declare namespace TestResult {
|
1125 | export {AssertionResult, SerializableError};
|
1126 | }
|
1127 | export {TestResult};
|
1128 |
|
1129 | declare type TestResult_2 = {
|
1130 | duration?: number | null;
|
1131 | errors: Array<FormattedError>;
|
1132 | errorsDetailed: Array<MatcherResults | unknown>;
|
1133 | invocations: number;
|
1134 | status: TestStatus;
|
1135 | location?: {
|
1136 | column: number;
|
1137 | line: number;
|
1138 | } | null;
|
1139 | retryReasons: Array<FormattedError>;
|
1140 | testPath: Array<TestName_2 | BlockName_2>;
|
1141 | };
|
1142 |
|
1143 | declare type TestResults = Array<TestResult_2>;
|
1144 |
|
1145 | declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise;
|
1146 |
|
1147 | declare type TestReturnValueGenerator = Generator<void, unknown, void>;
|
1148 |
|
1149 | declare type TestReturnValuePromise = Promise<unknown>;
|
1150 |
|
1151 | declare type TestStatus = 'skip' | 'done' | 'todo';
|
1152 |
|
1153 | declare type TransformerConfig = [string, Record<string, unknown>];
|
1154 |
|
1155 | declare type TransformResult = {
|
1156 | code: string;
|
1157 | originalCode: string;
|
1158 | sourceMapPath: string | null;
|
1159 | };
|
1160 |
|
1161 | declare namespace TransformTypes {
|
1162 | export {TransformResult};
|
1163 | }
|
1164 | export {TransformTypes};
|
1165 |
|
1166 | declare type ValidTestReturnValues = void | undefined;
|
1167 |
|
1168 | export {};
|