Skip to content

Commit aa8a700

Browse files
committed
Switch to mjs
1 parent 258b183 commit aa8a700

File tree

3 files changed

+30
-32
lines changed

3 files changed

+30
-32
lines changed

extensions/wasm_bindgen/rules_js/test/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ _WASM_DATA = [
7070
js_test(
7171
name = "hello_world_wasm_direct_test",
7272
data = _WASM_DATA,
73-
entry_point = "hello_world_wasm_test.js",
73+
entry_point = "hello_world_wasm_test.mjs",
7474
)
7575

7676
js_library(
7777
name = "hello_world_wasm_lib",
7878
srcs = [
79-
"hello_world_wasm_test.js",
79+
"hello_world_wasm_test.mjs",
8080
],
8181
data = _WASM_DATA,
8282
deps = [],

extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.js

-30
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import path from "path";
2+
import assert from "assert";
3+
import { fileURLToPath } from "url";
4+
5+
const main = async function (typ, dir) {
6+
const filename = fileURLToPath(import.meta.url);
7+
const dirname = path.dirname(filename);
8+
9+
const wasm_module = path.join(
10+
dirname,
11+
"..",
12+
dir,
13+
"test",
14+
`hello_world_${typ}_wasm_bindgen`,
15+
`hello_world_${typ}_wasm_bindgen.js`,
16+
);
17+
18+
const res = await import(wasm_module);
19+
20+
assert.strictEqual(res.instance.exports.double(2), 4);
21+
};
22+
23+
["bundler", "web", "deno", "nomodules", "nodejs"].forEach((typ) => {
24+
main(typ, process.argv.length > 2 ? process.argv[2] : "").catch((err) => {
25+
console.error(err);
26+
process.exit(1);
27+
});
28+
});

0 commit comments

Comments
 (0)