chore(test): add cross-worktree test lock and clean up dev-server test child

- scripts/test-with-lock.mjs: pnpm test:locked acquires an exclusive
  ~/.fusion/test.lock (O_EXLOCK) before running pnpm test, so several
  Claude Code worktrees on the same machine serialize their vitest
  fan-out instead of saturating the box. Prints the holding PID and
  worktree path while waiting.
- dev-server-manager test children now park on stdin instead of
  setInterval so manager.shutdown() can deterministically exit them
  via stdin close, preventing orphaned node processes outliving the
  test run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-02 15:56:46 -07:00
parent 2f13a31e13
commit 1e6714e4df
5 changed files with 206 additions and 31 deletions

View File

@@ -222,7 +222,7 @@ describe("createDevServerRouter", () => {
app,
"POST",
"/api/dev-server/start",
JSON.stringify({ command: "node -e \"setInterval(() => {}, 1000)\"" }),
JSON.stringify({ command: "node -e \"process.stdin.resume();process.stdin.on('end',()=>process.exit(0))\"" }),
{ "Content-Type": "application/json" },
);
@@ -238,7 +238,7 @@ describe("createDevServerRouter", () => {
app,
"POST",
"/api/dev-server/start",
JSON.stringify({ command: "node -e \"setInterval(() => {}, 1000)\"", cwd: root }),
JSON.stringify({ command: "node -e \"process.stdin.resume();process.stdin.on('end',()=>process.exit(0))\"", cwd: root }),
{ "Content-Type": "application/json" },
);
@@ -258,7 +258,7 @@ describe("createDevServerRouter", () => {
app,
"POST",
"/api/dev-server/start",
JSON.stringify({ command: "node -e \"setInterval(() => {}, 1000)\"", cwd: root }),
JSON.stringify({ command: "node -e \"process.stdin.resume();process.stdin.on('end',()=>process.exit(0))\"", cwd: root }),
{ "Content-Type": "application/json" },
);
@@ -266,7 +266,7 @@ describe("createDevServerRouter", () => {
app,
"POST",
"/api/dev-server/start",
JSON.stringify({ command: "node -e \"setInterval(() => {}, 1000)\"", cwd: root }),
JSON.stringify({ command: "node -e \"process.stdin.resume();process.stdin.on('end',()=>process.exit(0))\"", cwd: root }),
{ "Content-Type": "application/json" },
);
@@ -282,7 +282,7 @@ describe("createDevServerRouter", () => {
app,
"POST",
"/api/dev-server/start",
JSON.stringify({ command: "node -e \"setInterval(() => {}, 1000)\"", cwd: root }),
JSON.stringify({ command: "node -e \"process.stdin.resume();process.stdin.on('end',()=>process.exit(0))\"", cwd: root }),
{ "Content-Type": "application/json" },
);
@@ -311,7 +311,7 @@ describe("createDevServerRouter", () => {
app,
"POST",
"/api/dev-server/start",
JSON.stringify({ command: "node -e \"setInterval(() => {}, 1000)\"", cwd: root, scriptId: "dev" }),
JSON.stringify({ command: "node -e \"process.stdin.resume();process.stdin.on('end',()=>process.exit(0))\"", cwd: root, scriptId: "dev" }),
{ "Content-Type": "application/json" },
);
@@ -319,7 +319,7 @@ describe("createDevServerRouter", () => {
expect(restartRes.status).toBe(200);
expect(restartRes.body).toMatchObject({
status: "running",
command: "node -e \"setInterval(() => {}, 1000)\"",
command: "node -e \"process.stdin.resume();process.stdin.on('end',()=>process.exit(0))\"",
scriptId: "dev",
});
});