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