Skip to content

Commit c48158a

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

File tree

3 files changed

+31
-32
lines changed

3 files changed

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

0 commit comments

Comments
 (0)