aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-wasm/test/node.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/bun-wasm/test/node.mjs')
-rw-r--r--packages/bun-wasm/test/node.mjs31
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));