From 597f2d8d4d9b91ee586b9787d6ba52d247e4ff87 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Sat, 14 Sep 2024 23:30:06 +0200 Subject: feat: print `Listening on` messages on stderr instead of stdout (#25491) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/denoland/deno/issues/25114 --------- Signed-off-by: Leo Kettmeir Co-authored-by: Bartek IwaƄczuk Co-authored-by: crowlkats Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> --- tests/unit/serve_test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts index 4a19d8df2..c1e217a11 100644 --- a/tests/unit/serve_test.ts +++ b/tests/unit/serve_test.ts @@ -792,8 +792,8 @@ Deno.test( async function httpServerDefaultOnListenCallback() { const ac = new AbortController(); - const consoleLog = console.log; - console.log = (msg) => { + const consoleError = console.error; + console.error = (msg) => { try { const match = msg.match( /Listening on http:\/\/(localhost|0\.0\.0\.0):(\d+)\//, @@ -818,7 +818,7 @@ Deno.test( await server.finished; } finally { - console.log = consoleLog; + console.error = consoleError; } }, ); @@ -875,8 +875,8 @@ Deno.test({ permissions: { net: true } }, async function ipv6Hostname() { const ac = new AbortController(); let url = ""; - const consoleLog = console.log; - console.log = (msg) => { + const consoleError = console.error; + console.error = (msg) => { try { const match = msg.match(/Listening on (http:\/\/(.*?):(\d+)\/)/); assert(!!match, `Didn't match ${msg}`); @@ -897,7 +897,7 @@ Deno.test({ permissions: { net: true } }, async function ipv6Hostname() { assert(new URL(url), `Not a valid URL "${url}"`); await server.shutdown(); } finally { - console.log = consoleLog; + console.error = consoleError; } }); -- cgit v1.2.3