diff --git a/src/index.ts b/src/index.ts index b0c7f0d..b4d0049 100644 --- a/src/index.ts +++ b/src/index.ts @@ -105,14 +105,17 @@ export async function listen (handle: http.RequestListener, opts: Partial Local: ${formatURL(url)} ${add}`) + lines.push(` > Local: ${formatURL(url)} ${add}`) if (isExternal) { for (const ip of getExternalIps()) { // eslint-disable-next-line no-console - console.log(` > Network: ${formatURL(url.replace('localhost', ip))}`) + lines.push(` > Network: ${formatURL(url.replace('localhost', ip))}`) } } + // eslint-disable-next-line no-console + console.log(lines.join('\n') + '\n') } const _open = async () => { diff --git a/test/index.test.ts b/test/index.test.ts index 97e21f3..f365ad1 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -44,7 +44,7 @@ describe('listhen', () => { expect(listener.url.startsWith('http://')).toBe(true) expect(listener.url.endsWith('/foo/bar')).toBe(true) // eslint-disable-next-line no-console - expect(console.log).toHaveBeenCalledWith(' > Local: http://localhost:3000/foo/bar (copied to clipboard)') + expect(console.log).toHaveBeenCalledWith(expect.stringMatching('> Local: http://localhost:3000/foo/bar')) }) test('listen (https - selfsigned)', async () => {