aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-13 20:51:27 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-13 20:51:27 -0800
commit4a8bbc22161c7ffabf10195b55145c796d4b436a (patch)
treed8550ee23eeb5b61858292bec4cb7004f4e20e08
parent92b766095de0e59fe40dfd9009e4fcc18117d93b (diff)
downloadbun-4a8bbc22161c7ffabf10195b55145c796d4b436a.tar.gz
bun-4a8bbc22161c7ffabf10195b55145c796d4b436a.tar.zst
bun-4a8bbc22161c7ffabf10195b55145c796d4b436a.zip
Add an e2e test
-rwxr-xr-xtest/bun.js/bun.lockbbin109914 -> 9014 bytes
-rw-r--r--test/bun.js/esbuild-child_process.test.ts46
-rw-r--r--test/bun.js/package.json6
3 files changed, 52 insertions, 0 deletions
diff --git a/test/bun.js/bun.lockb b/test/bun.js/bun.lockb
index cff7a8ddc..ec2e87900 100755
--- a/test/bun.js/bun.lockb
+++ b/test/bun.js/bun.lockb
Binary files differ
diff --git a/test/bun.js/esbuild-child_process.test.ts b/test/bun.js/esbuild-child_process.test.ts
new file mode 100644
index 000000000..0d357a940
--- /dev/null
+++ b/test/bun.js/esbuild-child_process.test.ts
@@ -0,0 +1,46 @@
+import { transform, transformSync } from "esbuild";
+import { describe, it, expect } from "bun:test";
+
+describe("child_process.spawn - esbuild", () => {
+ it("should transform successfully", async () => {
+ const result = await transform("console.log('hello world')", {
+ loader: "js",
+ target: "node12",
+ });
+ expect(result.code).toBe('console.log("hello world");\n');
+ });
+
+ it("works for input exceeding the pipe capacity", async () => {
+ const hugeString = `console.log(${JSON.stringify("a".repeat(1000000))});`;
+ const result = await transform(hugeString, {
+ loader: "js",
+ target: "node12",
+ });
+ expect(result.code).toBe(hugeString + "\n");
+ });
+});
+
+describe("child_process.spawnSync - esbuild", () => {
+ it("should transform successfully", () => {
+ const result = transformSync("console.log('hello world')", {
+ loader: "js",
+ target: "node12",
+ });
+ expect(result.code).toBe('console.log("hello world");\n');
+ });
+
+ // This test is failing with the following error:
+ // error: Error
+ // path: "/Users/jarred/Code/bun/test/bun.js/node_modules/esbuild-darwin-arm64/bin/esbuild"
+ // code: "13"
+ // syscall: "spawnSync"
+ // errno: -1
+ // it("works for input exceeding the pipe capacity", () => {
+ // const hugeString = `console.log(${JSON.stringify("a".repeat(100000))});`;
+ // const result = transformSync(hugeString, {
+ // loader: "js",
+ // target: "node12",
+ // });
+ // expect(result.code).toBe(hugeString + "\n");
+ // });
+});
diff --git a/test/bun.js/package.json b/test/bun.js/package.json
new file mode 100644
index 000000000..f4afa79e1
--- /dev/null
+++ b/test/bun.js/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "bun-tests",
+ "dependencies": {
+ "esbuild": "0.15.13"
+ }
+}