diff options
| author | 2023-08-07 18:51:16 -0700 | |
|---|---|---|
| committer | 2023-08-07 18:51:16 -0700 | |
| commit | f2f227720b3ffe1797a0a4e500e9a9a639167dc6 (patch) | |
| tree | a3fab7a9c55775c8bd637161aa2551a7659a21b8 /packages/bun-wasm/test/node.mjs | |
| parent | 0b183beb51367004795d8a431eb06bb2fa4f8250 (diff) | |
| download | bun-f2f227720b3ffe1797a0a4e500e9a9a639167dc6.tar.gz bun-f2f227720b3ffe1797a0a4e500e9a9a639167dc6.tar.zst bun-f2f227720b3ffe1797a0a4e500e9a9a639167dc6.zip | |
WASM test analyzer (#4043)
* wasm
* WASM test scanner
* Update Makefile
* Update Makefile
* Configurable heap limit
* slightly better error
* Update js_parser.zig
* Update path.test.js
* Update node.mjs
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'packages/bun-wasm/test/node.mjs')
| -rw-r--r-- | packages/bun-wasm/test/node.mjs | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/packages/bun-wasm/test/node.mjs b/packages/bun-wasm/test/node.mjs index 7890a5c6e..2699a1dad 100644 --- a/packages/bun-wasm/test/node.mjs +++ b/packages/bun-wasm/test/node.mjs @@ -1,28 +1,7 @@ -// This is not released yet because there are some memory bugs with the WASM build -// It causes syntax errors which don't make any sense -// Most likely, this is an issue with some code expecting 64 bit pointers -// That's also why this test just prints instead of using a test runner -import * as Bun from "../index.mjs"; +import { readFileSync } from "fs"; +import { init, getTests } from "../index.mjs"; -await Bun.init(new URL("../bun.wasm", import.meta.url)); +const buf = (process.argv.length > 2 ? readFileSync(process.argv.at(-1)) : "") || readFileSync(import.meta.url); +await init(new URL("../bun.wasm", import.meta.url)); -const buf = - (process.argv.length > 2 ? process.argv.at(-1) : "") || - new TextEncoder().encode(` - -export function hi() { - return <div>Hey</div>; -} - -`); -const result = Bun.transformSync(buf, "hi.jsx", "jsx"); -if (result.errors?.length) { - console.log(JSON.stringify(result.errors, null, 2)); - throw new Error("Failed"); -} - -if (!result.files.length) { - throw new Error("unexpectedly empty"); -} - -process.stdout.write(result.files[0].data); +console.log(getTests(buf)); |
