diff --git a/packages/jest-core/src/SearchSource.ts b/packages/jest-core/src/SearchSource.ts index 31c05cdb3d3f..016408bde8bc 100644 --- a/packages/jest-core/src/SearchSource.ts +++ b/packages/jest-core/src/SearchSource.ts @@ -271,11 +271,10 @@ export default class SearchSource { globalConfig.collectCoverage, ); if (globalConfig.testPathPattern !== null) { - return { - tests: relatedTests.tests.filter(test => - new RegExp(globalConfig.testPathPattern).test(test.path), - ), - }; + return this._filterTestPathsWithStats( + relatedTests.tests, + globalConfig.testPathPattern.split('|').pop(), + ); } else { return relatedTests; }