Skip to content

Commit 1f1b6de

Browse files
committed
fix: add clearRawOutputCallbacks and use in tests to prevent interference
1 parent 5132983 commit 1f1b6de

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: bun run build:all:prod
4949

5050
- name: Run tests
51-
run: bun test --max-concurrency=1
51+
run: bun test
5252

5353
dependency-review:
5454
runs-on: ubuntu-24.04

src/plugin/pty/manager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export function onRawOutput(callback: RawOutputCallback): void {
1919
rawOutputCallbacks.push(callback)
2020
}
2121

22+
export function clearRawOutputCallbacks(): void {
23+
rawOutputCallbacks.length = 0
24+
}
25+
2226
function notifyRawOutput(sessionId: string, rawData: string): void {
2327
for (const callback of rawOutputCallbacks) {
2428
try {

test/pty-echo.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { describe, it, expect, beforeEach, afterEach } from 'bun:test'
2-
import { initManager, manager, onRawOutput } from '../src/plugin/pty/manager.ts'
2+
import {
3+
initManager,
4+
manager,
5+
onRawOutput,
6+
clearRawOutputCallbacks,
7+
} from '../src/plugin/pty/manager.ts'
38

49
describe('PTY Echo Behavior', () => {
510
const fakeClient = {
@@ -17,6 +22,7 @@ describe('PTY Echo Behavior', () => {
1722
afterEach(() => {
1823
// Clean up any sessions
1924
manager.clearAllSessions()
25+
clearRawOutputCallbacks()
2026
})
2127

2228
it('should echo input characters in interactive bash session', async () => {

test/web-server.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, it, expect, beforeEach, afterEach } from 'bun:test'
22
import { startWebServer, stopWebServer, getServerUrl } from '../src/web/server/server.ts'
3-
import { initManager, manager } from '../src/plugin/pty/manager.ts'
3+
import { initManager, manager, clearRawOutputCallbacks } from '../src/plugin/pty/manager.ts'
44

55
describe('Web Server', () => {
66
const fakeClient = {
@@ -18,6 +18,7 @@ describe('Web Server', () => {
1818
afterEach(() => {
1919
stopWebServer()
2020
manager.cleanupAll() // Ensure cleanup after each test
21+
clearRawOutputCallbacks()
2122
})
2223

2324
describe('Server Lifecycle', () => {

0 commit comments

Comments
 (0)