@@ -55,49 +55,6 @@ export function patchJasmine(Zone: ZoneType): void {
5555 ( global [ symbol ( 'fakeAsyncPatchLock' ) ] === true ||
5656 global [ symbol ( 'fakeAsyncAutoFakeAsyncWhenClockPatched' ) ] === true ) ;
5757
58- const ignoreUnhandledRejection = global [ symbol ( 'ignoreUnhandledRejection' ) ] === true ;
59-
60- if ( ! ignoreUnhandledRejection ) {
61- const globalErrors = ( jasmine as any ) . GlobalErrors ;
62- if ( globalErrors && ! ( jasmine as any ) [ symbol ( 'GlobalErrors' ) ] ) {
63- ( jasmine as any ) [ symbol ( 'GlobalErrors' ) ] = globalErrors ;
64- ( jasmine as any ) . GlobalErrors = function ( ) {
65- const instance = new globalErrors ( ) ;
66- const originalInstall = instance . install ;
67- if ( originalInstall && ! instance [ symbol ( 'install' ) ] ) {
68- instance [ symbol ( 'install' ) ] = originalInstall ;
69- instance . install = function ( ) {
70- const isNode = typeof process !== 'undefined' && ! ! process . on ;
71- // Note: Jasmine checks internally if `process` and `process.on` is defined.
72- // Otherwise, it installs the browser rejection handler through the
73- // `global.addEventListener`. This code may be run in the browser environment where
74- // `process` is not defined, and this will lead to a runtime exception since webpack 5
75- // removed automatic Node.js polyfills. Note, that events are named differently, it's
76- // `unhandledRejection` in Node.js and `unhandledrejection` in the browser.
77- const originalHandlers : any [ ] = isNode
78- ? process . listeners ( 'unhandledRejection' )
79- : global . eventListeners ( 'unhandledrejection' ) ;
80- const result = originalInstall . apply ( this , arguments ) ;
81- isNode
82- ? process . removeAllListeners ( 'unhandledRejection' )
83- : global . removeAllListeners ( 'unhandledrejection' ) ;
84- if ( originalHandlers ) {
85- originalHandlers . forEach ( ( handler ) => {
86- if ( isNode ) {
87- process . on ( 'unhandledRejection' , handler ) ;
88- } else {
89- global . addEventListener ( 'unhandledrejection' , handler ) ;
90- }
91- } ) ;
92- }
93- return result ;
94- } ;
95- }
96- return instance ;
97- } ;
98- }
99- }
100-
10158 // Monkey patch all of the jasmine DSL so that each function runs in appropriate zone.
10259 const jasmineEnv : any = jasmine . getEnv ( ) ;
10360 [ 'describe' , 'xdescribe' , 'fdescribe' ] . forEach ( ( methodName ) => {
0 commit comments