You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f49c77f
Browse filesBrowse the repository at this point in the historyBrowse files
Force the group on POSIX only, say the let-go in the terminal, clean the test up by group
Self-review findings on c6f152c: killTreeByPid ran on Windows against a pid that is certainly dead, which npm:kill's own rule forbids (a taskkill there can land on a reissued pid, and it is a synchronous spawn on the main process); the let-go reached only the log file, so the contributor saw a step end and the output stop with no word, on Windows with wp-build still running; the integration test's cleanup went through the pid fallback. TESTING.md's layer 2 now says real processes belong there too.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: TESTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ They are listed cheapest first, and that ordering is the rule: **write a test at
43
43
44
44
**1. Unit** — `tests/unit/`. Starts nothing; calls plain functions. Pure logic: parsing a ticket reference, deriving a status, building a command line. Blind to anything touching disk, a process or a window.
45
45
46
-
**2. Integration** — the files named `*.integration.test.cjs`. Runs the real modules against real Git repositoriesin a temporary directory. Proves Git does what the code assumes when it switches a branch, applies a patch or updates trunk. Blind to everything above the module boundary.
46
+
**2. Integration** — the files named `*.integration.test.cjs`. Runs the real modules against real Git repositories, or real processes, in a temporary directory. Proves Git does what the code assumes when it switches a branch, applies a patch or updates trunk, and that a process tree behaves the way the kill and let-go paths assume (`kill-tree`, `orphan-pipe`). Blind to everything above the module boundary.
47
47
48
48
**3. IPC wiring** — one file, `tests/unit/ipc-wiring.test.cjs`. Loads the real `src/main.js` with `electron` replaced by a double, and exercises every handler: what each returns, what it rejects, what error it gives. Blind to the window, and its store is a stand-in rather than the real one.
// its cmd.exe was closed by hand (#497) — so npm has exited, the step is
3434
3434
// still IN PROGRESS, and the terminal keeps receiving the orphan's output
3435
3435
// (#498). Mirror of the Stop escalation (#479) on the natural-exit path:
3436
-
// three seconds after `exit` with no `close`, force the group by pid
3437
-
// (on POSIX the detached group outlives its leader, so the orphan goes;
3438
-
// on Windows `taskkill /T` from a pid that is gone reaches nothing, and
3439
-
// the orphan runs on until it finishes) and destroy the pipes, which is
3440
-
// what makes Node emit `close` with the exit code npm gave. The close
3441
-
// handler then settles as usual, so the engines-retry decision stays in
3442
-
// one place; whatever the orphan writes afterwards goes with the stream.
3436
+
// three seconds after `exit` with no `close`, force the group by pid on
3437
+
// POSIX, where the detached group outlives its leader and the orphan
3438
+
// goes with it, and destroy the pipes, which is what makes Node emit
3439
+
// `close` with the exit code npm gave. The close handler then settles as
3440
+
// usual, so the engines-retry decision stays in one place; whatever the
3441
+
// orphan writes afterwards goes with the stream. Not forced on Windows,
3442
+
// for the reason npm:kill gives: the pid is certainly dead by now, a
3443
+
// `taskkill /T` on it reaches nothing of the orphan (its parent chain
3444
+
// is gone) and could land on a reissued pid; there the orphan runs on
3445
+
// until it finishes, and the terminal line says so.
3443
3446
letletGo=null;
3444
3447
child.once('exit',(code,signal)=>{
3445
3448
letGo=setTimeout(()=>{
3446
3449
if(settled)return;
3447
-
logEvent(logScope,`exited with code ${code}${signal ? ` (signal ${signal})` : ''} but a descendant still holds its output; forcing the tree and letting go`);
logEvent(logScope,`exited with ${exit} but a descendant still holds its output; letting go`);
3452
+
onLog('stderr',`\nnpm exited with ${exit}, but something it started is still running and holding its output. Letting go${process.platform==='win32' ? '; that process runs on until it finishes on its own' : ' and ending it'}.\n`);
0 commit comments