Skip to content

Commit 5908f54

Browse files
committed
fix(test): enable concurrent execution and fix websocket test flakiness
Refactor websocket and web-server tests to use beforeAll/afterAll instead of beforeEach/afterEach, and improve WebSocket connection handling. Update CI to run tests concurrently. This fixes flaky tests and improves CI performance.
1 parent a644aab commit 5908f54

3 files changed

Lines changed: 118 additions & 91 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
- name: Run test
4646
if: matrix.quality == 'test'
47-
run: bun test websocket.test.ts web-server.test.ts types.test.ts spawn-repeat.test.ts pty-tools.test.ts
47+
run: bun test --concurrent websocket.test.ts web-server.test.ts types.test.ts spawn-repeat.test.ts pty-tools.test.ts
4848

4949
- name: Type check
5050
if: matrix.quality == 'typecheck'

test/web-server.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, beforeEach, afterEach } from 'bun:test'
1+
import { describe, it, expect, beforeAll, afterAll } from 'bun:test'
22
import {
33
initManager,
44
manager,
@@ -22,14 +22,14 @@ describe('Web Server', () => {
2222
let server: PTYServer
2323
let disposableStack: DisposableStack
2424

25-
beforeEach(async () => {
25+
beforeAll(async () => {
2626
disposableStack = new DisposableStack()
2727
initManager(fakeClient)
2828
server = await PTYServer.createServer()
2929
disposableStack.use(server)
3030
})
3131

32-
afterEach(() => {
32+
afterAll(() => {
3333
manager.clearAllSessions()
3434
disposableStack.dispose()
3535
sessionUpdateCallbacks.length = 0

0 commit comments

Comments
 (0)