Skip to content

Commit

Permalink
Switch to mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Jan 9, 2025
1 parent 258b183 commit aa8a700
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 32 deletions.
4 changes: 2 additions & 2 deletions extensions/wasm_bindgen/rules_js/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ _WASM_DATA = [
js_test(
name = "hello_world_wasm_direct_test",
data = _WASM_DATA,
entry_point = "hello_world_wasm_test.js",
entry_point = "hello_world_wasm_test.mjs",
)

js_library(
name = "hello_world_wasm_lib",
srcs = [
"hello_world_wasm_test.js",
"hello_world_wasm_test.mjs",
],
data = _WASM_DATA,
deps = [],
Expand Down
30 changes: 0 additions & 30 deletions extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.js

This file was deleted.

28 changes: 28 additions & 0 deletions extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import path from "path";
import assert from "assert";
import { fileURLToPath } from "url";

const main = async function (typ, dir) {
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

const wasm_module = path.join(
dirname,
"..",
dir,
"test",
`hello_world_${typ}_wasm_bindgen`,
`hello_world_${typ}_wasm_bindgen.js`,
);

const res = await import(wasm_module);

assert.strictEqual(res.instance.exports.double(2), 4);
};

["bundler", "web", "deno", "nomodules", "nodejs"].forEach((typ) => {
main(typ, process.argv.length > 2 ? process.argv[2] : "").catch((err) => {
console.error(err);
process.exit(1);
});
});

0 comments on commit aa8a700

Please sign in to comment.