Skip to content

Commit 4fb85b5

Browse files
committed
style: apply biome formatting and minor fixes to test files
- Sort imports in test files according to biome rules - Increase timeouts in e2e tests for stability - Add NaN check in port parsing to prevent errors
1 parent c587490 commit 4fb85b5

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎test/e2e/pty-buffer-readraw.pw.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { test as extendedTest, expect } from './fixtures'
21
import type { Page } from '@playwright/test'
3-
2+
import type { createApiClient } from 'opencode-pty/web/shared/api-client'
3+
import { expect, test as extendedTest } from './fixtures'
44
import {
55
getSerializedContentByXtermSerializeAddon,
66
waitForTerminalRegex,
77
} from './xterm-test-helpers'
8-
import type { createApiClient } from 'opencode-pty/web/shared/api-client'
98

109
async function createSession(
1110
api: ReturnType<typeof createApiClient>,
@@ -184,9 +183,9 @@ extendedTest.describe('PTY Buffer readRaw() Function', () => {
184183
args: ['-i'],
185184
description: 'Double Echo Test Session B',
186185
})
187-
await gotoAndSelectSession(page, 'Double Echo Test Session B', 10000)
186+
await gotoAndSelectSession(page, 'Double Echo Test Session B', 15000)
188187
// Debug what prompt is present before event-driven wait
189-
await waitForTerminalRegex(page, /\$\s*$/)
188+
await waitForTerminalRegex(page, /\$\s*$/, {}, 10000)
190189
await page.locator('.terminal.xterm').click()
191190
// Dump buffer before typing in Session B
192191
await page.keyboard.type('1')
@@ -197,9 +196,9 @@ extendedTest.describe('PTY Buffer readRaw() Function', () => {
197196
args: ['-i'],
198197
description: 'Double Echo Test Session C',
199198
})
200-
await gotoAndSelectSession(page, 'Double Echo Test Session C', 10000)
199+
await gotoAndSelectSession(page, 'Double Echo Test Session C', 15000)
201200
// Debug what prompt is present before event-driven wait
202-
await waitForTerminalRegex(page, /\$\s*$/)
201+
await waitForTerminalRegex(page, /\$\s*$/, {}, 10000)
203202
await page.locator('.terminal.xterm').click()
204203
// Dump buffer before typing in Session C
205204
await page.keyboard.type('1')

‎test/e2e/ui/app.pw.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { test as extendedTest, expect } from '../fixtures'
21
import type { PTYSessionInfo } from '../../../src/plugin/pty/types'
2+
import { expect, test as extendedTest } from '../fixtures'
33

44
extendedTest.describe('App Component', () => {
55
extendedTest('renders the PTY Sessions title', async ({ page }) => {
@@ -9,6 +9,7 @@ extendedTest.describe('App Component', () => {
99

1010
extendedTest('shows connected status when WebSocket connects', async ({ page }) => {
1111
// Page automatically navigated to server URL by fixture
12+
await page.waitForSelector('.sidebar', { timeout: 10000 })
1213
await expect(page.getByText('● Connected')).toBeVisible()
1314
})
1415

‎test/npm-pack-integration.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { describe, it, expect, afterEach } from 'bun:test'
2-
import { mkdtempSync, rmSync, copyFileSync, existsSync, mkdirSync } from 'node:fs'
3-
import { join } from 'node:path'
1+
import { afterEach, describe, expect, it } from 'bun:test'
2+
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs'
43
import { tmpdir } from 'node:os'
4+
import { join } from 'node:path'
55

66
// This test ensures the npm package can be packed, installed, and serves assets correctly
77

@@ -114,7 +114,9 @@ describe('npm pack integration', () => {
114114
await new Promise(setImmediate)
115115
}
116116
const bytes = await Bun.file(portFile).bytes()
117-
const port = parseInt(new TextDecoder().decode(bytes).trim(), 10)
117+
const portStr = new TextDecoder().decode(bytes).trim()
118+
const port = parseInt(portStr, 10)
119+
if (Number.isNaN(port)) return 0
118120
return port
119121
}
120122

0 commit comments

Comments
 (0)