Skip to content

Commit

Permalink
fix tests using @ts-ignore because io.httpServer is private
Browse files Browse the repository at this point in the history
  • Loading branch information
tnfAngel committed May 24, 2024
1 parent 693bab4 commit 42879ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/support/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export function createClient<
nsp: string = "/",
opts?: Partial<ManagerOptions & SocketOptions>
): ClientSocket<STC, CTS> {
// @ts-ignore
const port = io.httpServer.address().port;
const address = io.httpServer.address();
const port = (typeof address !== "string" && address?.port) || 0;
return ioc(`http://localhost:${port}${nsp}`, opts);
}

Expand Down Expand Up @@ -74,8 +74,8 @@ export function assert(condition: any): asserts condition {
}

export function getPort(io: Server): number {
// @ts-ignore
return io.httpServer.address().port;
const address = io.httpServer.address();
return (typeof address !== "string" && address?.port) || 0;
}

export function createPartialDone(count: number, done: (err?: Error) => void) {
Expand Down

0 comments on commit 42879ab

Please sign in to comment.