Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: correct typos in GetPortError message #77

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/get-port.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export async function getPort(
.filter(Boolean)
.join(", ");
throw new GetPortError(
`Unable to find find available port ${_fmtOnHost(
`Unable to find an available port ${_fmtOnHost(
options.host,
)} (tried ${triedRanges})`,
);
Expand All @@ -111,9 +111,7 @@ export async function getPort(
export async function getRandomPort(host?: HostAddress) {
const port = await checkPort(0, host);
if (port === false) {
throw new GetPortError(
`Unable to find any random port ${_fmtOnHost(host)}`,
);
throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
}
return port;
}
Expand Down
4 changes: 2 additions & 2 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe("errors", () => {
host: "192.168.1.999",
}).catch((error) => error);
expect(error.toString()).toMatchInlineSnapshot(
'"GetPortError: Unable to find any random port on host \\"192.168.1.999\\""',
'"GetPortError: Unable to find a random port on host \\"192.168.1.999\\""',
);
});

Expand All @@ -116,7 +116,7 @@ describe("errors", () => {
random: false,
}).catch((error) => error);
expect(error.toString()).toMatchInlineSnapshot(
'"GetPortError: Unable to find find available port on host \\"192.168.1.999\\" (tried 3000, 3000-3100)"',
'"GetPortError: Unable to find an available port on host \\"192.168.1.999\\" (tried 3000, 3000-3100)"',
);
});
});