-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
258b183
commit aa8a700
Showing
3 changed files
with
30 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.js
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |