Skip to content

Commit 53f146a

Browse files
authored
chore: mirror testserver close rejecting callbacks (#38271)
1 parent 7671e2b commit 53f146a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/playwright/src/isomorphic/testServerConnection.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ import type * as reporterTypes from '../../types/testReporter';
2121

2222
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
2323

24+
export class TestServerConnectionClosedError extends Error {
25+
constructor() {
26+
super('Test server connection closed');
27+
}
28+
}
29+
2430
export interface TestServerTransport {
2531
onmessage(listener: (message: string) => void): void;
2632
onopen(listener: () => void): void;
@@ -118,6 +124,9 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
118124
this._isClosed = true;
119125
this._onCloseEmitter.fire();
120126
clearInterval(pingInterval);
127+
for (const callback of this._callbacks.values())
128+
callback.reject(new TestServerConnectionClosedError());
129+
this._callbacks.clear();
121130
});
122131
}
123132

0 commit comments

Comments
 (0)