File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
packages/compass-e2e-tests/helpers Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ import {
4343import treeKill from 'tree-kill' ;
4444import { downloadPath } from './downloads' ;
4545import path from 'path' ;
46+ import { globalFixturesAbortController } from './test-runner-global-fixtures' ;
4647
4748const killAsync = async ( pid : number , signal ?: string ) => {
4849 return new Promise < void > ( ( resolve , reject ) => {
@@ -178,6 +179,27 @@ export class Compass {
178179 } ) ;
179180 }
180181
182+ // The waitUntil helper will continue running even if we started tests
183+ // teardown on abort. To work around that, we will override the default
184+ // method, will short circuit the wait if we aborted, and then throw the
185+ // error instead of returning the result
186+ browser . overwriteCommand (
187+ 'waitUntil' ,
188+ async function ( origWaitUntil , condition , options ) {
189+ // eslint-disable-next-line @typescript-eslint/await-thenable
190+ const result = await origWaitUntil ( function ( ) {
191+ if ( globalFixturesAbortController . signal . aborted ) {
192+ return true ;
193+ }
194+ return condition ( ) ;
195+ } , options ) ;
196+ if ( globalFixturesAbortController . signal . aborted ) {
197+ throw new Error ( 'Test run was aborted' ) ;
198+ }
199+ return result ;
200+ }
201+ ) ;
202+
181203 this . addDebugger ( ) ;
182204 }
183205
You can’t perform that action at this time.
0 commit comments