@@ -393,6 +393,31 @@ def require_node(self):
393393 self .require_engine (nodejs )
394394 return nodejs
395395
396+ def get_deno (self ):
397+ """Return deno engine, if one is configured, otherwise None"""
398+ if config .DENO_ENGINE and config .DENO_ENGINE in config .JS_ENGINES :
399+ return config .DENO_ENGINE
400+ return None
401+
402+ def get_node_bun_or_deno (self ):
403+ """Return nodejs, bun, or deno engine, if one is configured, otherwise None"""
404+ if config .NODE_JS_TEST in config .JS_ENGINES :
405+ return config .NODE_JS_TEST
406+ if config .BUN_ENGINE and config .BUN_ENGINE in config .JS_ENGINES :
407+ return config .BUN_ENGINE
408+ if config .DENO_ENGINE and config .DENO_ENGINE in config .JS_ENGINES :
409+ return config .DENO_ENGINE
410+ return None
411+
412+ def require_node_bun_or_deno (self ):
413+ if 'EMTEST_SKIP_NODE' in os .environ :
414+ self .skipTest ('test requires node, bun, or deno and EMTEST_SKIP_NODE is set' )
415+ engine = self .get_node_bun_or_deno ()
416+ if not engine :
417+ self .fail ('node, bun, or deno required to run this test. Use EMTEST_SKIP_NODE to skip' )
418+ self .require_engine (engine )
419+ return engine
420+
396421 def node_is_canary (self , nodejs ):
397422 return nodejs and nodejs [0 ] and ('canary' in nodejs [0 ] or 'nightly' in nodejs [0 ])
398423
@@ -406,6 +431,20 @@ def require_node_canary(self):
406431
407432 self .fail ('node canary required to run this test. Use EMTEST_SKIP_NODE_CANARY to skip' )
408433
434+ def require_node_canary_or_deno (self ):
435+ if 'EMTEST_SKIP_NODE_CANARY' in os .environ :
436+ self .skipTest ('test requires node canary or deno and EMTEST_SKIP_NODE_CANARY is set' )
437+ nodejs = self .get_nodejs ()
438+ if self .node_is_canary (nodejs ):
439+ self .require_engine (nodejs )
440+ return
441+ deno = self .get_deno ()
442+ if deno :
443+ self .require_engine (deno )
444+ return
445+
446+ self .fail ('node canary or deno required to run this test. Use EMTEST_SKIP_NODE_CANARY to skip' )
447+
409448 def require_engine (self , engine ):
410449 logger .debug (f'require_engine: { engine } ' )
411450 if self .required_engine and self .required_engine != engine :
@@ -517,9 +556,16 @@ def require_jspi(self):
517556 return
518557
519558 exp_args = ['--experimental-wasm-stack-switching' , '--experimental-wasm-type-reflection' ]
520- # Support for JSPI came earlier than 22, but the new API changes require v24
521- if self .try_require_node_version (24 ):
522- self .node_args += exp_args
559+ nodejs = self .get_nodejs ()
560+ if nodejs :
561+ # Support for JSPI came earlier than 22, but the new API changes require v24
562+ if self .try_require_node_version (24 ):
563+ self .node_args += exp_args
564+ return
565+
566+ deno = self .get_deno ()
567+ if deno :
568+ self .js_engines = [deno ]
523569 return
524570
525571 v8 = self .get_v8 ()
@@ -529,7 +575,7 @@ def require_jspi(self):
529575 self .v8_args += exp_args
530576 return
531577
532- self .fail ('either d8 or node v24 required to run JSPI tests. Use EMTEST_SKIP_JSPI to skip' )
578+ self .fail ('either d8, node v24, or deno required to run JSPI tests. Use EMTEST_SKIP_JSPI to skip' )
533579
534580 def require_wasm2js (self ):
535581 if self .is_wasm64 ():
@@ -556,13 +602,15 @@ def setup_wasmfs_test(self):
556602 self .cflags += ['-DWASMFS' ]
557603
558604 def setup_node_pthreads (self ):
559- self .require_node ()
605+ self .require_node_bun_or_deno ()
560606 self .cflags += ['-Wno-pthreads-mem-growth' , '-pthread' ]
561607 if self .get_setting ('MINIMAL_RUNTIME' ):
562608 self .skipTest ('node pthreads not yet supported with MINIMAL_RUNTIME' )
609+ engine = self .get_node_bun_or_deno ()
610+ self .js_engines = [engine ]
563611 nodejs = self .get_nodejs ()
564- self . js_engines = [ nodejs ]
565- self .node_args += shared .node_pthread_flags (nodejs )
612+ if nodejs :
613+ self .node_args += shared .node_pthread_flags (engine )
566614
567615 def set_temp_dir (self , temp_dir ):
568616 self .temp_dir = temp_dir
0 commit comments