aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bun.js/install/bad-workspace.test.ts37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/bun.js/install/bad-workspace.test.ts b/test/bun.js/install/bad-workspace.test.ts
new file mode 100644
index 000000000..5fdd54ed3
--- /dev/null
+++ b/test/bun.js/install/bad-workspace.test.ts
@@ -0,0 +1,37 @@
+import { spawnSync } from "bun";
+import { test, describe, expect } from "bun:test";
+import { bunEnv } from "bunEnv";
+import { bunExe } from "bunExe";
+import { mkdirSync, rmSync, writeFileSync } from "fs";
+
+test("bad workspace path", () => {
+ const cwd = "/tmp/bun-bad-workspace";
+ rmSync(cwd, { recursive: true, force: true });
+ mkdirSync(cwd);
+ writeFileSync(
+ `${cwd}/package.json`,
+ JSON.stringify(
+ {
+ name: "hey",
+ workspaces: ["i-dont-exist", "*/i-have-a-star-and-i-dont-exist"],
+ },
+ null,
+ 2,
+ ),
+ );
+ const { stderr, exitCode } = spawnSync({
+ cmd: [bunExe(), "install"],
+ cwd,
+ env: bunEnv,
+ stderr: "pipe",
+ stdout: "pipe",
+ });
+ const text = stderr!.toString();
+
+ expect(text).toContain('Workspace not found "i-dont-exist"');
+ expect(text).toContain(
+ 'Workspace not found "*/i-have-a-star-and-i-dont-exist"',
+ );
+ expect(exitCode).toBe(1);
+ rmSync(cwd, { recursive: true, force: true });
+});