UNPKG

1.89 kBTypeScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7import type { Test } from '@jest/test-result';
8import type { Config } from '@jest/types';
9import type { ChangedFiles } from 'jest-changed-files';
10import type { Context } from 'jest-runtime';
11import type { Filter, Stats } from './types';
12export declare type SearchResult = {
13 noSCM?: boolean;
14 stats?: Stats;
15 collectCoverageFrom?: Set<string>;
16 tests: Array<Test>;
17 total?: number;
18};
19export declare type TestSelectionConfig = {
20 input?: string;
21 findRelatedTests?: boolean;
22 onlyChanged?: boolean;
23 paths?: Array<Config.Path>;
24 shouldTreatInputAsPattern?: boolean;
25 testPathPattern?: string;
26 watch?: boolean;
27};
28export default class SearchSource {
29 private _context;
30 private _dependencyResolver;
31 private _testPathCases;
32 constructor(context: Context);
33 private _getOrBuildDependencyResolver;
34 private _filterTestPathsWithStats;
35 private _getAllTestPaths;
36 isTestFilePath(path: Config.Path): boolean;
37 findMatchingTests(testPathPattern?: string): SearchResult;
38 findRelatedTests(allPaths: Set<Config.Path>, collectCoverage: boolean): Promise<SearchResult>;
39 findTestsByPaths(paths: Array<Config.Path>): SearchResult;
40 findRelatedTestsFromPattern(paths: Array<Config.Path>, collectCoverage: boolean): Promise<SearchResult>;
41 findTestRelatedToChangedFiles(changedFilesInfo: ChangedFiles, collectCoverage: boolean): Promise<SearchResult>;
42 private _getTestPaths;
43 getTestPaths(globalConfig: Config.GlobalConfig, changedFiles: ChangedFiles | undefined, filter?: Filter): Promise<SearchResult>;
44 findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo: ChangedFiles): Promise<Array<string>>;
45}