Skip to content

Commit 9809330

Browse files
committed
test(devframe): use dynamic port for ws.test.ts to prevent EADDRINUSE
Fixes test runner crashes caused by concurrent test execution binding to the same hardcoded port on Windows.
1 parent 1b650d3 commit 9809330

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/devframe/src/rpc/transports/ws.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ describe('ws auth token in URL', () => {
3939

4040
describe('devframe rpc', () => {
4141
it('should work w/ ws transport', async () => {
42-
const PORT = 3333
4342
// Use 127.0.0.1 on both client and server so they agree on the
4443
// address family — `localhost` resolution is ambiguous (IPv4 vs IPv6)
4544
// and differs between Windows/macOS/Linux, which causes the client
4645
// to hang when the two sides pick opposite families.
4746
const HOST = '127.0.0.1'
47+
const PORT = await getPort({ random: true, host: HOST })
4848
const WS_URL = `ws://${HOST}:${PORT}`
4949

5050
const serverFunctions = {
@@ -88,7 +88,7 @@ describe('devframe rpc', () => {
8888
// alongside the result path.
8989
it('returns a rejection (not a serialization crash) when a jsonSerializable RPC throws', async () => {
9090
const HOST = '127.0.0.1'
91-
const PORT = await getPort({ port: 3334, host: HOST })
91+
const PORT = await getPort({ random: true, host: HOST })
9292
const WS_URL = `ws://${HOST}:${PORT}`
9393

9494
const serverFunctions = {

0 commit comments

Comments
 (0)