Skip to content

Commit 0f7cfc4

Browse files
committed
fix(dev): report signaled startup runners as failures
1 parent 4d2f4ea commit 0f7cfc4

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎scripts/profile-startup.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ if (isLauncher) {
160160
process.exitCode = 1;
161161
});
162162
child.on("exit", (code) => {
163-
process.exitCode = code ?? 0;
163+
process.exitCode = code ?? 1;
164164
});
165165
}

‎scripts/profile-startup.test.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ it("attributes ESM and CommonJS imports without changing module execution", () =
106106
}
107107
});
108108

109-
it("captures the dev runner without profiling the launcher when an output directory is set", () => {
109+
it("captures only the dev runner and preserves its exit status", () => {
110110
const directory = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-startup-launcher-"));
111111
try {
112112
NodeFS.mkdirSync(NodePath.join(directory, "scripts"));
@@ -129,6 +129,20 @@ it("captures the dev runner without profiling the launcher when an output direct
129129
expect(NodeFS.readdirSync(output).sort()).toEqual(
130130
["cpuprofile", "modules.json", "process.json"].map((suffix) => `${runner.pid}-0.${suffix}`),
131131
);
132+
NodeFS.writeFileSync(
133+
NodePath.join(directory, "scripts/dev-runner.ts"),
134+
"process.kill(process.pid, 'SIGTERM');",
135+
);
136+
const interrupted = NodeChildProcess.spawnSync(
137+
process.execPath,
138+
[NodePath.join(import.meta.dirname, "profile-startup.mjs")],
139+
{
140+
cwd: directory,
141+
env: { ...process.env, NODE_OPTIONS: "", T3CODE_STARTUP_PROFILE_DIR: output },
142+
},
143+
);
144+
expect(interrupted.error).toBeUndefined();
145+
expect(interrupted.status).toBe(1);
132146
} finally {
133147
NodeFS.rmSync(directory, { recursive: true, force: true });
134148
}

0 commit comments

Comments
 (0)