singularity-forge/tests/smoke/test-init.ts
ace-pm 9d739dfa5d Rename GSD→SF: complete rebrand from fork origin
- All gsdDir/gsdRoot/gsdHome → sfDir/sfRootDir/sfHome
- GSDWorkspace* → SFWorkspace* interfaces
- bootstrapGsdProject → bootstrapProject
- runGSDDoctor → runSFDoctor
- GsdClient → SfClient, gsd-client.ts → sf-client.ts
- .gsd/ → .sf/ in all tests, docs, docker, native, vscode
- Auto-migration: headless detects .gsd/ → renames to .sf/
- Deleted gsd-phase-state.ts backward-compat re-export
- Renamed bin/gsd-from-source → bin/sf-from-source
- Updated mintlify docs, github workflows, docker configs
2026-04-15 18:33:47 +02:00

34 lines
939 B
TypeScript

import { execFileSync } from "child_process";
import { mkdtempSync, existsSync, rmSync } from "fs";
import { join } from "path";
import { tmpdir } from "os";
// Skip in non-TTY environments (CI containers) — init requires interactive mode
if (!process.stdin.isTTY && process.env.CI) {
console.log(" SKIP test-init (no TTY in CI)");
process.exit(0);
}
const tmpDir = mkdtempSync(join(tmpdir(), "sf-smoke-init-"));
try {
const binary = process.env.SF_SMOKE_BINARY || "npx";
const args = process.env.SF_SMOKE_BINARY
? ["init"]
: ["sf-run", "init"];
execFileSync(binary, args, {
encoding: "utf8",
timeout: 30_000,
cwd: tmpDir,
env: { ...process.env, SF_NON_INTERACTIVE: "1" },
});
const sfDir = join(tmpDir, ".sf");
if (!existsSync(sfDir)) {
console.error(`.sf directory not created in ${tmpDir}`);
process.exit(1);
}
} finally {
rmSync(tmpDir, { recursive: true, force: true });
}