File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- load ("//tools:defaults.bzl" , "angular_jasmine_test " , "ts_project " )
1+ load ("//tools:defaults.bzl" , "ts_project " , "zoneless_jasmine_test " )
22
33ts_project (
44 name = "test_lib" ,
@@ -13,7 +13,7 @@ ts_project(
1313 ],
1414)
1515
16- angular_jasmine_test (
16+ zoneless_jasmine_test (
1717 name = "test" ,
1818 data = [
1919 ":test_lib" ,
Original file line number Diff line number Diff line change @@ -1214,6 +1214,9 @@ import {envIsSupported} from '../testing/utils';
12141214
12151215 const debuggerLogSpy = spyOn ( driver . debugger , 'log' ) ;
12161216
1217+ // To drain the microtask queue (and process all rejections)
1218+ await new Promise ( ( r ) => setTimeout ( r ) ) ;
1219+
12171220 scope . handleUnhandledRejection ( 'Test rejection reason' ) ;
12181221
12191222 expect ( debuggerLogSpy ) . toHaveBeenCalledWith (
Original file line number Diff line number Diff line change @@ -285,14 +285,10 @@ export class SwTestHarnessImpl
285285 if ( ! this . eventHandlers . has ( 'unhandledrejection' ) ) {
286286 throw new Error ( 'No unhandledrejection handler registered' ) ;
287287 }
288- const promise = Promise . reject ( reason ) ;
289- // We want to simulate an unhandled rejection, but we don't want the test runner (Node)
290- // to actually see an unhandled rejection and fail the test. So we attach a dummy handler.
291- promise . catch ( ( ) => { } ) ;
292288 const event = {
293289 reason,
294- promise,
295- } as unknown as PromiseRejectionEvent ;
290+ promise : Promise . reject ( reason ) ,
291+ } as PromiseRejectionEvent ;
296292 this . eventHandlers . get ( 'unhandledrejection' ) ! . call ( this , event ) ;
297293 }
298294
You can’t perform that action at this time.
0 commit comments