diff options
author | Vincent LE GOFF <g_n_s@hotmail.fr> | 2019-07-08 17:09:23 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-08 11:09:23 -0400 |
commit | 1a42695bebb77cfc4a27f08a6bb323017901be26 (patch) | |
tree | 1df72b2a30407b40c9b9bc52b6367c2ed346fbfc | |
parent | c08a27de9ac136d212b6510976435e1fc9694dc8 (diff) |
fix emptydir on windows (denoland/deno_std#531)
Original: https://github.com/denoland/deno_std/commit/67641b8ea5ba869854ca042e11b200b90da5fc4b
-rw-r--r-- | fs/empty_dir.ts | 2 | ||||
-rw-r--r-- | fs/empty_dir_test.ts | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/fs/empty_dir.ts b/fs/empty_dir.ts index 51be09971..81bc45839 100644 --- a/fs/empty_dir.ts +++ b/fs/empty_dir.ts @@ -18,7 +18,7 @@ export async function emptyDir(dir: string): Promise<void> { const item = items.shift(); if (item && item.name) { const fn = dir + "/" + item.name; - Deno.remove(fn, { recursive: true }); + await Deno.remove(fn, { recursive: true }); } } } diff --git a/fs/empty_dir_test.ts b/fs/empty_dir_test.ts index 0a8f1e633..b44e600d7 100644 --- a/fs/empty_dir_test.ts +++ b/fs/empty_dir_test.ts @@ -1,6 +1,10 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { test } from "../testing/mod.ts"; -import { assertEquals, assertThrows } from "../testing/asserts.ts"; +import { + assertEquals, + assertThrows, + assertThrowsAsync +} from "../testing/asserts.ts"; import { emptyDir, emptyDirSync } from "./empty_dir.ts"; import * as path from "./path/mod.ts"; @@ -38,7 +42,6 @@ test(function emptyDirSyncIfItNotExist(): void { } }); -/* TODO(ry) Re-enable this test. It's broken on windows. test(async function emptyDirIfItExist(): Promise<void> { const testDir = path.join(testdataDir, "empty_dir_test_3"); const testNestDir = path.join(testDir, "nest"); @@ -81,7 +84,6 @@ test(async function emptyDirIfItExist(): Promise<void> { await Deno.remove(testDir, { recursive: true }); } }); -*/ test(function emptyDirSyncIfItExist(): void { const testDir = path.join(testdataDir, "empty_dir_test_4"); |