Compare commits

...

1 Commits

Author SHA1 Message Date
Meghan Denny
3685aab850 complex-workspace.test.ts: print the results on failure 2024-03-27 18:33:26 -07:00

View File

@@ -6,6 +6,7 @@ import { tmpdir } from "os";
import { join } from "path";
let cwd = join(tmpdir(), "complex-workspace-test" + Math.random().toString(36).slice(2, 8));
let did_init = false;
function validate(packageName: string, version: string, realPackageName?: string) {
test(`${packageName} is ${realPackageName ? `${realPackageName}@${version}` : version}`, () => {
@@ -44,27 +45,35 @@ test("the install succeeds", async () => {
var subprocess = Bun.spawn([bunExe(), "reset.ts"], {
env: bunEnv,
cwd,
stdio: ["ignore", "ignore", "ignore"],
stdio: ["ignore", "pipe", "pipe"],
});
await subprocess.exited;
if (subprocess.exitCode != 0) {
cwd = false as any;
const err = await new Response(subprocess.stderr).text();
const out = await new Response(subprocess.stdout).text();
console.log({ err, out });
throw new Error("Failed to install");
}
subprocess = Bun.spawn([bunExe(), "install"], {
env: bunEnv,
cwd,
stdio: ["ignore", "ignore", "ignore"],
stdio: ["ignore", "pipe", "pipe"],
});
await subprocess.exited;
if (subprocess.exitCode != 0) {
cwd = false as any;
const err = await new Response(subprocess.stderr).text();
const out = await new Response(subprocess.stdout).text();
console.log({ err, out });
throw new Error("Failed to install");
}
}, 10000);
if (!did_init) throw new Error("Failed to install");
// bun-types
validate("node_modules/bun-types", "1.0.0");
mustExist("node_modules/bun-types/isfake.txt");