From 472ce5f04849193d49aa5342f77857e7987263f7 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 8 Jul 2019 17:03:05 +0200 Subject: [PATCH] fix emptydir on windows --- fs/empty_dir.ts | 2 +- 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 51be09971546..81bc45839eef 100644 --- a/fs/empty_dir.ts +++ b/fs/empty_dir.ts @@ -18,7 +18,7 @@ export async function emptyDir(dir: string): Promise { 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 0a8f1e633279..b44e600d748f 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 { const testDir = path.join(testdataDir, "empty_dir_test_3"); const testNestDir = path.join(testDir, "nest"); @@ -81,7 +84,6 @@ test(async function emptyDirIfItExist(): Promise { await Deno.remove(testDir, { recursive: true }); } }); -*/ test(function emptyDirSyncIfItExist(): void { const testDir = path.join(testdataDir, "empty_dir_test_4");