diff --git a/src/get-port.ts b/src/get-port.ts index 81b4f86..023e3bd 100644 --- a/src/get-port.ts +++ b/src/get-port.ts @@ -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})`, ); @@ -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; } diff --git a/test/index.test.ts b/test/index.test.ts index d6fdf0d..fff08ab 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -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\\""', ); }); @@ -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)"', ); }); });