The following code should work to test WebAssembly in various JS runtimes with minor modifications:
const bytes = /* read a .wasm file somehow */;
const mod = new WebAssembly.Module(bytes);
const instance = new WebAssembly.Instance(mod, { /* imports */ });
const { foo, bar } = instance.exports;