From 62786cfebb5c9fe36d0930582951f442bdfe9441 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 25 Jan 2024 01:59:55 +1100 Subject: feat: deprecate `Deno.close()` (#22066) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For removal in Deno v2. --------- Co-authored-by: Bartek IwaƄczuk --- cli/tests/unit_node/_fs/_fs_write_test.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'cli/tests/unit_node/_fs/_fs_write_test.ts') diff --git a/cli/tests/unit_node/_fs/_fs_write_test.ts b/cli/tests/unit_node/_fs/_fs_write_test.ts index 2c5c3d58e..ef538e9e4 100644 --- a/cli/tests/unit_node/_fs/_fs_write_test.ts +++ b/cli/tests/unit_node/_fs/_fs_write_test.ts @@ -9,7 +9,7 @@ Deno.test({ name: "Data is written to the file with the correct length", async fn() { const tempFile: string = await Deno.makeTempFile(); - const file: Deno.FsFile = await Deno.open(tempFile, { + using file = await Deno.open(tempFile, { create: true, write: true, read: true, @@ -21,7 +21,6 @@ Deno.test({ resolve(nwritten); }); }); - Deno.close(file.rid); const data = await Deno.readFile(tempFile); await Deno.remove(tempFile); @@ -35,14 +34,13 @@ Deno.test({ name: "Data is written synchronously to the file with the correct length", fn() { const tempFile: string = Deno.makeTempFileSync(); - const file: Deno.FsFile = Deno.openSync(tempFile, { + using file = Deno.openSync(tempFile, { create: true, write: true, read: true, }); const buffer = Buffer.from("hello world"); const bytesWrite = writeSync(file.rid, buffer, 0, 5); - Deno.close(file.rid); const data = Deno.readFileSync(tempFile); Deno.removeSync(tempFile); -- cgit v1.2.3