mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
35 lines
945 B
TypeScript
35 lines
945 B
TypeScript
import { spawnSync } from "bun";
|
|
import { test, describe, expect } from "bun:test";
|
|
import { bunExe, bunEnv } from "harness";
|
|
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 });
|
|
});
|