Skip to content

Commit c583224

Browse files
committed
fix(portcheck): feedback from PR 266#discussion_r255314895
1 parent cc7f429 commit c583224

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/common/net.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ describe("Net", () => {
1515
describe("#isPortAvailable", () => {
1616
context("when the port is not allowed to be bound", () => {
1717
it("should return a rejected promise", () => {
18-
expect(isPortAvailable(specialPort, host)).to.eventually.be.rejected;
18+
return expect(isPortAvailable(specialPort, host)).to.eventually.be.rejected;
1919
});
2020
});
2121

2222
context("when the port is available", () => {
23-
it("should return a fulfilled promise", () => {
24-
expect(isPortAvailable(port + 1, host)).to.eventually.be.fulfilled;
23+
it("should return a fulfilled promise", () => {
24+
return expect(isPortAvailable(port, host)).to.eventually.be.fulfilled;
2525
});
2626
});
2727

2828
context("when the port is unavailable", () => {
2929
it("should return a rejected promise", () => {
3030
createServer(port).then((_: { close(): any }) => {
31-
expect(isPortAvailable(port, host)).to.eventually.be.rejected;
31+
return expect(isPortAvailable(port, host)).to.eventually.be.rejected;
3232
});
3333
});
3434
});

src/common/net.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const portCheck = (port: number, host: string): Promise<void> => {
2121
.listen({ port, host, exclusive: true })
2222
.on("error", (e: any) => {
2323
if (e.code === "EADDRINUSE") {
24-
reject(new Error(`Port ${port} is unavailable`))
24+
reject(new Error(`Port ${port} is unavailable on address ${host}`))
2525
} else {
2626
reject(e);
2727
}

0 commit comments

Comments
 (0)