Tests: fix cleanup in cases where server doesn't stop

This commit is contained in:
Timmy Willison 2024-03-08 18:40:55 -05:00
parent 5aa7ed888d
commit 0754d59664

View File

@ -170,21 +170,21 @@ export async function run( {
async function cleanup() { async function cleanup() {
console.log( "Cleaning up..." ); console.log( "Cleaning up..." );
await cleanupAllBrowsers( { verbose } );
cleanupAllJSDOM( { verbose } );
if ( tunnel ) { if ( tunnel ) {
await tunnel.stop(); await tunnel.stop();
if ( verbose ) { if ( verbose ) {
console.log( "Stopped BrowserStackLocal." ); console.log( "Stopped BrowserStackLocal." );
} }
} }
await cleanupAllBrowsers( { verbose } );
cleanupAllJSDOM( { verbose } );
} }
asyncExitHook( asyncExitHook(
async() => { async() => {
await stopServer();
await cleanup(); await cleanup();
await stopServer();
}, },
{ wait: EXIT_HOOK_WAIT_TIMEOUT } { wait: EXIT_HOOK_WAIT_TIMEOUT }
); );