File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { existsSync, globSync } from 'node:fs';
44import { basename , dirname , join } from 'node:path' ;
55
66const args = process . argv . slice ( 2 ) . join ( ' ' ) ;
7+ const MAX_ATTEMPTS = 2 ;
78
89// Find all spec files that have a blueprint.json in the same directory
910const projects = globSync ( '**/*.spec.ts' , { ignore : [ 'node_modules/**' ] } )
@@ -16,14 +17,21 @@ console.log(
1617
1718let failed = false ;
1819for ( const project of projects ) {
19- console . log ( `\n▶ Running: ${ project } ` ) ;
20- try {
21- execSync (
22- `RUN_PROJECT="${ project } " npx playwright test --project="${ project } " ${ args } ` ,
23- { stdio : 'inherit' } ,
24- ) ;
25- } catch {
26- failed = true ;
20+ for ( let attempt = 1 ; attempt <= MAX_ATTEMPTS ; attempt ++ ) {
21+ if ( attempt > 1 )
22+ console . log (
23+ `\n↻ Retrying: ${ project } (attempt ${ attempt } /${ MAX_ATTEMPTS } )` ,
24+ ) ;
25+ else console . log ( `\n▶ Running: ${ project } ` ) ;
26+ try {
27+ execSync (
28+ `RUN_PROJECT="${ project } " npx playwright test --project="${ project } " ${ args } ` ,
29+ { stdio : 'inherit' } ,
30+ ) ;
31+ break ;
32+ } catch {
33+ if ( attempt === MAX_ATTEMPTS ) failed = true ;
34+ }
2735 }
2836}
2937
You can’t perform that action at this time.
0 commit comments