Make warnings fail
Original: 4543b563a9
This commit is contained in:
Vincent LE GOFF 2019-04-24 13:41:23 +02:00 committed by Ryan Dahl
parent e1f7a60bb3
commit dcd01dd025
88 changed files with 948 additions and 806 deletions

View file

@ -10,7 +10,7 @@ import * as path from "./path/mod.ts";
const testdataDir = path.resolve("fs", "testdata");
test(async function emptyDirIfItNotExist() {
test(async function emptyDirIfItNotExist(): Promise<void> {
const testDir = path.join(testdataDir, "empty_dir_test_1");
const testNestDir = path.join(testDir, "nest");
// empty a dir which not exist. then it will create new one
@ -26,7 +26,7 @@ test(async function emptyDirIfItNotExist() {
}
});
test(function emptyDirSyncIfItNotExist() {
test(function emptyDirSyncIfItNotExist(): void {
const testDir = path.join(testdataDir, "empty_dir_test_2");
const testNestDir = path.join(testDir, "nest");
// empty a dir which not exist. then it will create new one
@ -42,7 +42,7 @@ test(function emptyDirSyncIfItNotExist() {
}
});
test(async function emptyDirIfItExist() {
test(async function emptyDirIfItExist(): Promise<void> {
const testDir = path.join(testdataDir, "empty_dir_test_3");
const testNestDir = path.join(testDir, "nest");
// create test dir
@ -67,21 +67,25 @@ test(async function emptyDirIfItExist() {
assertEquals(stat.isDirectory(), true);
// nest directory have been remove
await assertThrowsAsync(async () => {
await Deno.stat(testNestDir);
});
await assertThrowsAsync(
async (): Promise<void> => {
await Deno.stat(testNestDir);
}
);
// test file have been remove
await assertThrowsAsync(async () => {
await Deno.stat(testDirFile);
});
await assertThrowsAsync(
async (): Promise<void> => {
await Deno.stat(testDirFile);
}
);
} finally {
// remote test dir
await Deno.remove(testDir, { recursive: true });
}
});
test(function emptyDirSyncIfItExist() {
test(function emptyDirSyncIfItExist(): void {
const testDir = path.join(testdataDir, "empty_dir_test_4");
const testNestDir = path.join(testDir, "nest");
// create test dir
@ -106,14 +110,18 @@ test(function emptyDirSyncIfItExist() {
assertEquals(stat.isDirectory(), true);
// nest directory have been remove
assertThrows(() => {
Deno.statSync(testNestDir);
});
assertThrows(
(): void => {
Deno.statSync(testNestDir);
}
);
// test file have been remove
assertThrows(() => {
Deno.statSync(testDirFile);
});
assertThrows(
(): void => {
Deno.statSync(testDirFile);
}
);
} finally {
// remote test dir
Deno.removeSync(testDir, { recursive: true });