File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1190,15 +1190,19 @@ if (typeof globalThis.addEventListener === 'function') {
11901190 e . preventDefault ( )
11911191 }
11921192 } )
1193- } else if ( typeof process !== 'undefined' && typeof process . on === 'function' ) {
1193+ } else if ( typeof process !== 'undefined' && typeof process . emit === 'function' ) {
11941194 // Node.js
1195- process . on ( 'unhandledRejection' , e => {
1196- if ( e === Neo . isDestroyed ) {
1197- return
1195+ // We need to intercept the emit, since test runners like Playwright
1196+ // will listen to unhandledRejection and fail the test
1197+ const originalEmit = process . emit ;
1198+
1199+ process . emit = function ( name , data , ...args ) {
1200+ if ( name === 'unhandledRejection' && data === Neo . isDestroyed ) {
1201+ return true
11981202 }
11991203
1200- throw e
1201- } )
1204+ return originalEmit . apply ( this , arguments )
1205+ }
12021206}
12031207
12041208export default Neo ;
Original file line number Diff line number Diff line change @@ -51,14 +51,4 @@ export function setup(options = {}) {
5151 Neo . apps ??= { } ;
5252 Neo . apps [ appConfig . windowId || 1 ] = finalAppConfig ;
5353 Neo . appsByName = { [ finalAppConfig . name ] : [ finalAppConfig ] } ;
54-
55- // Global safeguard: Intercept and suppress Neo.isDestroyed unhandled rejections.
56- // This allows floating promises (like timeouts) to reject safely during test teardown.
57- const originalEmit = process . emit ;
58- process . emit = function ( name , data , ...args ) {
59- if ( name === 'unhandledRejection' && data === Symbol . for ( 'Neo.isDestroyed' ) ) {
60- return true ;
61- }
62- return originalEmit . apply ( this , arguments ) ;
63- } ;
6454}
You can’t perform that action at this time.
0 commit comments