diff options
author | 2023-01-12 19:10:41 -0800 | |
---|---|---|
committer | 2023-01-12 19:10:41 -0800 | |
commit | 766f8ceebc76dd749ba5c104f802c7ebda289db9 (patch) | |
tree | f84ee560938188261f7f5604a65b83aae354a646 /test/bun.js/esbuild-test.js | |
parent | c03f7c998dd22689412658177e3a5736ce6b9034 (diff) | |
parent | 32f8cb31be6fb5b0b9aea1c6d4e95d118e8ef816 (diff) | |
download | bun-766f8ceebc76dd749ba5c104f802c7ebda289db9.tar.gz bun-766f8ceebc76dd749ba5c104f802c7ebda289db9.tar.zst bun-766f8ceebc76dd749ba5c104f802c7ebda289db9.zip |
Merge branch 'main' into dylan/github-dependencies
Diffstat (limited to 'test/bun.js/esbuild-test.js')
-rw-r--r-- | test/bun.js/esbuild-test.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/bun.js/esbuild-test.js b/test/bun.js/esbuild-test.js new file mode 100644 index 000000000..beb34b283 --- /dev/null +++ b/test/bun.js/esbuild-test.js @@ -0,0 +1,37 @@ +import { transform, transformSync } from "esbuild"; + +{ + const result = await transform("console.log('hello world')", { + loader: "js", + target: "node12", + }); + if (result.code !== 'console.log("hello world");\n') { + throw new Error("Test failed."); + } +} + +{ + const hugeString = `console.log(${JSON.stringify("a".repeat(1000000))});`; + + for (let i = 0; i < 2; i++) { + const result = await transform(hugeString, { + loader: "js", + target: "node12", + }); + if (result.code !== hugeString + "\n") { + throw new Error("Test failed."); + } + } +} + +{ + const result = transformSync("console.log('hello world')", { + loader: "js", + target: "node12", + }); + if (result.code !== 'console.log("hello world");\n') { + throw new Error("Test failed."); + } +} + +process.exit(0); |