1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 02:29:06 -05:00

fix emptydir on windows (denoland/deno_std#531)

Original: 67641b8ea5
This commit is contained in:
Vincent LE GOFF 2019-07-08 17:09:23 +02:00 committed by Ryan Dahl
parent c08a27de9a
commit 1a42695beb
2 changed files with 6 additions and 4 deletions

View file

@ -18,7 +18,7 @@ export async function emptyDir(dir: string): Promise<void> {
const item = items.shift(); const item = items.shift();
if (item && item.name) { if (item && item.name) {
const fn = dir + "/" + item.name; const fn = dir + "/" + item.name;
Deno.remove(fn, { recursive: true }); await Deno.remove(fn, { recursive: true });
} }
} }
} }

View file

@ -1,6 +1,10 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { test } from "../testing/mod.ts"; 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 { emptyDir, emptyDirSync } from "./empty_dir.ts";
import * as path from "./path/mod.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> { test(async function emptyDirIfItExist(): Promise<void> {
const testDir = path.join(testdataDir, "empty_dir_test_3"); const testDir = path.join(testdataDir, "empty_dir_test_3");
const testNestDir = path.join(testDir, "nest"); const testNestDir = path.join(testDir, "nest");
@ -81,7 +84,6 @@ test(async function emptyDirIfItExist(): Promise<void> {
await Deno.remove(testDir, { recursive: true }); await Deno.remove(testDir, { recursive: true });
} }
}); });
*/
test(function emptyDirSyncIfItExist(): void { test(function emptyDirSyncIfItExist(): void {
const testDir = path.join(testdataDir, "empty_dir_test_4"); const testDir = path.join(testdataDir, "empty_dir_test_4");