Skip to content

Commit 0b04e72

Browse files
committed
test(hub): gate interactive PTY stdin-echo test to POSIX
Windows ConPTY doesn't provide reliable POSIX stdin-echo timing, so the input-echo assertion is flaky there — mirror the terminals plugin's itPosixPty gate. The session's interactive/type marking is still asserted cross-platform in the natural-exit test.
1 parent 744c270 commit 0b04e72

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

packages/hub/src/node/__tests__/host-terminals.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ const NODE = process.execPath
99
// A real PTY works wherever zigpty's native bindings load (incl. Windows
1010
// ConPTY); skip when they're unavailable.
1111
const itPty = hasNative ? it : it.skip
12+
// Interactive stdin echo relies on POSIX PTY semantics that Windows ConPTY
13+
// doesn't reliably provide (echo timing); skip there, mirroring the terminals
14+
// plugin's own `itPosixPty` gate.
15+
const itPosixPty = (hasNative && process.platform !== 'win32') ? it : it.skip
1216

1317
interface FakeSink {
1418
write: ReturnType<typeof vi.fn>
@@ -140,7 +144,7 @@ describe('devframeTerminalHost stream lifecycle', () => {
140144
})
141145

142146
describe('devframeTerminalHost interactive PTY sessions', () => {
143-
itPty('spawns an interactive PTY that accepts input and is marked interactive', async () => {
147+
itPosixPty('spawns an interactive PTY that accepts input and is marked interactive', async () => {
144148
const { host, sinks } = createTerminalHost()
145149

146150
const session = await host.startPtySession({
@@ -172,14 +176,20 @@ describe('devframeTerminalHost interactive PTY sessions', () => {
172176
itPty('closes the PTY stream after natural process exit', async () => {
173177
const { host, sinks } = createTerminalHost()
174178

175-
await host.startPtySession({
179+
const session = await host.startPtySession({
176180
command: NODE,
177181
args: ['-e', 'process.stdout.write("done")'],
178182
}, {
179183
id: 'pty-exit',
180184
title: 'PTY exit',
181185
})
182186

187+
// Session shape (cross-platform): a PTY session is flagged interactive so
188+
// hub-aware UIs enable stdin.
189+
expect(session.type).toBe('pty')
190+
expect(session.interactive).toBe(true)
191+
expect(host.sessions.get('pty-exit')?.interactive).toBe(true)
192+
183193
await waitUntil(() => {
184194
expect(sinks.get('pty-exit')?.closed).toBe(true)
185195
})

0 commit comments

Comments
 (0)