1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import {AggregatedResult} from '@jest/test-result';
|
8 | import {BaseReporter} from '@jest/reporters';
|
9 | import type {ChangedFiles} from 'jest-changed-files';
|
10 | import type {Config} from '@jest/types';
|
11 | import {Reporter} from '@jest/reporters';
|
12 | import {ReporterContext} from '@jest/reporters';
|
13 | import {Test} from '@jest/test-result';
|
14 | import type {TestContext} from '@jest/test-result';
|
15 | import type {TestRunnerContext} from 'jest-runner';
|
16 | import type {TestWatcher} from 'jest-watcher';
|
17 |
|
18 | export declare function createTestScheduler(
|
19 | globalConfig: Config.GlobalConfig,
|
20 | context: TestSchedulerContext,
|
21 | ): Promise<TestScheduler>;
|
22 |
|
23 | declare type Filter = (testPaths: Array<string>) => Promise<{
|
24 | filtered: Array<FilterResult>;
|
25 | }>;
|
26 |
|
27 | declare type FilterResult = {
|
28 | test: string;
|
29 | message: string;
|
30 | };
|
31 |
|
32 | export declare function getVersion(): string;
|
33 |
|
34 | declare type ReporterConstructor = new (
|
35 | globalConfig: Config.GlobalConfig,
|
36 | reporterConfig: Record<string, unknown>,
|
37 | reporterContext: ReporterContext,
|
38 | ) => BaseReporter;
|
39 |
|
40 | export declare function runCLI(
|
41 | argv: Config.Argv,
|
42 | projects: Array<string>,
|
43 | ): Promise<{
|
44 | results: AggregatedResult;
|
45 | globalConfig: Config.GlobalConfig;
|
46 | }>;
|
47 |
|
48 | declare type SearchResult = {
|
49 | noSCM?: boolean;
|
50 | stats?: Stats;
|
51 | collectCoverageFrom?: Set<string>;
|
52 | tests: Array<Test>;
|
53 | total?: number;
|
54 | };
|
55 |
|
56 | export declare class SearchSource {
|
57 | private readonly _context;
|
58 | private _dependencyResolver;
|
59 | private readonly _testPathCases;
|
60 | constructor(context: TestContext);
|
61 | private _getOrBuildDependencyResolver;
|
62 | private _filterTestPathsWithStats;
|
63 | private _getAllTestPaths;
|
64 | isTestFilePath(path: string): boolean;
|
65 | findMatchingTests(testPathPattern: string): SearchResult;
|
66 | findRelatedTests(
|
67 | allPaths: Set<string>,
|
68 | collectCoverage: boolean,
|
69 | ): Promise<SearchResult>;
|
70 | findTestsByPaths(paths: Array<string>): SearchResult;
|
71 | findRelatedTestsFromPattern(
|
72 | paths: Array<string>,
|
73 | collectCoverage: boolean,
|
74 | ): Promise<SearchResult>;
|
75 | findTestRelatedToChangedFiles(
|
76 | changedFilesInfo: ChangedFiles,
|
77 | collectCoverage: boolean,
|
78 | ): Promise<SearchResult>;
|
79 | private _getTestPaths;
|
80 | filterPathsWin32(paths: Array<string>): Array<string>;
|
81 | getTestPaths(
|
82 | globalConfig: Config.GlobalConfig,
|
83 | changedFiles?: ChangedFiles,
|
84 | filter?: Filter,
|
85 | ): Promise<SearchResult>;
|
86 | findRelatedSourcesFromTestsInChangedFiles(
|
87 | changedFilesInfo: ChangedFiles,
|
88 | ): Promise<Array<string>>;
|
89 | }
|
90 |
|
91 | declare type Stats = {
|
92 | roots: number;
|
93 | testMatch: number;
|
94 | testPathIgnorePatterns: number;
|
95 | testRegex: number;
|
96 | testPathPattern?: number;
|
97 | };
|
98 |
|
99 | declare class TestScheduler {
|
100 | private readonly _context;
|
101 | private readonly _dispatcher;
|
102 | private readonly _globalConfig;
|
103 | constructor(globalConfig: Config.GlobalConfig, context: TestSchedulerContext);
|
104 | addReporter(reporter: Reporter): void;
|
105 | removeReporter(reporterConstructor: ReporterConstructor): void;
|
106 | scheduleTests(
|
107 | tests: Array<Test>,
|
108 | watcher: TestWatcher,
|
109 | ): Promise<AggregatedResult>;
|
110 | private _partitionTests;
|
111 | _setupReporters(): Promise<void>;
|
112 | private _addCustomReporter;
|
113 | private _bailIfNeeded;
|
114 | }
|
115 |
|
116 | declare type TestSchedulerContext = ReporterContext & TestRunnerContext;
|
117 |
|
118 | export {};
|