mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: fix flakey message logs; ignore delete worker failures
Close gh-5432
This commit is contained in:
parent
95a4c94b81
commit
02d2347828
@ -187,13 +187,19 @@ export async function cleanupAllBrowsers( { verbose } ) {
|
|||||||
const workersRemaining = Object.values( workers );
|
const workersRemaining = Object.values( workers );
|
||||||
const numRemaining = workersRemaining.length;
|
const numRemaining = workersRemaining.length;
|
||||||
if ( numRemaining ) {
|
if ( numRemaining ) {
|
||||||
await Promise.all(
|
try {
|
||||||
workersRemaining.map( ( worker ) => deleteWorker( worker.id ) )
|
await Promise.all(
|
||||||
);
|
workersRemaining.map( ( worker ) => deleteWorker( worker.id ) )
|
||||||
if ( verbose ) {
|
|
||||||
console.log(
|
|
||||||
`Stopped ${ numRemaining } browser${ numRemaining > 1 ? "s" : "" }.`
|
|
||||||
);
|
);
|
||||||
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export function retryTest( reportId, maxRetries ) {
|
|||||||
console.log(
|
console.log(
|
||||||
`Retrying test ${ reportId } for ${ chalk.yellow(
|
`Retrying test ${ reportId } for ${ chalk.yellow(
|
||||||
test.options.modules.join( ", " )
|
test.options.modules.join( ", " )
|
||||||
) }...`
|
) }...${ test.retries }`
|
||||||
);
|
);
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,19 @@ export async function run( {
|
|||||||
if ( errors ) {
|
if ( errors ) {
|
||||||
pendingErrors[ reportId ][ message.data.name ] = errors;
|
pendingErrors[ reportId ][ message.data.name ] = errors;
|
||||||
} else {
|
} 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;
|
break;
|
||||||
}
|
}
|
||||||
@ -103,24 +115,15 @@ export async function run( {
|
|||||||
// Handle failure
|
// Handle failure
|
||||||
if ( failed ) {
|
if ( failed ) {
|
||||||
const retry = retryTest( reportId, retries );
|
const retry = retryTest( reportId, retries );
|
||||||
|
|
||||||
|
// Retry if retryTest returns a test
|
||||||
if ( retry ) {
|
if ( retry ) {
|
||||||
return retry;
|
return retry;
|
||||||
}
|
}
|
||||||
errorMessages.push( ...Object.values( pendingErrors[ reportId ] ) );
|
errorMessages.push( ...Object.values( pendingErrors[ reportId ] ) );
|
||||||
return getNextBrowserTest( reportId );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle success
|
// Run the next test
|
||||||
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 ];
|
|
||||||
}
|
|
||||||
return getNextBrowserTest( reportId );
|
return getNextBrowserTest( reportId );
|
||||||
}
|
}
|
||||||
case "ack": {
|
case "ack": {
|
||||||
|
Loading…
Reference in New Issue
Block a user