Skip to content

Commit

Permalink
Optimize collect array of roots (#9165)
Browse files Browse the repository at this point in the history
  • Loading branch information
Connormiha authored and SimenB committed Nov 11, 2019
1 parent 70546e0 commit 2cde649
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/jest-core/src/getChangedFilesPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ export default (
): ChangedFilesPromise | undefined => {
if (globalConfig.onlyChanged) {
const allRootsForAllProjects = configs.reduce<Array<Config.Path>>(
(roots, config) => [...roots, ...(config.roots || [])],
(roots, config) => {
if (config.roots) {
roots.push(...config.roots);
}
return roots;
},
[],
);
return getChangedFilesForRoots(allRootsForAllProjects, {
Expand Down

0 comments on commit 2cde649

Please sign in to comment.