@@ -15,7 +15,7 @@ let willstart
1515
1616const abstractProcess = globalThis . process || globalThis . EXODUS_TEST_PROCESS
1717
18- if ( process . env . EXODUS_TEST_IS_BROWSER ) {
18+ if ( process . env . EXODUS_TEST_IS_BROWSER || process . env . EXODUS_TEST_PLATFORM === 'workerd' ) {
1919 globalThis . EXODUS_TEST_PROMISE = new Promise ( ( resolve ) => ( abstractProcess . _exitHook = resolve ) )
2020 if ( ! abstractProcess . _maybeProcessExitCode && abstractProcess === globalThis . process ) {
2121 // Electron with Node.js integration has real process
@@ -104,7 +104,7 @@ function enterContext(name, options) {
104104function exitContext ( ) {
105105 check ( context !== context . root )
106106 context = context . parent
107- if ( context === context . root && run !== globalThis . EXODUS_TEST_RUN ) willstart = setTimeout ( run , 0 )
107+ if ( context === context . root ) willstart = setTimeout ( run , 0 )
108108}
109109
110110async function runFunction ( fn , context ) {
@@ -185,8 +185,6 @@ async function runContext(context) {
185185async function run ( ) {
186186 check ( ! running )
187187 running = true
188- const manual = globalThis . EXODUS_TEST_RUN === run
189- const res = manual ? new Promise ( ( resolve ) => ( abstractProcess . _exitHook = resolve ) ) : undefined
190188 check ( context === context . root )
191189 await runContext ( context ) . catch ( ( error ) => {
192190 // Should not throw under regular circumstances
@@ -195,12 +193,8 @@ async function run() {
195193 } )
196194 // Let unhandled errors be processed (and set the error code)
197195 setTimeout ( ( ) => abstractProcess . _maybeProcessExitCode ?. ( ) , 0 )
198- return res
199196}
200197
201- // For workerd, expose run as a global so the wrapper can call it
202- if ( process . env . EXODUS_TEST_PLATFORM === 'workerd' ) globalThis . EXODUS_TEST_RUN = run
203-
204198async function describe ( ...args ) {
205199 const { name, options, fn } = parseArgs ( args )
206200 enterContext ( name , options )
0 commit comments