const workersRemaining = Object.values( workers );
const numRemaining = workersRemaining.length;
if ( numRemaining ) {
- await Promise.all(
- workersRemaining.map( ( worker ) => deleteWorker( worker.id ) )
- );
- if ( verbose ) {
- console.log(
- `Stopped ${ numRemaining } browser${ numRemaining > 1 ? "s" : "" }.`
+ try {
+ await Promise.all(
+ workersRemaining.map( ( worker ) => deleteWorker( worker.id ) )
);
+ if ( verbose ) {
+ console.log(
+ `Stopped ${ numRemaining } browser${ numRemaining > 1 ? "s" : "" }.`
+ );
+ }
+ } catch ( error ) {
+
+ // Log the error, but do not consider the test run failed
+ console.error( error );
}
}
}
if ( errors ) {
pendingErrors[ reportId ][ message.data.name ] = errors;
} else {
- delete pendingErrors[ reportId ][ message.data.name ];
+ const existing = pendingErrors[ reportId ][ message.data.name ];
+
+ // Show a message for flakey tests
+ if ( existing ) {
+ console.log();
+ console.warn(
+ chalk.italic(
+ chalk.gray( existing.replace( "Test failed", "Test flakey" ) )
+ )
+ );
+ console.log();
+ delete pendingErrors[ reportId ][ message.data.name ];
+ }
}
break;
}
// Handle failure
if ( failed ) {
const retry = retryTest( reportId, retries );
+
+ // Retry if retryTest returns a test
if ( retry ) {
return retry;
}
errorMessages.push( ...Object.values( pendingErrors[ reportId ] ) );
- return getNextBrowserTest( reportId );
}
- // Handle success
- if (
- pendingErrors[ reportId ] &&
- Object.keys( pendingErrors[ reportId ] ).length
- ) {
- console.warn( "Detected flaky tests:" );
- for ( const [ , error ] in Object.entries( pendingErrors[ reportId ] ) ) {
- console.warn( chalk.italic( chalk.gray( error ) ) );
- }
- delete pendingErrors[ reportId ];
- }
+ // Run the next test
return getNextBrowserTest( reportId );
}
case "ack": {