Skip to content

Commit a31fc41

Browse files
Connormihathymikee
authored andcommittedJan 14, 2020
jest-core: optimize collecting collectCoverageFrom (#9399)
1 parent 7f69176 commit a31fc41

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed
 

‎packages/jest-core/src/SearchSource.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ export default class SearchSource {
187187
return;
188188
}
189189

190-
testModule.dependencies
191-
.filter(p => allPathsAbsolute.includes(p))
192-
.map(filename => {
193-
filename = replaceRootDirInPath(
194-
this._context.config.rootDir,
195-
filename,
196-
);
197-
return path.isAbsolute(filename)
190+
testModule.dependencies.forEach(p => {
191+
if (!allPathsAbsolute.includes(p)) {
192+
return;
193+
}
194+
195+
const filename = replaceRootDirInPath(this._context.config.rootDir, p);
196+
collectCoverageFrom.add(
197+
path.isAbsolute(filename)
198198
? path.relative(this._context.config.rootDir, filename)
199-
: filename;
200-
})
201-
.forEach(filename => collectCoverageFrom.add(filename));
199+
: filename,
200+
);
201+
});
202202
});
203203

204204
return {

0 commit comments

Comments
 (0)
Please sign in to comment.