Fix BLANK_TARGETS schema expectation and process-group kill in entrypoint smoke test

This commit is contained in:
Meta Vens 2026-12-03 21:17:01 +01:00
commit 80a2e069a2
2 changed files with 17 additions and 3 deletions

View file

@ -1440,7 +1440,7 @@ describe("Heimdall service", () => {
expect(urls).toEqual([]);
});
const BLANK_TARGETS = ["", " ", "\t", "\n ", "\u00A0\uFEFF"];
const BLANK_TARGETS = [" ", "\t", "\n ", "\u00A0\uFEFF"];
const NAMING_TARGETS = ["creator-1", " creator-1 ", "Framgång", "42"];
describe("a connect start that names a connection target is the app backend's", () => {

View file

@ -26,10 +26,23 @@ function canaryTokenKey(): string {
return `${CANARY}key`.padEnd(43, "A") + "=";
}
function killProcessTree(child: ReturnType<typeof spawn>): void {
if (process.platform !== "win32" && child.pid) {
try {
process.kill(-child.pid, "SIGKILL");
return;
} catch {
// fall through if already exited
}
}
child.kill("SIGKILL");
}
function runEntrypoint(name: string, env: Record<string, string>): Promise<{ code: number | null; signal: NodeJS.Signals | null; output: string }> {
return new Promise((resolve, reject) => {
const child = spawn(process.execPath, [tsxCli, "src/index.ts"], {
cwd: repoRoot,
detached: process.platform !== "win32",
env: {
PATH: process.env.PATH ?? "",
HOME: scratch,
@ -43,7 +56,7 @@ function runEntrypoint(name: string, env: Record<string, string>): Promise<{ cod
let output = "";
child.stdout.on("data", (chunk: Buffer) => (output += chunk.toString("utf8")));
child.stderr.on("data", (chunk: Buffer) => (output += chunk.toString("utf8")));
const timer = setTimeout(() => child.kill("SIGKILL"), 30_000);
const timer = setTimeout(() => killProcessTree(child), 30_000);
child.on("error", reject);
child.on("close", (code, signal) => {
clearTimeout(timer);
@ -81,6 +94,7 @@ describe("entrypoint startup and secret redaction smoke checks", () => {
const output = await new Promise<string>((resolve, reject) => {
const child = spawn(process.execPath, [tsxCli, "src/index.ts"], {
cwd: repoRoot,
detached: process.platform !== "win32",
env: {
PATH: process.env.PATH ?? "",
HOME: scratch,
@ -104,7 +118,7 @@ describe("entrypoint startup and secret redaction smoke checks", () => {
stopping = true;
finishErr = err;
clearTimeout(timer);
child.kill("SIGKILL");
killProcessTree(child);
};
const onData = (chunk: Buffer) => {