Skip to content

Commit 91c86f2

Browse files
authored
[test] Add @esm_integration decorator. NFC (#24115)
1 parent 38ab8db commit 91c86f2

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

test/test_core.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@
4040
EM_SIGABRT = 6
4141

4242

43+
def esm_integration(func):
44+
assert callable(func)
45+
46+
@wraps(func)
47+
def decorated(self, *args, **kwargs):
48+
self.require_node_canary()
49+
self.node_args += ['--experimental-wasm-modules', '--no-warnings']
50+
if self.is_wasm64():
51+
self.skipTest('wasm64 requires wasm export wrappers')
52+
func(self, *args, **kwargs)
53+
54+
return decorated
55+
56+
4357
def wasm_simd(f):
4458
assert callable(f)
4559

@@ -9562,18 +9576,14 @@ def test_wasm_worker_malloc(self):
95629576
def test_wasm_worker_wait_async(self):
95639577
self.do_runf('atomic/test_wait_async.c', emcc_args=['-sWASM_WORKERS'])
95649578

9565-
@requires_node_canary
9566-
@no_wasm64("wasm64 requires wasm export wrappers")
9579+
@esm_integration
95679580
def test_esm_integration_main(self):
9568-
self.node_args += ['--experimental-wasm-modules', '--no-warnings']
95699581
self.do_runf('hello_world.c', 'hello, world!', emcc_args=['-sWASM_ESM_INTEGRATION', '-Wno-experimental'], output_suffix='.mjs')
95709582

9571-
@requires_node_canary
9572-
@no_wasm64("wasm64 requires wasm export wrappers")
9583+
@esm_integration
95739584
def test_esm_integration(self):
95749585
# TODO(sbc): WASM_ESM_INTEGRATION doesn't currently work with closure.
95759586
# self.maybe_closure()
9576-
self.node_args += ['--experimental-wasm-modules', '--no-warnings']
95779587
self.run_process([EMCC, '-o', 'hello_world.mjs', '-sEXPORTED_RUNTIME_METHODS=err', '-sEXPORTED_FUNCTIONS=_main,stringToNewUTF8', '-sWASM_ESM_INTEGRATION', '-Wno-experimental', test_file('core/test_esm_integration.c')] + self.get_emcc_args())
95789588
create_file('runner.mjs', '''
95799589
import init, { err, stringToNewUTF8, _main, _foo } from "./hello_world.mjs";

0 commit comments

Comments
 (0)