From a55f0eb2fc005016dc9d44bfe4771dd451df9c30 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Sat, 11 Feb 2023 15:14:02 +0100 Subject: feat: add signal option to Deno.resolveDns (#17384) Closes #14406 --- cli/tests/testdata/run/resolve_dns.ts | 22 ++++++++++++++++++++++ cli/tests/testdata/run/resolve_dns.ts.out | 2 ++ 2 files changed, 24 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/testdata/run/resolve_dns.ts b/cli/tests/testdata/run/resolve_dns.ts index ae6ed70a4..a2d0fd046 100644 --- a/cli/tests/testdata/run/resolve_dns.ts +++ b/cli/tests/testdata/run/resolve_dns.ts @@ -69,3 +69,25 @@ try { } catch (e) { console.log(e.message); } + +try { + const ac = new AbortController(); + queueMicrotask(() => ac.abort()); + await Deno.resolveDns("www.example.com", "A", { + ...nameServer, + signal: ac.signal, + }); +} catch (e) { + console.log(e.name); +} + +try { + const ac = new AbortController(); + ac.abort(); + await Deno.resolveDns("www.example.com", "A", { + ...nameServer, + signal: ac.signal, + }); +} catch (e) { + console.log(e.name); +} diff --git a/cli/tests/testdata/run/resolve_dns.ts.out b/cli/tests/testdata/run/resolve_dns.ts.out index f41dc68bc..025028395 100644 --- a/cli/tests/testdata/run/resolve_dns.ts.out +++ b/cli/tests/testdata/run/resolve_dns.ts.out @@ -24,3 +24,5 @@ TXT [["I","am","a","txt","record"],["I","am","another","txt","record"],["I am a different","txt record"],["key=val"]] Error NotFound thrown for not-found-example.com Provided record type is not supported +AbortError +AbortError -- cgit v1.2.3