1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 });
});
|