Initial Commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
import { scaffold } from "../../src/generator/generator.js";
|
||||
import { answersForFixture } from "../../src/prompt/prompt.js";
|
||||
|
||||
type Fixture =
|
||||
| "trusted-postgres-full"
|
||||
| "isolated-sqlite-rest-only"
|
||||
| "sandboxed-none-rest-only";
|
||||
|
||||
const FIXTURES: readonly Fixture[] = [
|
||||
"trusted-postgres-full",
|
||||
"isolated-sqlite-rest-only",
|
||||
"sandboxed-none-rest-only",
|
||||
] as const;
|
||||
|
||||
describe("scaffold-output: every fixture passes bun test on first run", () => {
|
||||
for (const fixture of FIXTURES) {
|
||||
it(`every fixture passes bun test on first run :: ${fixture}`, {
|
||||
timeout: 30000,
|
||||
}, () => {
|
||||
const root = mkdtempSync(join(tmpdir(), `cspp-bun-${fixture}-`));
|
||||
try {
|
||||
const answers = answersForFixture(fixture, "demo-plugin");
|
||||
scaffold({ answers, targetDir: root, force: true });
|
||||
const result = spawnSync("bun", ["test"], {
|
||||
cwd: root,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, INTEGRATION: "0" },
|
||||
});
|
||||
if (result.status !== 0) {
|
||||
// Surface output to ease debugging when the gate flips.
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(result.stdout, result.stderr);
|
||||
}
|
||||
expect(result.status).toBe(0);
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user