singularity-forge/tests/smoke/test-help.ts

24 lines
549 B
TypeScript
Raw Normal View History

import { execFileSync } from "child_process";
const binary = process.env.SF_SMOKE_BINARY || "npx";
const args = process.env.SF_SMOKE_BINARY
? ["--help"]
: ["sf-run", "--help"];
const output = execFileSync(binary, args, {
encoding: "utf8",
timeout: 30_000,
});
const lower = output.toLowerCase();
if (!lower.includes("sf")) {
console.error(`Help output does not contain "sf": "${output}"`);
process.exit(1);
}
if (!lower.includes("usage")) {
console.error(`Help output does not contain "usage": "${output}"`);
process.exit(1);
}