From 6fe9428805f80222daaf4ccdf9995f2e53b511ff Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Fri, 4 Nov 2022 04:00:53 +0900 Subject: fix(runtime): fix Deno.hostname on windows (#16530) --- cli/tests/unit/os_test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index a7329ddb4..04ddf8ae0 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -208,6 +208,18 @@ Deno.test( }, ); +Deno.test( + { permissions: { run: [Deno.execPath()], read: true } }, + // See https://github.com/denoland/deno/issues/16527 + async function hostnameWithoutOtherNetworkUsages() { + const { stdout } = await Deno.spawn(Deno.execPath(), { + args: ["eval", "-p", "Deno.hostname()"], + }); + const hostname = new TextDecoder().decode(stdout).trim(); + assert(hostname.length > 0); + }, +); + Deno.test({ permissions: { sys: false } }, function hostnamePerm() { assertThrows(() => { Deno.hostname(); -- cgit v1.2.3