File tree Expand file tree Collapse file tree 4 files changed +31
-15
lines changed
Expand file tree Collapse file tree 4 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -872,6 +872,8 @@ jobs:
872872 - upload-test-results
873873 test-bun :
874874 executor : linux-python
875+ environment :
876+ OVERRIDE_NODE_JS_VERSION : " v24.0.0"
875877 steps :
876878 - checkout
877879 - pip-install
@@ -880,10 +882,14 @@ jobs:
880882 name : install bun
881883 command : |
882884 curl -fsSL https://bun.com/install | bash
883- echo "BUN_ENGINE = os.path.expanduser('~/.bun/bin/bun')" >> ~/emsdk/.emscripten
884- echo "JS_ENGINES = [BUN_ENGINE ]" >> ~/emsdk/.emscripten
885+ echo "NODE_JS_TEST = os.path.expanduser('~/.bun/bin/bun')" >> ~/emsdk/.emscripten
886+ echo "JS_ENGINES = [NODE_JS_TEST ]" >> ~/emsdk/.emscripten
885887 - run-tests :
886- test_targets : " core0.test_hello_world"
888+ test_targets : "
889+ core0.test_hello_world
890+ core0.test_hello_argc_pthreads
891+ core2.test_pthread_create
892+ "
887893 test-jsc :
888894 executor : linux-python
889895 steps :
Original file line number Diff line number Diff line change @@ -16,14 +16,17 @@ console.log("Running pthread_esm_startup");
1616#if ENVIRONMENT_MAY_BE_NODE
1717if ( { { { nodeDetectionCode( ) } } } ) {
1818 // Create as web-worker-like an environment as we can.
19+ globalThis. self = globalThis ;
1920 var worker_threads = await import ( 'worker_threads' ) ;
20- global . Worker = worker_threads . Worker ;
2121 var parentPort = worker_threads [ 'parentPort' ] ;
22- parentPort . on ( 'message' , ( msg ) => global . onmessage ?. ( { data : msg } ) ) ;
23- Object . assign ( globalThis , {
24- self : global ,
25- postMessage : ( msg ) => parentPort [ 'postMessage' ] ( msg ) ,
26- } ) ;
22+ // Deno and Bun already have `postMessage` defined on the global scope and
23+ // deliver messages to `globalThis.onmessage`, so we must not duplicate that
24+ // behavior here if `postMessage` is already present.
25+ if ( ! globalThis . postMessage ) {
26+ globalThis . Worker = worker_threads . Worker ;
27+ parentPort . on ( 'message' , ( msg ) => globalThis . onmessage ?. ( { data : msg } ) ) ;
28+ globalThis . postMessage = ( msg ) => parentPort [ 'postMessage' ] ( msg ) ;
29+ }
2730}
2831#endif
2932
Original file line number Diff line number Diff line change @@ -38,12 +38,15 @@ var readyPromiseResolve, readyPromiseReject;
3838#if ( PTHREADS || WASM_WORKERS ) && ( ENVIRONMENT_MAY_BE_NODE && ! WASM_ESM_INTEGRATION )
3939if ( ENVIRONMENT_IS_NODE && { { { ENVIRONMENT_IS_WORKER_THREAD ( ) } } } ) {
4040 // Create as web-worker-like an environment as we can.
41+ globalThis. self = globalThis ;
4142 var parentPort = worker_threads [ 'parentPort' ] ;
42- parentPort . on ( 'message' , ( msg ) => global . onmessage ?. ( { data : msg } ) ) ;
43- Object . assign ( globalThis , {
44- self : global ,
45- postMessage : ( msg ) => parentPort [ 'postMessage' ] ( msg ) ,
46- } ) ;
43+ // Deno and Bun already have `postMessage` defined on the global scope and
44+ // deliver messages to `globalThis.onmessage`, so we must not duplicate that
45+ // behavior here if `postMessage` is already present.
46+ if ( ! globalThis . postMessage ) {
47+ parentPort . on ( 'message' , ( msg ) => globalThis . onmessage ?. ( { data : msg } ) ) ;
48+ globalThis . postMessage = ( msg ) => parentPort [ 'postMessage' ] ( msg ) ;
49+ }
4750 // Node.js Workers do not pass postMessage()s and uncaught exception events to the parent
4851 // thread necessarily in the same order where they were generated in sequential program order.
4952 // See https://github.com/nodejs/node/issues/59617
Original file line number Diff line number Diff line change @@ -278,7 +278,11 @@ def env_with_node_in_path():
278278
279279
280280def _get_node_version_pair (nodejs ):
281- actual = utils .run_process (nodejs + ['--version' ], stdout = PIPE ).stdout .strip ()
281+ override = os .environ .get ('OVERRIDE_NODE_JS_VERSION' )
282+ if override :
283+ actual = override
284+ else :
285+ actual = utils .run_process (nodejs + ['--version' ], stdout = PIPE ).stdout .strip ()
282286 version = actual .removeprefix ('v' )
283287 version = version .split ('-' )[0 ].split ('.' )
284288 version = tuple (int (v ) for v in version )
You can’t perform that action at this time.
0 commit comments