Skip to content

Commit

Permalink
Use hasSCM utility in SearchSource.findTestRelatedToChangeFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
chenesan committed Apr 22, 2020
1 parent 4abe272 commit e724874
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/jest-core/src/SearchSource.ts
Expand Up @@ -247,14 +247,11 @@ export default class SearchSource {
changedFilesInfo: ChangedFiles,
collectCoverage: boolean,
): SearchResult {
const {repos, changedFiles} = changedFilesInfo;
// no SCM (git/hg/...) is found in any of the roots.
const noSCM = (Object.keys(repos) as Array<
keyof ChangedFiles['repos']
>).every(scm => repos[scm].size === 0);
return noSCM
? {noSCM: true, tests: []}
: this.findRelatedTests(changedFiles, collectCoverage);
if (!hasSCM(changedFilesInfo)) {
return {noSCM: true, tests: []};
}
const {changedFiles} = changedFilesInfo;
return this.findRelatedTests(changedFiles, collectCoverage);
}

private _getTestPaths(
Expand Down

0 comments on commit e724874

Please sign in to comment.