@@ -89,6 +89,25 @@ export default ({
8989 : mapSingleReporter ( reporter ) ;
9090 }
9191
92+ /** @param {string } testRunner */
93+ function mapTestRunner ( testRunner ) {
94+ if ( testRunner ) {
95+ const segments = testRunner . split ( sep ) ;
96+ const circusIndex = segments . indexOf ( 'jest-circus' ) ;
97+ const jasmine2Index = segments . indexOf ( 'jest-jasmine2' ) ;
98+
99+ if ( circusIndex > 0 && segments [ circusIndex - 1 ] === 'node_modules' ) {
100+ return 'jest-circus/runner' ;
101+ }
102+
103+ if ( jasmine2Index > 0 && segments [ jasmine2Index - 1 ] === 'node_modules' ) {
104+ return 'jest-jasmine2' ;
105+ }
106+ }
107+
108+ return testRunner ;
109+ }
110+
92111 async function moveExternalEntryPointsBackToRoot ( ) {
93112 for ( const [ input , output ] of Object . entries ( mapping ) ) {
94113 const newPath = redirectExternalModule ( output ) ;
@@ -130,7 +149,7 @@ export default ({
130149 setupFilesAfterEnv : projectConfig . setupFilesAfterEnv . map ( mapFile ) ,
131150 testEnvironment : mapFile ( projectConfig . testEnvironment ) ,
132151 testMatch : tests . map ( mapFile ) ,
133- testRunner : mapFile ( projectConfig . testRunner ) ,
152+ testRunner : mapTestRunner ( mapFile ( projectConfig . testRunner ) ) ,
134153 transform : undefined ,
135154 transformIgnorePatterns : undefined ,
136155 } ;
0 commit comments