summaryrefslogtreecommitdiff
path: root/std/fs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-04-28 12:33:09 +0200
committerGitHub <noreply@github.com>2020-04-28 12:33:09 +0200
commit8feb30e3258ed9690eb850e3ca22842b260a0403 (patch)
tree6805bfe3df675c2c7f6a379093061c6b73d8365a /std/fs
parentb508e845671de9351c3f51755647371d76128d29 (diff)
BREAKING: remove overload of Deno.test() (#4951)
This commit removes overload of Deno.test() that accepted named function.
Diffstat (limited to 'std/fs')
-rw-r--r--std/fs/empty_dir_test.ts8
-rw-r--r--std/fs/ensure_dir_test.ts12
-rw-r--r--std/fs/ensure_file_test.ts12
-rw-r--r--std/fs/ensure_link_test.ts12
-rw-r--r--std/fs/ensure_symlink_test.ts12
-rw-r--r--std/fs/expand_glob_test.ts16
-rw-r--r--std/fs/move_test.ts142
-rw-r--r--std/fs/read_file_str_test.ts4
-rw-r--r--std/fs/read_json_test.ts26
-rw-r--r--std/fs/utils_test.ts4
-rw-r--r--std/fs/write_file_str_test.ts4
-rw-r--r--std/fs/write_json_test.ts20
12 files changed, 138 insertions, 134 deletions
diff --git a/std/fs/empty_dir_test.ts b/std/fs/empty_dir_test.ts
index 59b12fbc9..b3be1f617 100644
--- a/std/fs/empty_dir_test.ts
+++ b/std/fs/empty_dir_test.ts
@@ -11,7 +11,7 @@ import { emptyDir, emptyDirSync } from "./empty_dir.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(async function emptyDirIfItNotExist(): Promise<void> {
+Deno.test("emptyDirIfItNotExist", async function (): 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
@@ -27,7 +27,7 @@ Deno.test(async function emptyDirIfItNotExist(): Promise<void> {
}
});
-Deno.test(function emptyDirSyncIfItNotExist(): void {
+Deno.test("emptyDirSyncIfItNotExist", function (): 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
@@ -43,7 +43,7 @@ Deno.test(function emptyDirSyncIfItNotExist(): void {
}
});
-Deno.test(async function emptyDirIfItExist(): Promise<void> {
+Deno.test("emptyDirIfItExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "empty_dir_test_3");
const testNestDir = path.join(testDir, "nest");
// create test dir
@@ -86,7 +86,7 @@ Deno.test(async function emptyDirIfItExist(): Promise<void> {
}
});
-Deno.test(function emptyDirSyncIfItExist(): void {
+Deno.test("emptyDirSyncIfItExist", function (): void {
const testDir = path.join(testdataDir, "empty_dir_test_4");
const testNestDir = path.join(testDir, "nest");
// create test dir
diff --git a/std/fs/ensure_dir_test.ts b/std/fs/ensure_dir_test.ts
index 10c19c9c9..d70f5eb1a 100644
--- a/std/fs/ensure_dir_test.ts
+++ b/std/fs/ensure_dir_test.ts
@@ -6,7 +6,7 @@ import { ensureFile, ensureFileSync } from "./ensure_file.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(async function ensureDirIfItNotExist(): Promise<void> {
+Deno.test("ensureDirIfItNotExist", async function (): Promise<void> {
const baseDir = path.join(testdataDir, "ensure_dir_not_exist");
const testDir = path.join(baseDir, "test");
@@ -23,7 +23,7 @@ Deno.test(async function ensureDirIfItNotExist(): Promise<void> {
await Deno.remove(baseDir, { recursive: true });
});
-Deno.test(function ensureDirSyncIfItNotExist(): void {
+Deno.test("ensureDirSyncIfItNotExist", function (): void {
const baseDir = path.join(testdataDir, "ensure_dir_sync_not_exist");
const testDir = path.join(baseDir, "test");
@@ -34,7 +34,7 @@ Deno.test(function ensureDirSyncIfItNotExist(): void {
Deno.removeSync(baseDir, { recursive: true });
});
-Deno.test(async function ensureDirIfItExist(): Promise<void> {
+Deno.test("ensureDirIfItExist", async function (): Promise<void> {
const baseDir = path.join(testdataDir, "ensure_dir_exist");
const testDir = path.join(baseDir, "test");
@@ -54,7 +54,7 @@ Deno.test(async function ensureDirIfItExist(): Promise<void> {
await Deno.remove(baseDir, { recursive: true });
});
-Deno.test(function ensureDirSyncIfItExist(): void {
+Deno.test("ensureDirSyncIfItExist", function (): void {
const baseDir = path.join(testdataDir, "ensure_dir_sync_exist");
const testDir = path.join(baseDir, "test");
@@ -71,7 +71,7 @@ Deno.test(function ensureDirSyncIfItExist(): void {
Deno.removeSync(baseDir, { recursive: true });
});
-Deno.test(async function ensureDirIfItAsFile(): Promise<void> {
+Deno.test("ensureDirIfItAsFile", async function (): Promise<void> {
const baseDir = path.join(testdataDir, "ensure_dir_exist_file");
const testFile = path.join(baseDir, "test");
@@ -88,7 +88,7 @@ Deno.test(async function ensureDirIfItAsFile(): Promise<void> {
await Deno.remove(baseDir, { recursive: true });
});
-Deno.test(function ensureDirSyncIfItAsFile(): void {
+Deno.test("ensureDirSyncIfItAsFile", function (): void {
const baseDir = path.join(testdataDir, "ensure_dir_exist_file_async");
const testFile = path.join(baseDir, "test");
diff --git a/std/fs/ensure_file_test.ts b/std/fs/ensure_file_test.ts
index 92d5ac062..1e51db451 100644
--- a/std/fs/ensure_file_test.ts
+++ b/std/fs/ensure_file_test.ts
@@ -5,7 +5,7 @@ import { ensureFile, ensureFileSync } from "./ensure_file.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(async function ensureFileIfItNotExist(): Promise<void> {
+Deno.test("ensureFileIfItNotExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "ensure_file_1");
const testFile = path.join(testDir, "test.txt");
@@ -22,7 +22,7 @@ Deno.test(async function ensureFileIfItNotExist(): Promise<void> {
await Deno.remove(testDir, { recursive: true });
});
-Deno.test(function ensureFileSyncIfItNotExist(): void {
+Deno.test("ensureFileSyncIfItNotExist", function (): void {
const testDir = path.join(testdataDir, "ensure_file_2");
const testFile = path.join(testDir, "test.txt");
@@ -36,7 +36,7 @@ Deno.test(function ensureFileSyncIfItNotExist(): void {
Deno.removeSync(testDir, { recursive: true });
});
-Deno.test(async function ensureFileIfItExist(): Promise<void> {
+Deno.test("ensureFileIfItExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "ensure_file_3");
const testFile = path.join(testDir, "test.txt");
@@ -56,7 +56,7 @@ Deno.test(async function ensureFileIfItExist(): Promise<void> {
await Deno.remove(testDir, { recursive: true });
});
-Deno.test(function ensureFileSyncIfItExist(): void {
+Deno.test("ensureFileSyncIfItExist", function (): void {
const testDir = path.join(testdataDir, "ensure_file_4");
const testFile = path.join(testDir, "test.txt");
@@ -73,7 +73,7 @@ Deno.test(function ensureFileSyncIfItExist(): void {
Deno.removeSync(testDir, { recursive: true });
});
-Deno.test(async function ensureFileIfItExistAsDir(): Promise<void> {
+Deno.test("ensureFileIfItExistAsDir", async function (): Promise<void> {
const testDir = path.join(testdataDir, "ensure_file_5");
await Deno.mkdir(testDir, { recursive: true });
@@ -89,7 +89,7 @@ Deno.test(async function ensureFileIfItExistAsDir(): Promise<void> {
await Deno.remove(testDir, { recursive: true });
});
-Deno.test(function ensureFileSyncIfItExistAsDir(): void {
+Deno.test("ensureFileSyncIfItExistAsDir", function (): void {
const testDir = path.join(testdataDir, "ensure_file_6");
Deno.mkdirSync(testDir, { recursive: true });
diff --git a/std/fs/ensure_link_test.ts b/std/fs/ensure_link_test.ts
index 235650ebf..e05d3a648 100644
--- a/std/fs/ensure_link_test.ts
+++ b/std/fs/ensure_link_test.ts
@@ -10,7 +10,7 @@ import { ensureLink, ensureLinkSync } from "./ensure_link.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(async function ensureLinkIfItNotExist(): Promise<void> {
+Deno.test("ensureLinkIfItNotExist", async function (): Promise<void> {
const srcDir = path.join(testdataDir, "ensure_link_1");
const destDir = path.join(testdataDir, "ensure_link_1_2");
const testFile = path.join(srcDir, "test.txt");
@@ -25,7 +25,7 @@ Deno.test(async function ensureLinkIfItNotExist(): Promise<void> {
await Deno.remove(destDir, { recursive: true });
});
-Deno.test(function ensureLinkSyncIfItNotExist(): void {
+Deno.test("ensureLinkSyncIfItNotExist", function (): void {
const testDir = path.join(testdataDir, "ensure_link_2");
const testFile = path.join(testDir, "test.txt");
const linkFile = path.join(testDir, "link.txt");
@@ -37,7 +37,7 @@ Deno.test(function ensureLinkSyncIfItNotExist(): void {
Deno.removeSync(testDir, { recursive: true });
});
-Deno.test(async function ensureLinkIfItExist(): Promise<void> {
+Deno.test("ensureLinkIfItExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "ensure_link_3");
const testFile = path.join(testDir, "test.txt");
const linkFile = path.join(testDir, "link.txt");
@@ -84,7 +84,7 @@ Deno.test(async function ensureLinkIfItExist(): Promise<void> {
await Deno.remove(testDir, { recursive: true });
});
-Deno.test(function ensureLinkSyncIfItExist(): void {
+Deno.test("ensureLinkSyncIfItExist", function (): void {
const testDir = path.join(testdataDir, "ensure_link_4");
const testFile = path.join(testDir, "test.txt");
const linkFile = path.join(testDir, "link.txt");
@@ -132,7 +132,7 @@ Deno.test(function ensureLinkSyncIfItExist(): void {
Deno.removeSync(testDir, { recursive: true });
});
-Deno.test(async function ensureLinkDirectoryIfItExist(): Promise<void> {
+Deno.test("ensureLinkDirectoryIfItExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "ensure_link_origin_3");
const linkDir = path.join(testdataDir, "ensure_link_link_3");
const testFile = path.join(testDir, "test.txt");
@@ -151,7 +151,7 @@ Deno.test(async function ensureLinkDirectoryIfItExist(): Promise<void> {
Deno.removeSync(testDir, { recursive: true });
});
-Deno.test(function ensureLinkSyncDirectoryIfItExist(): void {
+Deno.test("ensureLinkSyncDirectoryIfItExist", function (): void {
const testDir = path.join(testdataDir, "ensure_link_origin_3");
const linkDir = path.join(testdataDir, "ensure_link_link_3");
const testFile = path.join(testDir, "test.txt");
diff --git a/std/fs/ensure_symlink_test.ts b/std/fs/ensure_symlink_test.ts
index bbd31ef24..2264a6c37 100644
--- a/std/fs/ensure_symlink_test.ts
+++ b/std/fs/ensure_symlink_test.ts
@@ -11,7 +11,7 @@ import { ensureSymlink, ensureSymlinkSync } from "./ensure_symlink.ts";
const testdataDir = path.resolve("fs", "testdata");
const isWindows = Deno.build.os === "win";
-Deno.test(async function ensureSymlinkIfItNotExist(): Promise<void> {
+Deno.test("ensureSymlinkIfItNotExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "link_file_1");
const testFile = path.join(testDir, "test.txt");
@@ -30,7 +30,7 @@ Deno.test(async function ensureSymlinkIfItNotExist(): Promise<void> {
);
});
-Deno.test(function ensureSymlinkSyncIfItNotExist(): void {
+Deno.test("ensureSymlinkSyncIfItNotExist", function (): void {
const testDir = path.join(testdataDir, "link_file_2");
const testFile = path.join(testDir, "test.txt");
@@ -44,7 +44,7 @@ Deno.test(function ensureSymlinkSyncIfItNotExist(): void {
});
});
-Deno.test(async function ensureSymlinkIfItExist(): Promise<void> {
+Deno.test("ensureSymlinkIfItExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "link_file_3");
const testFile = path.join(testDir, "test.txt");
const linkFile = path.join(testDir, "link.txt");
@@ -73,7 +73,7 @@ Deno.test(async function ensureSymlinkIfItExist(): Promise<void> {
await Deno.remove(testDir, { recursive: true });
});
-Deno.test(function ensureSymlinkSyncIfItExist(): void {
+Deno.test("ensureSymlinkSyncIfItExist", function (): void {
const testDir = path.join(testdataDir, "link_file_4");
const testFile = path.join(testDir, "test.txt");
const linkFile = path.join(testDir, "link.txt");
@@ -103,7 +103,7 @@ Deno.test(function ensureSymlinkSyncIfItExist(): void {
Deno.removeSync(testDir, { recursive: true });
});
-Deno.test(async function ensureSymlinkDirectoryIfItExist(): Promise<void> {
+Deno.test("ensureSymlinkDirectoryIfItExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "link_file_origin_3");
const linkDir = path.join(testdataDir, "link_file_link_3");
const testFile = path.join(testDir, "test.txt");
@@ -135,7 +135,7 @@ Deno.test(async function ensureSymlinkDirectoryIfItExist(): Promise<void> {
await Deno.remove(testDir, { recursive: true });
});
-Deno.test(function ensureSymlinkSyncDirectoryIfItExist(): void {
+Deno.test("ensureSymlinkSyncDirectoryIfItExist", function (): void {
const testDir = path.join(testdataDir, "link_file_origin_3");
const linkDir = path.join(testdataDir, "link_file_link_3");
const testFile = path.join(testDir, "test.txt");
diff --git a/std/fs/expand_glob_test.ts b/std/fs/expand_glob_test.ts
index 4e6f74551..a2e6b4333 100644
--- a/std/fs/expand_glob_test.ts
+++ b/std/fs/expand_glob_test.ts
@@ -51,7 +51,7 @@ const EG_OPTIONS: ExpandGlobOptions = {
globstar: false,
};
-Deno.test(async function expandGlobWildcard(): Promise<void> {
+Deno.test("expandGlobWildcard", async function (): Promise<void> {
const options = EG_OPTIONS;
assertEquals(await expandGlobArray("*", options), [
"abc",
@@ -61,12 +61,12 @@ Deno.test(async function expandGlobWildcard(): Promise<void> {
]);
});
-Deno.test(async function expandGlobTrailingSeparator(): Promise<void> {
+Deno.test("expandGlobTrailingSeparator", async function (): Promise<void> {
const options = EG_OPTIONS;
assertEquals(await expandGlobArray("*/", options), ["subdir"]);
});
-Deno.test(async function expandGlobParent(): Promise<void> {
+Deno.test("expandGlobParent", async function (): Promise<void> {
const options = EG_OPTIONS;
assertEquals(await expandGlobArray("subdir/../*", options), [
"abc",
@@ -76,7 +76,7 @@ Deno.test(async function expandGlobParent(): Promise<void> {
]);
});
-Deno.test(async function expandGlobExt(): Promise<void> {
+Deno.test("expandGlobExt", async function (): Promise<void> {
const options = { ...EG_OPTIONS, extended: true };
assertEquals(await expandGlobArray("abc?(def|ghi)", options), [
"abc",
@@ -96,7 +96,7 @@ Deno.test(async function expandGlobExt(): Promise<void> {
assertEquals(await expandGlobArray("abc!(def|ghi)", options), ["abc"]);
});
-Deno.test(async function expandGlobGlobstar(): Promise<void> {
+Deno.test("expandGlobGlobstar", async function (): Promise<void> {
const options = { ...EG_OPTIONS, globstar: true };
assertEquals(
await expandGlobArray(joinGlobs(["**", "abc"], options), options),
@@ -104,7 +104,7 @@ Deno.test(async function expandGlobGlobstar(): Promise<void> {
);
});
-Deno.test(async function expandGlobGlobstarParent(): Promise<void> {
+Deno.test("expandGlobGlobstarParent", async function (): Promise<void> {
const options = { ...EG_OPTIONS, globstar: true };
assertEquals(
await expandGlobArray(joinGlobs(["subdir", "**", ".."], options), options),
@@ -112,12 +112,12 @@ Deno.test(async function expandGlobGlobstarParent(): Promise<void> {
);
});
-Deno.test(async function expandGlobIncludeDirs(): Promise<void> {
+Deno.test("expandGlobIncludeDirs", async function (): Promise<void> {
const options = { ...EG_OPTIONS, includeDirs: false };
assertEquals(await expandGlobArray("subdir", options), []);
});
-Deno.test(async function expandGlobPermError(): Promise<void> {
+Deno.test("expandGlobPermError", async function (): Promise<void> {
const exampleUrl = new URL("testdata/expand_wildcard.js", import.meta.url);
const p = run({
cmd: [execPath(), exampleUrl.toString()],
diff --git a/std/fs/move_test.ts b/std/fs/move_test.ts
index ec899896c..fdf451125 100644
--- a/std/fs/move_test.ts
+++ b/std/fs/move_test.ts
@@ -12,7 +12,7 @@ import { exists, existsSync } from "./exists.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(async function moveDirectoryIfSrcNotExists(): Promise<void> {
+Deno.test("moveDirectoryIfSrcNotExists", async function (): Promise<void> {
const srcDir = path.join(testdataDir, "move_test_src_1");
const destDir = path.join(testdataDir, "move_test_dest_1");
// if src directory not exist
@@ -23,7 +23,7 @@ Deno.test(async function moveDirectoryIfSrcNotExists(): Promise<void> {
);
});
-Deno.test(async function moveDirectoryIfDestNotExists(): Promise<void> {
+Deno.test("moveDirectoryIfDestNotExists", async function (): Promise<void> {
const srcDir = path.join(testdataDir, "move_test_src_2");
const destDir = path.join(testdataDir, "move_test_dest_2");
@@ -42,28 +42,29 @@ Deno.test(async function moveDirectoryIfDestNotExists(): Promise<void> {
await Deno.remove(destDir);
});
-Deno.test(async function moveDirectoryIfDestNotExistsAndOverwrite(): Promise<
- void
-> {
- const srcDir = path.join(testdataDir, "move_test_src_2");
- const destDir = path.join(testdataDir, "move_test_dest_2");
-
- await Deno.mkdir(srcDir, { recursive: true });
-
- // if dest directory not exist
- await assertThrowsAsync(
- async (): Promise<void> => {
- await move(srcDir, destDir, { overwrite: true });
- throw new Error("should not throw error");
- },
- Error,
- "should not throw error"
- );
-
- await Deno.remove(destDir);
-});
-
-Deno.test(async function moveFileIfSrcNotExists(): Promise<void> {
+Deno.test(
+ "moveDirectoryIfDestNotExistsAndOverwrite",
+ async function (): Promise<void> {
+ const srcDir = path.join(testdataDir, "move_test_src_2");
+ const destDir = path.join(testdataDir, "move_test_dest_2");
+
+ await Deno.mkdir(srcDir, { recursive: true });
+
+ // if dest directory not exist
+ await assertThrowsAsync(
+ async (): Promise<void> => {
+ await move(srcDir, destDir, { overwrite: true });
+ throw new Error("should not throw error");
+ },
+ Error,
+ "should not throw error"
+ );
+
+ await Deno.remove(destDir);
+ }
+);
+
+Deno.test("moveFileIfSrcNotExists", async function (): Promise<void> {
const srcFile = path.join(testdataDir, "move_test_src_3", "test.txt");
const destFile = path.join(testdataDir, "move_test_dest_3", "test.txt");
@@ -75,7 +76,7 @@ Deno.test(async function moveFileIfSrcNotExists(): Promise<void> {
);
});
-Deno.test(async function moveFileIfDestExists(): Promise<void> {
+Deno.test("moveFileIfDestExists", async function (): Promise<void> {
const srcDir = path.join(testdataDir, "move_test_src_4");
const destDir = path.join(testdataDir, "move_test_dest_4");
const srcFile = path.join(srcDir, "test.txt");
@@ -125,7 +126,7 @@ Deno.test(async function moveFileIfDestExists(): Promise<void> {
]);
});
-Deno.test(async function moveDirectory(): Promise<void> {
+Deno.test("moveDirectory", async function (): Promise<void> {
const srcDir = path.join(testdataDir, "move_test_src_5");
const destDir = path.join(testdataDir, "move_test_dest_5");
const srcFile = path.join(srcDir, "test.txt");
@@ -150,42 +151,43 @@ Deno.test(async function moveDirectory(): Promise<void> {
await Deno.remove(destDir, { recursive: true });
});
-Deno.test(async function moveIfSrcAndDestDirectoryExistsAndOverwrite(): Promise<
- void
-> {
- const srcDir = path.join(testdataDir, "move_test_src_6");
- const destDir = path.join(testdataDir, "move_test_dest_6");
- const srcFile = path.join(srcDir, "test.txt");
- const destFile = path.join(destDir, "test.txt");
- const srcContent = new TextEncoder().encode("src");
- const destContent = new TextEncoder().encode("dest");
-
- await Promise.all([
- Deno.mkdir(srcDir, { recursive: true }),
- Deno.mkdir(destDir, { recursive: true }),
- ]);
- assertEquals(await exists(srcDir), true);
- assertEquals(await exists(destDir), true);
- await Promise.all([
- Deno.writeFile(srcFile, srcContent),
- Deno.writeFile(destFile, destContent),
- ]);
-
- await move(srcDir, destDir, { overwrite: true });
-
- assertEquals(await exists(srcDir), false);
- assertEquals(await exists(destDir), true);
- assertEquals(await exists(destFile), true);
-
- const destFileContent = new TextDecoder().decode(
- await Deno.readFile(destFile)
- );
- assertEquals(destFileContent, "src");
-
- await Deno.remove(destDir, { recursive: true });
-});
-
-Deno.test(async function moveIntoSubDir(): Promise<void> {
+Deno.test(
+ "moveIfSrcAndDestDirectoryExistsAndOverwrite",
+ async function (): Promise<void> {
+ const srcDir = path.join(testdataDir, "move_test_src_6");
+ const destDir = path.join(testdataDir, "move_test_dest_6");
+ const srcFile = path.join(srcDir, "test.txt");
+ const destFile = path.join(destDir, "test.txt");
+ const srcContent = new TextEncoder().encode("src");
+ const destContent = new TextEncoder().encode("dest");
+
+ await Promise.all([
+ Deno.mkdir(srcDir, { recursive: true }),
+ Deno.mkdir(destDir, { recursive: true }),
+ ]);
+ assertEquals(await exists(srcDir), true);
+ assertEquals(await exists(destDir), true);
+ await Promise.all([
+ Deno.writeFile(srcFile, srcContent),
+ Deno.writeFile(destFile, destContent),
+ ]);
+
+ await move(srcDir, destDir, { overwrite: true });
+
+ assertEquals(await exists(srcDir), false);
+ assertEquals(await exists(destDir), true);
+ assertEquals(await exists(destFile), true);
+
+ const destFileContent = new TextDecoder().decode(
+ await Deno.readFile(destFile)
+ );
+ assertEquals(destFileContent, "src");
+
+ await Deno.remove(destDir, { recursive: true });
+ }
+);
+
+Deno.test("moveIntoSubDir", async function (): Promise<void> {
const srcDir = path.join(testdataDir, "move_test_src_7");
const destDir = path.join(srcDir, "nest");
@@ -201,7 +203,7 @@ Deno.test(async function moveIntoSubDir(): Promise<void> {
await Deno.remove(srcDir, { recursive: true });
});
-Deno.test(function moveSyncDirectoryIfSrcNotExists(): void {
+Deno.test("moveSyncDirectoryIfSrcNotExists", function (): void {
const srcDir = path.join(testdataDir, "move_sync_test_src_1");
const destDir = path.join(testdataDir, "move_sync_test_dest_1");
// if src directory not exist
@@ -210,7 +212,7 @@ Deno.test(function moveSyncDirectoryIfSrcNotExists(): void {
});
});
-Deno.test(function moveSyncDirectoryIfDestNotExists(): void {
+Deno.test("moveSyncDirectoryIfDestNotExists", function (): void {
const srcDir = path.join(testdataDir, "move_sync_test_src_2");
const destDir = path.join(testdataDir, "move_sync_test_dest_2");
@@ -229,7 +231,7 @@ Deno.test(function moveSyncDirectoryIfDestNotExists(): void {
Deno.removeSync(destDir);
});
-Deno.test(function moveSyncDirectoryIfDestNotExistsAndOverwrite(): void {
+Deno.test("moveSyncDirectoryIfDestNotExistsAndOverwrite", function (): void {
const srcDir = path.join(testdataDir, "move_sync_test_src_2");
const destDir = path.join(testdataDir, "move_sync_test_dest_2");
@@ -248,7 +250,7 @@ Deno.test(function moveSyncDirectoryIfDestNotExistsAndOverwrite(): void {
Deno.removeSync(destDir);
});
-Deno.test(function moveSyncFileIfSrcNotExists(): void {
+Deno.test("moveSyncFileIfSrcNotExists", function (): void {
const srcFile = path.join(testdataDir, "move_sync_test_src_3", "test.txt");
const destFile = path.join(testdataDir, "move_sync_test_dest_3", "test.txt");
@@ -258,7 +260,7 @@ Deno.test(function moveSyncFileIfSrcNotExists(): void {
});
});
-Deno.test(function moveSyncFileIfDestExists(): void {
+Deno.test("moveSyncFileIfDestExists", function (): void {
const srcDir = path.join(testdataDir, "move_sync_test_src_4");
const destDir = path.join(testdataDir, "move_sync_test_dest_4");
const srcFile = path.join(srcDir, "test.txt");
@@ -305,7 +307,7 @@ Deno.test(function moveSyncFileIfDestExists(): void {
Deno.removeSync(destDir, { recursive: true });
});
-Deno.test(function moveSyncDirectory(): void {
+Deno.test("moveSyncDirectory", function (): void {
const srcDir = path.join(testdataDir, "move_sync_test_src_5");
const destDir = path.join(testdataDir, "move_sync_test_dest_5");
const srcFile = path.join(srcDir, "test.txt");
@@ -328,7 +330,7 @@ Deno.test(function moveSyncDirectory(): void {
Deno.removeSync(destDir, { recursive: true });
});
-Deno.test(function moveSyncIfSrcAndDestDirectoryExistsAndOverwrite(): void {
+Deno.test("moveSyncIfSrcAndDestDirectoryExistsAndOverwrite", function (): void {
const srcDir = path.join(testdataDir, "move_sync_test_src_6");
const destDir = path.join(testdataDir, "move_sync_test_dest_6");
const srcFile = path.join(srcDir, "test.txt");
@@ -355,7 +357,7 @@ Deno.test(function moveSyncIfSrcAndDestDirectoryExistsAndOverwrite(): void {
Deno.removeSync(destDir, { recursive: true });
});
-Deno.test(function moveSyncIntoSubDir(): void {
+Deno.test("moveSyncIntoSubDir", function (): void {
const srcDir = path.join(testdataDir, "move_sync_test_src_7");
const destDir = path.join(srcDir, "nest");
diff --git a/std/fs/read_file_str_test.ts b/std/fs/read_file_str_test.ts
index c652fe096..0671d8b92 100644
--- a/std/fs/read_file_str_test.ts
+++ b/std/fs/read_file_str_test.ts
@@ -4,14 +4,14 @@ import { readFileStrSync, readFileStr } from "./read_file_str.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(function testReadFileSync(): void {
+Deno.test("testReadFileSync", function (): void {
const jsonFile = path.join(testdataDir, "json_valid_obj.json");
const strFile = readFileStrSync(jsonFile);
assert(typeof strFile === "string");
assert(strFile.length > 0);
});
-Deno.test(async function testReadFile(): Promise<void> {
+Deno.test("testReadFile", async function (): Promise<void> {
const jsonFile = path.join(testdataDir, "json_valid_obj.json");
const strFile = await readFileStr(jsonFile);
assert(typeof strFile === "string");
diff --git a/std/fs/read_json_test.ts b/std/fs/read_json_test.ts
index bdb5edbe5..edc5d8800 100644
--- a/std/fs/read_json_test.ts
+++ b/std/fs/read_json_test.ts
@@ -9,7 +9,7 @@ import { readJson, readJsonSync } from "./read_json.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(async function readJsonFileNotExists(): Promise<void> {
+Deno.test("readJsonFileNotExists", async function (): Promise<void> {
const emptyJsonFile = path.join(testdataDir, "json_not_exists.json");
await assertThrowsAsync(
@@ -19,7 +19,7 @@ Deno.test(async function readJsonFileNotExists(): Promise<void> {
);
});
-Deno.test(async function readEmptyJsonFile(): Promise<void> {
+Deno.test("readEmptyJsonFile", async function (): Promise<void> {
const emptyJsonFile = path.join(testdataDir, "json_empty.json");
await assertThrowsAsync(
@@ -29,7 +29,7 @@ Deno.test(async function readEmptyJsonFile(): Promise<void> {
);
});
-Deno.test(async function readInvalidJsonFile(): Promise<void> {
+Deno.test("readInvalidJsonFile", async function (): Promise<void> {
const invalidJsonFile = path.join(testdataDir, "json_invalid.json");
await assertThrowsAsync(
@@ -39,7 +39,7 @@ Deno.test(async function readInvalidJsonFile(): Promise<void> {
);
});
-Deno.test(async function readValidArrayJsonFile(): Promise<void> {
+Deno.test("readValidArrayJsonFile", async function (): Promise<void> {
const invalidJsonFile = path.join(testdataDir, "json_valid_array.json");
const json = await readJson(invalidJsonFile);
@@ -47,7 +47,7 @@ Deno.test(async function readValidArrayJsonFile(): Promise<void> {
assertEquals(json, ["1", "2", "3"]);
});
-Deno.test(async function readValidObjJsonFile(): Promise<void> {
+Deno.test("readValidObjJsonFile", async function (): Promise<void> {
const invalidJsonFile = path.join(testdataDir, "json_valid_obj.json");
const json = await readJson(invalidJsonFile);
@@ -55,13 +55,15 @@ Deno.test(async function readValidObjJsonFile(): Promise<void> {
assertEquals(json, { key1: "value1", key2: "value2" });
});
-Deno.test(async function readValidObjJsonFileWithRelativePath(): Promise<void> {
+Deno.test("readValidObjJsonFileWithRelativePath", async function (): Promise<
+ void
+> {
const json = await readJson("./fs/testdata/json_valid_obj.json");
assertEquals(json, { key1: "value1", key2: "value2" });
});
-Deno.test(function readJsonFileNotExistsSync(): void {
+Deno.test("readJsonFileNotExistsSync", function (): void {
const emptyJsonFile = path.join(testdataDir, "json_not_exists.json");
assertThrows((): void => {
@@ -69,7 +71,7 @@ Deno.test(function readJsonFileNotExistsSync(): void {
});
});
-Deno.test(function readEmptyJsonFileSync(): void {
+Deno.test("readEmptyJsonFileSync", function (): void {
const emptyJsonFile = path.join(testdataDir, "json_empty.json");
assertThrows((): void => {
@@ -77,7 +79,7 @@ Deno.test(function readEmptyJsonFileSync(): void {
});
});
-Deno.test(function readInvalidJsonFile(): void {
+Deno.test("readInvalidJsonFile", function (): void {
const invalidJsonFile = path.join(testdataDir, "json_invalid.json");
assertThrows((): void => {
@@ -85,7 +87,7 @@ Deno.test(function readInvalidJsonFile(): void {
});
});
-Deno.test(function readValidArrayJsonFileSync(): void {
+Deno.test("readValidArrayJsonFileSync", function (): void {
const invalidJsonFile = path.join(testdataDir, "json_valid_array.json");
const json = readJsonSync(invalidJsonFile);
@@ -93,7 +95,7 @@ Deno.test(function readValidArrayJsonFileSync(): void {
assertEquals(json, ["1", "2", "3"]);
});
-Deno.test(function readValidObjJsonFileSync(): void {
+Deno.test("readValidObjJsonFileSync", function (): void {
const invalidJsonFile = path.join(testdataDir, "json_valid_obj.json");
const json = readJsonSync(invalidJsonFile);
@@ -101,7 +103,7 @@ Deno.test(function readValidObjJsonFileSync(): void {
assertEquals(json, { key1: "value1", key2: "value2" });
});
-Deno.test(function readValidObjJsonFileSyncWithRelativePath(): void {
+Deno.test("readValidObjJsonFileSyncWithRelativePath", function (): void {
const json = readJsonSync("./fs/testdata/json_valid_obj.json");
assertEquals(json, { key1: "value1", key2: "value2" });
diff --git a/std/fs/utils_test.ts b/std/fs/utils_test.ts
index 95686d824..e104e3e7d 100644
--- a/std/fs/utils_test.ts
+++ b/std/fs/utils_test.ts
@@ -8,7 +8,7 @@ import { ensureDirSync } from "./ensure_dir.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(function _isSubdir(): void {
+Deno.test("_isSubdir", function (): void {
const pairs = [
["", "", false, path.posix.sep],
["/first/second", "/first", false, path.posix.sep],
@@ -33,7 +33,7 @@ Deno.test(function _isSubdir(): void {
});
});
-Deno.test(function _getFileInfoType(): void {
+Deno.test("_getFileInfoType", function (): void {
const pairs = [
[path.join(testdataDir, "file_type_1"), "file"],
[path.join(testdataDir, "file_type_dir_1"), "dir"],
diff --git a/std/fs/write_file_str_test.ts b/std/fs/write_file_str_test.ts
index 279afe3d1..42119c8fb 100644
--- a/std/fs/write_file_str_test.ts
+++ b/std/fs/write_file_str_test.ts
@@ -4,7 +4,7 @@ import { writeFileStr, writeFileStrSync } from "./write_file_str.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(function testReadFileSync(): void {
+Deno.test("testReadFileSync", function (): void {
const jsonFile = path.join(testdataDir, "write_file_1.json");
const content = "write_file_str_test";
writeFileStrSync(jsonFile, content);
@@ -20,7 +20,7 @@ Deno.test(function testReadFileSync(): void {
assertEquals(content, result);
});
-Deno.test(async function testReadFile(): Promise<void> {
+Deno.test("testReadFile", async function (): Promise<void> {
const jsonFile = path.join(testdataDir, "write_file_2.json");
const content = "write_file_str_test";
await writeFileStr(jsonFile, content);
diff --git a/std/fs/write_json_test.ts b/std/fs/write_json_test.ts
index 335d35bfe..45d27c4f1 100644
--- a/std/fs/write_json_test.ts
+++ b/std/fs/write_json_test.ts
@@ -9,7 +9,7 @@ import { writeJson, writeJsonSync } from "./write_json.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test(async function writeJsonIfNotExists(): Promise<void> {
+Deno.test("writeJsonIfNotExists", async function (): Promise<void> {
const notExistsJsonFile = path.join(testdataDir, "file_not_exists.json");
await assertThrowsAsync(
@@ -28,7 +28,7 @@ Deno.test(async function writeJsonIfNotExists(): Promise<void> {
assertEquals(new TextDecoder().decode(content), `{"a":"1"}`);
});
-Deno.test(async function writeJsonIfExists(): Promise<void> {
+Deno.test("writeJsonIfExists", async function (): Promise<void> {
const existsJsonFile = path.join(testdataDir, "file_write_exists.json");
await Deno.writeFile(existsJsonFile, new Uint8Array());
@@ -49,7 +49,7 @@ Deno.test(async function writeJsonIfExists(): Promise<void> {
assertEquals(new TextDecoder().decode(content), `{"a":"1"}`);
});
-Deno.test(async function writeJsonIfExistsAnInvalidJson(): Promise<void> {
+Deno.test("writeJsonIfExistsAnInvalidJson", async function (): Promise<void> {
const existsInvalidJsonFile = path.join(
testdataDir,
"file_write_invalid.json"
@@ -74,7 +74,7 @@ Deno.test(async function writeJsonIfExistsAnInvalidJson(): Promise<void> {
assertEquals(new TextDecoder().decode(content), `{"a":"1"}`);
});
-Deno.test(async function writeJsonWithSpaces(): Promise<void> {
+Deno.test("writeJsonWithSpaces", async function (): Promise<void> {
const existsJsonFile = path.join(testdataDir, "file_write_spaces.json");
const invalidJsonContent = new TextEncoder().encode();
@@ -96,7 +96,7 @@ Deno.test(async function writeJsonWithSpaces(): Promise<void> {
assertEquals(new TextDecoder().decode(content), `{\n "a": "1"\n}`);
});
-Deno.test(async function writeJsonWithReplacer(): Promise<void> {
+Deno.test("writeJsonWithReplacer", async function (): Promise<void> {
const existsJsonFile = path.join(testdataDir, "file_write_replacer.json");
const invalidJsonContent = new TextEncoder().encode();
@@ -124,7 +124,7 @@ Deno.test(async function writeJsonWithReplacer(): Promise<void> {
assertEquals(new TextDecoder().decode(content), `{"a":"1"}`);
});
-Deno.test(function writeJsonSyncIfNotExists(): void {
+Deno.test("writeJsonSyncIfNotExists", function (): void {
const notExistsJsonFile = path.join(testdataDir, "file_not_exists_sync.json");
assertThrows(
@@ -143,7 +143,7 @@ Deno.test(function writeJsonSyncIfNotExists(): void {
assertEquals(new TextDecoder().decode(content), `{"a":"1"}`);
});
-Deno.test(function writeJsonSyncIfExists(): void {
+Deno.test("writeJsonSyncIfExists", function (): void {
const existsJsonFile = path.join(testdataDir, "file_write_exists_sync.json");
Deno.writeFileSync(existsJsonFile, new Uint8Array());
@@ -164,7 +164,7 @@ Deno.test(function writeJsonSyncIfExists(): void {
assertEquals(new TextDecoder().decode(content), `{"a":"1"}`);
});
-Deno.test(function writeJsonSyncIfExistsAnInvalidJson(): void {
+Deno.test("writeJsonSyncIfExistsAnInvalidJson", function (): void {
const existsInvalidJsonFile = path.join(
testdataDir,
"file_write_invalid_sync.json"
@@ -189,7 +189,7 @@ Deno.test(function writeJsonSyncIfExistsAnInvalidJson(): void {
assertEquals(new TextDecoder().decode(content), `{"a":"1"}`);
});
-Deno.test(function writeJsonWithSpaces(): void {
+Deno.test("writeJsonWithSpaces", function (): void {
const existsJsonFile = path.join(testdataDir, "file_write_spaces_sync.json");
const invalidJsonContent = new TextEncoder().encode();
@@ -211,7 +211,7 @@ Deno.test(function writeJsonWithSpaces(): void {
assertEquals(new TextDecoder().decode(content), `{\n "a": "1"\n}`);
});
-Deno.test(function writeJsonWithReplacer(): void {
+Deno.test("writeJsonWithReplacer", function (): void {
const existsJsonFile = path.join(
testdataDir,
"file_write_replacer_sync.json"