aboutsummaryrefslogtreecommitdiff
path: root/test/cli/run/commonjs-no-export.test.ts
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-06-19 22:34:22 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-19 22:34:22 -0700
commit7d94a49ef403750886c2e9ebfc5a7752b8ccb882 (patch)
tree33cf444dfbf380e04c45ccfb753a8e46ee6dbcd5 /test/cli/run/commonjs-no-export.test.ts
parentcbd6d24d34b78de2b28fad75df2be1b728561d93 (diff)
downloadbun-7d94a49ef403750886c2e9ebfc5a7752b8ccb882.tar.gz
bun-7d94a49ef403750886c2e9ebfc5a7752b8ccb882.tar.zst
bun-7d94a49ef403750886c2e9ebfc5a7752b8ccb882.zip
Fix bug that breaks `bunx prisma init` when node is not installed (#3362)
* tweak cjs * Handle more cases, add a test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test/cli/run/commonjs-no-export.test.ts')
-rw-r--r--test/cli/run/commonjs-no-export.test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cli/run/commonjs-no-export.test.ts b/test/cli/run/commonjs-no-export.test.ts
new file mode 100644
index 000000000..b0bedd9d6
--- /dev/null
+++ b/test/cli/run/commonjs-no-export.test.ts
@@ -0,0 +1,14 @@
+import { test, expect } from "bun:test";
+import { bunEnv, bunExe } from "harness";
+import { join } from "path";
+
+test("CommonJS entry point with no exports", () => {
+ const { stdout, exitCode } = Bun.spawnSync({
+ cmd: [bunExe(), "run", "--bun", join(import.meta.dir, "commonjs-no-exports-fixture.js")],
+ env: bunEnv,
+ stderr: "inherit",
+ });
+
+ expect(stdout.toString().trim().endsWith("--pass--")).toBe(true);
+ expect(exitCode).toBe(0);
+});