25 lines
872 B
TypeScript
25 lines
872 B
TypeScript
import { expect, test } from "bun:test";
|
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join, resolve } from "node:path";
|
|
|
|
test("init help starts in an empty directory without requiring Compose", async () => {
|
|
const cwd = await mkdtemp(join(tmpdir(), "kuber-startup-test-"));
|
|
try {
|
|
const process = Bun.spawn(
|
|
["bun", resolve(import.meta.dir, "../../index.ts"), "init", "--help"],
|
|
{ cwd, stdout: "pipe", stderr: "pipe" },
|
|
);
|
|
const [status, out, err] = await Promise.all([
|
|
process.exited,
|
|
new Response(process.stdout).text(),
|
|
new Response(process.stderr).text(),
|
|
]);
|
|
expect(status).toBe(0);
|
|
expect(out + err).toContain("init");
|
|
expect(out + err).not.toContain("Compose file cannot be found");
|
|
} finally {
|
|
await rm(cwd, { recursive: true, force: true });
|
|
}
|
|
});
|