Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

test(windows): make the #829 shutdown and preflight tests honest on real Windows

reviewd8edf0cb20fd
diff --git a/scripts/windows-update-preflight.test.ts b/scripts/windows-update-preflight.test.ts
index 05b9f2772..ddcf0dff8 100644
--- a/scripts/windows-update-preflight.test.ts
+++ b/scripts/windows-update-preflight.test.ts
@@ -24,11 +24,14 @@ const staged: Process = {
}
function probe(processes: Process[], fail = false, directory = 'C:\\Apps\\nodeterm'): number | null {
// Override only the query, in a fresh PowerShell process. Never enumerate or stop real sessions.
+ // Emit the parsed rows through a variable: Windows PowerShell 5.1's ConvertFrom-Json writes a
+ // JSON array as ONE pipeline object, so a multi-process fixture reached the script as a single
+ // array-valued "process" (real Get-CimInstance emits one object per process).
const fixture = path.join(temp, 'processes.json')
fs.writeFileSync(fixture, JSON.stringify(processes))
const quote = (s: string): string => "'" + s.replace(/'/g, "''") + "'"
const command = `function Get-CimInstance { param($ClassName, $ErrorAction)
- ${fail ? "throw 'fixture query denied'" : `Get-Content -Raw ${quote(fixture)} | ConvertFrom-Json`}
+ ${fail ? "throw 'fixture query denied'" : `$rows = Get-Content -Raw ${quote(fixture)} | ConvertFrom-Json; $rows`}
}; & ${quote(script)} -InstallDirectory ${quote(directory)}; exit $LASTEXITCODE`
return spawnSync(powershell, ['-NoProfile', '-NonInteractive', '-Command', command], {
timeout: 15000
diff --git a/src/session-host/shutdown-host.test.ts b/src/session-host/shutdown-host.test.ts
index a06fe82c4..472f577ed 100644
--- a/src/session-host/shutdown-host.test.ts
+++ b/src/session-host/shutdown-host.test.ts
@@ -129,6 +129,13 @@ afterEach(() => {
})
+// On win32 the host's kill path never calls the fake node-pty kill(): it runs
+// terminateWindowsProcessTree (real taskkill) against the fixture's fake pid, so a session can
+// never be confirmed ended through this harness there. Same limit and precedent as
+// host-routing.test.ts. These two run on POSIX; the Windows kill path itself is covered by
+// windows-process-tree.test.ts, and the end-to-end shutdown is on the device checklist.
+const posixKillPath = it.skipIf(process.platform === 'win32')
+
const SHUTDOWN_FEATURES = ['geometry', 'shutdown']
async function startHost(): Promise<{
@@ -175,7 +182,7 @@ async function hello(conn: Connection, token: string, features?: string[]): Prom
}
describe('session-host shutdown (issue #829)', () => {
- it('ends every session, replies with their names, then exits and removes its identity', async () => {
+ posixKillPath('ends every session, replies with their names, then exits and removes its identity', async () => {
const { child, dataDir, state, token } = await startHost()
const sockets: Socket[] = []
try {
@@ -234,7 +241,7 @@ describe('session-host shutdown (issue #829)', () => {
}
}, 30_000)
- it('names a session it could not end, stays up, and accepts attaches again', async () => {
+ posixKillPath('names a session it could not end, stays up, and accepts attaches again', async () => {
const { child, state, token } = await startHost()
const sockets: Socket[] = []
try {