From 3cc724c9bae94c2f79dd4a902782a66f688a1e61 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Mon, 22 Nov 2021 16:53:58 +0100 Subject: fix(runtime): support reading /proc using readFile (#12839) --- cli/tests/unit/read_text_file_test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'cli/tests/unit/read_text_file_test.ts') diff --git a/cli/tests/unit/read_text_file_test.ts b/cli/tests/unit/read_text_file_test.ts index 8a52831e0..1447fd028 100644 --- a/cli/tests/unit/read_text_file_test.ts +++ b/cli/tests/unit/read_text_file_test.ts @@ -83,3 +83,24 @@ unitTest( assertEquals(resourcesBefore, Deno.resources()); }, ); + +unitTest( + { permissions: { read: true } }, + async function readTextFileWithAbortSignal() { + const ac = new AbortController(); + queueMicrotask(() => ac.abort()); + await assertRejects(async () => { + await Deno.readFile("cli/tests/testdata/fixture.json", { + signal: ac.signal, + }); + }); + }, +); + +unitTest( + { permissions: { read: true }, ignore: Deno.build.os !== "linux" }, + async function readTextFileProcFs() { + const data = await Deno.readTextFile("/proc/self/stat"); + assert(data.length > 0); + }, +); -- cgit v1.2.3