@@ -15,6 +15,15 @@ const npmVersion = spawnSync('npm', ['-s', '--version'])
1515const npmHasCiCommand = satisfies ( npmVersion , '>=5.7.0' ) ;
1616const npmHasPrepare = satisfies ( npmVersion , '>=4.0.0' ) ;
1717
18+ const configFile = path . resolve ( __dirname , '..' , 'e2e' , 'jest.config.js' ) ;
19+ let parentArgs = process . argv . slice ( 2 ) ;
20+ if ( parentArgs . includes ( '--coverage' ) ) {
21+ console . warn (
22+ 'Coverages cannot be activated for e2e tests (but can in each e2e test).'
23+ ) ;
24+ parentArgs = parentArgs . filter ( a => a !== '--coverage' ) ;
25+ }
26+
1827function getDirectories ( rootDir ) {
1928 return fs . readdirSync ( rootDir ) . filter ( function ( file ) {
2029 return fs . statSync ( path . join ( rootDir , file ) ) . isDirectory ( ) ;
@@ -135,12 +144,14 @@ function setupE2e() {
135144 } ) ;
136145}
137146
147+ // ============================================================================
148+
138149setupE2e ( ) ;
139150
140- log ( 'templates are ready, running tests' , '\n\n' ) ;
151+ log ( 'templates are ready, clearing Jest cache' ) ;
152+
153+ spawnSync ( 'jest' , [ '--clearCache' ] ) ;
154+
155+ log ( 'running tests' ) ;
141156
142- jest . run ( [
143- '--config' ,
144- path . resolve ( __dirname , '..' , 'e2e' , 'jest.config.js' ) ,
145- ...process . argv . slice ( 2 ) ,
146- ] ) ;
157+ jest . run ( [ '--config' , configFile , ...parentArgs ] ) ;
0 commit comments