From b4b13005833232798d1d50b1b8208a560968834d Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 5 Apr 2021 23:54:34 +0200 Subject: [PATCH] fix: add \n to surrounding of listen message --- src/index.ts | 4 +--- test/index.test.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index b4d0049..50dd0b1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -106,16 +106,14 @@ export async function listen (handle: http.RequestListener, opts: Partial Local: ${formatURL(url)} ${add}`) if (isExternal) { for (const ip of getExternalIps()) { - // eslint-disable-next-line no-console lines.push(` > Network: ${formatURL(url.replace('localhost', ip))}`) } } // eslint-disable-next-line no-console - console.log(lines.join('\n') + '\n') + console.log('\n' + lines.join('\n') + '\n') } const _open = async () => { diff --git a/test/index.test.ts b/test/index.test.ts index f365ad1..443411b 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(expect.stringMatching('> Local: http://localhost:3000/foo/bar')) + // expect(console.log).toHaveBeenCalledWith(expect.stringMatching('\n > Local: http://localhost:3000/foo/bar')) }) test('listen (https - selfsigned)', async () => {