@@ -11,9 +11,7 @@ import {isNonNullable} from 'jest-util';
11
11
import git from './git' ;
12
12
import hg from './hg' ;
13
13
import sl from './sl' ;
14
- import type { ChangedFilesPromise , Options , Repos , SCMAdapter } from './types' ;
15
-
16
- type RootPromise = ReturnType < SCMAdapter [ 'getRoot' ] > ;
14
+ import type { ChangedFilesPromise , Options , Repos } from './types' ;
17
15
18
16
export type { ChangedFiles , ChangedFilesPromise } from './types' ;
19
17
@@ -59,20 +57,11 @@ export const getChangedFilesForRoots = async (
59
57
} ;
60
58
61
59
export const findRepos = async ( roots : Array < string > ) : Promise < Repos > => {
62
- const gitRepos = await Promise . all (
63
- roots . reduce < Array < RootPromise > > (
64
- ( promises , root ) => promises . concat ( findGitRoot ( root ) ) ,
65
- [ ] ,
66
- ) ,
67
- ) ;
68
- const hgRepos = await Promise . all (
69
- roots . reduce < Array < RootPromise > > (
70
- ( promises , root ) => promises . concat ( findHgRoot ( root ) ) ,
71
- [ ] ,
72
- ) ,
73
- ) ;
74
-
75
- const slRepos = await Promise . all ( roots . map ( findSlRoot ) ) ;
60
+ const [ gitRepos , hgRepos , slRepos ] = await Promise . all ( [
61
+ Promise . all ( roots . map ( findGitRoot ) ) ,
62
+ Promise . all ( roots . map ( findHgRoot ) ) ,
63
+ Promise . all ( roots . map ( findSlRoot ) ) ,
64
+ ] ) ;
76
65
77
66
return {
78
67
git : new Set ( gitRepos . filter ( isNonNullable ) ) ,
0 commit comments