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
Flaky Windows test: #185 recycled-pid test reads processInfo right after spawn #330
The Windows test "recycled server pid (#185) > reaps a record whose server pid now belongs to a newer process" fails intermittently on CI because processInfo() returns null for a child queried the moment it spawns. A red CI run skips the npm publish, so this flake can block a release.
Where
src/__tests__/sessions.test.ts:422-445 (the test)
src/utils/sessions.ts (processInfo, a PowerShell Get-CimInstance Win32_Process query with a 10 s timeout)
Details
constchild=spawn(process.execPath,["-e","setTimeout(() => {}, 30000)"],{stdio: "ignore"});awaitnewPromise((r)=>child.once("spawn",r));constinfo=processInfo(child.pid!);expect(info?.image.toLowerCase()).toBe("node.exe");// fails: info is null
The query runs right after the spawn event, on a loaded runner with coverage on. When PowerShell is slow or the CIM query does not see the new process yet, processInfo returns null and the test fails with expected undefined to be 'node.exe'.
Seen on the build-and-test (windows-latest, 22) and (windows-latest, 24) legs for commits d4225d7 and bdd4697. The same tests passed on neighbouring commits.
Impact
Intermittent red CI on main. Per the release flow, red CI skips the npm publish.
Suggested fix
Poll processInfo(child.pid) for a few seconds until it returns a value before asserting, as the newer pid-reuse test does by waiting briefly after spawn. Optionally raise the test timeout to cover a slow PowerShell start.
Acceptance criteria
The test waits until the process details are readable before asserting
The Windows legs pass repeatedly without this failure
Filed by repo-audit/fix-issues at abbab4e. Severity: medium. Effort: S. audit-key: testing|src/__tests__/sessions.test.ts|recycled-server-pid-processInfo-null
Fixed in c4a4d69: the test polls processInfo (up to 10 × 500 ms) until the child's details are readable, and its timeout is now 120 s. Passes locally; the Windows CI legs will show whether it holds.
Activity
TMHSDigital commentedon Nov 10, 2026
Fixed in c4a4d69: the test polls
processInfo(up to 10 × 500 ms) until the child's details are readable, and its timeout is now 120 s. Passes locally; the Windows CI legs will show whether it holds.