summaryrefslogtreecommitdiff
path: root/std/fs
diff options
context:
space:
mode:
Diffstat (limited to 'std/fs')
-rw-r--r--std/fs/_util.ts2
-rw-r--r--std/fs/_util_test.ts2
-rw-r--r--std/fs/copy.ts24
-rw-r--r--std/fs/copy_test.ts96
-rw-r--r--std/fs/empty_dir_test.ts11
-rw-r--r--std/fs/ensure_dir.ts8
-rw-r--r--std/fs/ensure_dir_test.ts8
-rw-r--r--std/fs/ensure_file.ts4
-rw-r--r--std/fs/ensure_file_test.ts8
-rw-r--r--std/fs/ensure_link.ts4
-rw-r--r--std/fs/ensure_link_test.ts22
-rw-r--r--std/fs/ensure_symlink.ts4
-rw-r--r--std/fs/ensure_symlink_test.ts4
-rw-r--r--std/fs/exists_test.ts6
-rw-r--r--std/fs/expand_glob.ts20
-rw-r--r--std/fs/expand_glob_test.ts12
-rw-r--r--std/fs/move.ts8
-rw-r--r--std/fs/move_test.ts32
-rw-r--r--std/fs/read_file_str.ts4
-rw-r--r--std/fs/read_json_test.ts6
-rw-r--r--std/fs/walk.ts6
-rw-r--r--std/fs/walk_test.ts36
-rw-r--r--std/fs/write_file_str.ts2
-rw-r--r--std/fs/write_json.ts8
-rw-r--r--std/fs/write_json_test.ts30
25 files changed, 187 insertions, 180 deletions
diff --git a/std/fs/_util.ts b/std/fs/_util.ts
index bae48c970..6866526cd 100644
--- a/std/fs/_util.ts
+++ b/std/fs/_util.ts
@@ -9,7 +9,7 @@ import * as path from "../path/mod.ts";
export function isSubdir(
src: string,
dest: string,
- sep: string = path.sep
+ sep: string = path.sep,
): boolean {
if (src === dest) {
return false;
diff --git a/std/fs/_util_test.ts b/std/fs/_util_test.ts
index 48fc33ecd..a05f2cb2d 100644
--- a/std/fs/_util_test.ts
+++ b/std/fs/_util_test.ts
@@ -28,7 +28,7 @@ Deno.test("_isSubdir", function (): void {
assertEquals(
isSubdir(src, dest, sep),
expected,
- `'${src}' should ${expected ? "" : "not"} be parent dir of '${dest}'`
+ `'${src}' should ${expected ? "" : "not"} be parent dir of '${dest}'`,
);
});
});
diff --git a/std/fs/copy.ts b/std/fs/copy.ts
index 269340e85..b1b340354 100644
--- a/std/fs/copy.ts
+++ b/std/fs/copy.ts
@@ -24,7 +24,7 @@ async function ensureValidCopy(
src: string,
dest: string,
options: CopyOptions,
- isCopyFolder = false
+ isCopyFolder = false,
): Promise<Deno.FileInfo | undefined> {
let destStat: Deno.FileInfo;
@@ -39,7 +39,7 @@ async function ensureValidCopy(
if (isCopyFolder && !destStat.isDirectory) {
throw new Error(
- `Cannot overwrite non-directory '${dest}' with directory '${src}'.`
+ `Cannot overwrite non-directory '${dest}' with directory '${src}'.`,
);
}
if (!options.overwrite) {
@@ -53,7 +53,7 @@ function ensureValidCopySync(
src: string,
dest: string,
options: CopyOptions,
- isCopyFolder = false
+ isCopyFolder = false,
): Deno.FileInfo | undefined {
let destStat: Deno.FileInfo;
try {
@@ -67,7 +67,7 @@ function ensureValidCopySync(
if (isCopyFolder && !destStat.isDirectory) {
throw new Error(
- `Cannot overwrite non-directory '${dest}' with directory '${src}'.`
+ `Cannot overwrite non-directory '${dest}' with directory '${src}'.`,
);
}
if (!options.overwrite) {
@@ -81,7 +81,7 @@ function ensureValidCopySync(
async function copyFile(
src: string,
dest: string,
- options: CopyOptions
+ options: CopyOptions,
): Promise<void> {
await ensureValidCopy(src, dest, options);
await Deno.copyFile(src, dest);
@@ -108,7 +108,7 @@ function copyFileSync(src: string, dest: string, options: CopyOptions): void {
async function copySymLink(
src: string,
dest: string,
- options: CopyOptions
+ options: CopyOptions,
): Promise<void> {
await ensureValidCopy(src, dest, options);
const originSrcFilePath = await Deno.readLink(src);
@@ -132,7 +132,7 @@ async function copySymLink(
function copySymlinkSync(
src: string,
dest: string,
- options: CopyOptions
+ options: CopyOptions,
): void {
ensureValidCopySync(src, dest, options);
const originSrcFilePath = Deno.readLinkSync(src);
@@ -157,7 +157,7 @@ function copySymlinkSync(
async function copyDir(
src: string,
dest: string,
- options: CopyOptions
+ options: CopyOptions,
): Promise<void> {
const destStat = await ensureValidCopy(src, dest, options, true);
@@ -227,7 +227,7 @@ function copyDirSync(src: string, dest: string, options: CopyOptions): void {
export async function copy(
src: string,
dest: string,
- options: CopyOptions = {}
+ options: CopyOptions = {},
): Promise<void> {
src = path.resolve(src);
dest = path.resolve(dest);
@@ -240,7 +240,7 @@ export async function copy(
if (srcStat.isDirectory && isSubdir(src, dest)) {
throw new Error(
- `Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`
+ `Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`,
);
}
@@ -266,7 +266,7 @@ export async function copy(
export function copySync(
src: string,
dest: string,
- options: CopyOptions = {}
+ options: CopyOptions = {},
): void {
src = path.resolve(src);
dest = path.resolve(dest);
@@ -279,7 +279,7 @@ export function copySync(
if (srcStat.isDirectory && isSubdir(src, dest)) {
throw new Error(
- `Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`
+ `Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`,
);
}
diff --git a/std/fs/copy_test.ts b/std/fs/copy_test.ts
index dd9b90ff6..75efd7cc0 100644
--- a/std/fs/copy_test.ts
+++ b/std/fs/copy_test.ts
@@ -17,7 +17,7 @@ const testdataDir = path.resolve("fs", "testdata");
function testCopy(
name: string,
cb: (tempDir: string) => Promise<void>,
- ignore = false
+ ignore = false,
): void {
Deno.test({
name,
@@ -34,7 +34,7 @@ function testCopy(
function testCopyIgnore(
name: string,
- cb: (tempDir: string) => Promise<void>
+ cb: (tempDir: string) => Promise<void>,
): void {
testCopy(name, cb, true);
}
@@ -60,9 +60,9 @@ testCopy(
await assertThrowsAsync(
async (): Promise<void> => {
await copy(srcFile, destFile);
- }
+ },
);
- }
+ },
);
testCopy(
@@ -75,9 +75,9 @@ testCopy(
await copy(srcFile, destFile);
},
Error,
- "Source and destination cannot be the same."
+ "Source and destination cannot be the same.",
);
- }
+ },
);
testCopy(
@@ -91,12 +91,12 @@ testCopy(
assertEquals(
await exists(srcFile),
true,
- `source should exist before copy`
+ `source should exist before copy`,
);
assertEquals(
await exists(destFile),
false,
- "destination should not exist before copy"
+ "destination should not exist before copy",
);
await copy(srcFile, destFile);
@@ -105,7 +105,7 @@ testCopy(
assertEquals(
await exists(destFile),
true,
- "destination should exist before copy"
+ "destination should exist before copy",
);
const destContent = new TextDecoder().decode(await Deno.readFile(destFile));
@@ -113,7 +113,7 @@ testCopy(
assertEquals(
srcContent,
destContent,
- "source and destination should have the same content"
+ "source and destination should have the same content",
);
// Copy again and it should throw an error.
@@ -122,7 +122,7 @@ testCopy(
await copy(srcFile, destFile);
},
Error,
- `'${destFile}' already exists.`
+ `'${destFile}' already exists.`,
);
// Modify destination file.
@@ -130,7 +130,7 @@ testCopy(
assertEquals(
new TextDecoder().decode(await Deno.readFile(destFile)),
- "txt copy"
+ "txt copy",
);
// Copy again with overwrite option.
@@ -139,9 +139,9 @@ testCopy(
// Make sure the file has been overwritten.
assertEquals(
new TextDecoder().decode(await Deno.readFile(destFile)),
- "txt"
+ "txt",
);
- }
+ },
);
// TODO(#6644) This case is ignored because of the issue #5065.
@@ -168,7 +168,7 @@ testCopyIgnore(
assert(destStatInfo.mtime instanceof Date);
assertEquals(destStatInfo.atime, srcStatInfo.atime);
assertEquals(destStatInfo.mtime, srcStatInfo.mtime);
- }
+ },
);
testCopy(
@@ -184,9 +184,9 @@ testCopy(
await copy(srcDir, destDir);
},
Error,
- `Cannot copy '${srcDir}' to a subdirectory of itself, '${destDir}'.`
+ `Cannot copy '${srcDir}' to a subdirectory of itself, '${destDir}'.`,
);
- }
+ },
);
testCopy(
@@ -203,9 +203,9 @@ testCopy(
await copy(srcDir, destDir);
},
Error,
- `Cannot overwrite non-directory '${destDir}' with directory '${srcDir}'.`
+ `Cannot overwrite non-directory '${destDir}' with directory '${srcDir}'.`,
);
- }
+ },
);
testCopy(
@@ -226,11 +226,11 @@ testCopy(
// After copy. The source and destination should have the same content.
assertEquals(
new TextDecoder().decode(await Deno.readFile(srcFile)),
- new TextDecoder().decode(await Deno.readFile(destFile))
+ new TextDecoder().decode(await Deno.readFile(destFile)),
);
assertEquals(
new TextDecoder().decode(await Deno.readFile(srcNestFile)),
- new TextDecoder().decode(await Deno.readFile(destNestFile))
+ new TextDecoder().decode(await Deno.readFile(destNestFile)),
);
// Copy again without overwrite option and it should throw an error.
@@ -239,14 +239,14 @@ testCopy(
await copy(srcDir, destDir);
},
Error,
- `'${destDir}' already exists.`
+ `'${destDir}' already exists.`,
);
// Modify the file in the destination directory.
await Deno.writeFile(destNestFile, new TextEncoder().encode("nest copy"));
assertEquals(
new TextDecoder().decode(await Deno.readFile(destNestFile)),
- "nest copy"
+ "nest copy",
);
// Copy again with overwrite option.
@@ -255,9 +255,9 @@ testCopy(
// Make sure the file has been overwritten.
assertEquals(
new TextDecoder().decode(await Deno.readFile(destNestFile)),
- "nest"
+ "nest",
);
- }
+ },
);
testCopy(
@@ -269,7 +269,7 @@ testCopy(
assert(
(await Deno.lstat(srcLink)).isSymlink,
- `'${srcLink}' should be symlink type`
+ `'${srcLink}' should be symlink type`,
);
await copy(srcLink, destLink);
@@ -277,7 +277,7 @@ testCopy(
const statInfo = await Deno.lstat(destLink);
assert(statInfo.isSymlink, `'${destLink}' should be symlink type`);
- }
+ },
);
testCopy(
@@ -291,7 +291,7 @@ testCopy(
assert(
(await Deno.lstat(srcLink)).isSymlink,
- `'${srcLink}' should be symlink type`
+ `'${srcLink}' should be symlink type`,
);
await copy(srcLink, destLink);
@@ -299,7 +299,7 @@ testCopy(
const statInfo = await Deno.lstat(destLink);
assert(statInfo.isSymlink);
- }
+ },
);
testCopySync(
@@ -310,7 +310,7 @@ testCopySync(
assertThrows((): void => {
copySync(srcFile, destFile);
});
- }
+ },
);
testCopySync(
@@ -338,7 +338,7 @@ testCopySync(
// is fixed
// assertEquals(destStatInfo.atime, srcStatInfo.atime);
// assertEquals(destStatInfo.mtime, srcStatInfo.mtime);
- }
+ },
);
testCopySync(
@@ -350,9 +350,9 @@ testCopySync(
copySync(srcFile, srcFile);
},
Error,
- "Source and destination cannot be the same."
+ "Source and destination cannot be the same.",
);
- }
+ },
);
testCopySync("[fs] copy file synchronously", (tempDir: string): void => {
@@ -379,7 +379,7 @@ testCopySync("[fs] copy file synchronously", (tempDir: string): void => {
copySync(srcFile, destFile);
},
Error,
- `'${destFile}' already exists.`
+ `'${destFile}' already exists.`,
);
// Modify destination file.
@@ -387,7 +387,7 @@ testCopySync("[fs] copy file synchronously", (tempDir: string): void => {
assertEquals(
new TextDecoder().decode(Deno.readFileSync(destFile)),
- "txt copy"
+ "txt copy",
);
// Copy again with overwrite option.
@@ -410,9 +410,9 @@ testCopySync(
copySync(srcDir, destDir);
},
Error,
- `Cannot copy '${srcDir}' to a subdirectory of itself, '${destDir}'.`
+ `Cannot copy '${srcDir}' to a subdirectory of itself, '${destDir}'.`,
);
- }
+ },
);
testCopySync(
@@ -430,9 +430,9 @@ testCopySync(
copySync(srcDir, destDir);
},
Error,
- `Cannot overwrite non-directory '${destDir}' with directory '${srcDir}'.`
+ `Cannot overwrite non-directory '${destDir}' with directory '${srcDir}'.`,
);
- }
+ },
);
testCopySync("[fs] copy directory synchronously", (tempDir: string): void => {
@@ -451,11 +451,11 @@ testCopySync("[fs] copy directory synchronously", (tempDir: string): void => {
// After copy. The source and destination should have the same content.
assertEquals(
new TextDecoder().decode(Deno.readFileSync(srcFile)),
- new TextDecoder().decode(Deno.readFileSync(destFile))
+ new TextDecoder().decode(Deno.readFileSync(destFile)),
);
assertEquals(
new TextDecoder().decode(Deno.readFileSync(srcNestFile)),
- new TextDecoder().decode(Deno.readFileSync(destNestFile))
+ new TextDecoder().decode(Deno.readFileSync(destNestFile)),
);
// Copy again without overwrite option and it should throw an error.
@@ -464,14 +464,14 @@ testCopySync("[fs] copy directory synchronously", (tempDir: string): void => {
copySync(srcDir, destDir);
},
Error,
- `'${destDir}' already exists.`
+ `'${destDir}' already exists.`,
);
// Modify the file in the destination directory.
Deno.writeFileSync(destNestFile, new TextEncoder().encode("nest copy"));
assertEquals(
new TextDecoder().decode(Deno.readFileSync(destNestFile)),
- "nest copy"
+ "nest copy",
);
// Copy again with overwrite option.
@@ -480,7 +480,7 @@ testCopySync("[fs] copy directory synchronously", (tempDir: string): void => {
// Make sure the file has been overwritten.
assertEquals(
new TextDecoder().decode(Deno.readFileSync(destNestFile)),
- "nest"
+ "nest",
);
});
@@ -493,7 +493,7 @@ testCopySync(
assert(
Deno.lstatSync(srcLink).isSymlink,
- `'${srcLink}' should be symlink type`
+ `'${srcLink}' should be symlink type`,
);
copySync(srcLink, destLink);
@@ -501,7 +501,7 @@ testCopySync(
const statInfo = Deno.lstatSync(destLink);
assert(statInfo.isSymlink, `'${destLink}' should be symlink type`);
- }
+ },
);
testCopySync(
@@ -515,7 +515,7 @@ testCopySync(
assert(
Deno.lstatSync(srcLink).isSymlink,
- `'${srcLink}' should be symlink type`
+ `'${srcLink}' should be symlink type`,
);
copySync(srcLink, destLink);
@@ -523,5 +523,5 @@ testCopySync(
const statInfo = Deno.lstatSync(destLink);
assert(statInfo.isSymlink);
- }
+ },
);
diff --git a/std/fs/empty_dir_test.ts b/std/fs/empty_dir_test.ts
index e0e4c58fa..6c06c9d52 100644
--- a/std/fs/empty_dir_test.ts
+++ b/std/fs/empty_dir_test.ts
@@ -71,14 +71,14 @@ Deno.test("emptyDirIfItExist", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await Deno.stat(testNestDir);
- }
+ },
);
// test file have been removed
await assertThrowsAsync(
async (): Promise<void> => {
await Deno.stat(testDirFile);
- }
+ },
);
} finally {
// remote test dir
@@ -199,7 +199,7 @@ for (const s of scenes) {
await Deno.writeFile(
path.join(testfolder, "child.txt"),
- new TextEncoder().encode("hello world")
+ new TextEncoder().encode("hello world"),
);
try {
@@ -215,7 +215,10 @@ for (const s of scenes) {
}
args.push(
- path.join(testdataDir, s.async ? "empty_dir.ts" : "empty_dir_sync.ts")
+ path.join(
+ testdataDir,
+ s.async ? "empty_dir.ts" : "empty_dir_sync.ts",
+ ),
);
args.push("testfolder");
diff --git a/std/fs/ensure_dir.ts b/std/fs/ensure_dir.ts
index 961476028..f5b5cd309 100644
--- a/std/fs/ensure_dir.ts
+++ b/std/fs/ensure_dir.ts
@@ -11,7 +11,9 @@ export async function ensureDir(dir: string): Promise<void> {
const fileInfo = await Deno.lstat(dir);
if (!fileInfo.isDirectory) {
throw new Error(
- `Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`
+ `Ensure path exists, expected 'dir', got '${
+ getFileInfoType(fileInfo)
+ }'`,
);
}
} catch (err) {
@@ -34,7 +36,9 @@ export function ensureDirSync(dir: string): void {
const fileInfo = Deno.lstatSync(dir);
if (!fileInfo.isDirectory) {
throw new Error(
- `Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`
+ `Ensure path exists, expected 'dir', got '${
+ getFileInfoType(fileInfo)
+ }'`,
);
}
} catch (err) {
diff --git a/std/fs/ensure_dir_test.ts b/std/fs/ensure_dir_test.ts
index d70f5eb1a..c24e14d1a 100644
--- a/std/fs/ensure_dir_test.ts
+++ b/std/fs/ensure_dir_test.ts
@@ -17,7 +17,7 @@ Deno.test("ensureDirIfItNotExist", async function (): Promise<void> {
await Deno.stat(testDir).then((): void => {
throw new Error("test dir should exists.");
});
- }
+ },
);
await Deno.remove(baseDir, { recursive: true });
@@ -48,7 +48,7 @@ Deno.test("ensureDirIfItExist", async function (): Promise<void> {
await Deno.stat(testDir).then((): void => {
throw new Error("test dir should still exists.");
});
- }
+ },
);
await Deno.remove(baseDir, { recursive: true });
@@ -82,7 +82,7 @@ Deno.test("ensureDirIfItAsFile", async function (): Promise<void> {
await ensureDir(testFile);
},
Error,
- `Ensure path exists, expected 'dir', got 'file'`
+ `Ensure path exists, expected 'dir', got 'file'`,
);
await Deno.remove(baseDir, { recursive: true });
@@ -99,7 +99,7 @@ Deno.test("ensureDirSyncIfItAsFile", function (): void {
ensureDirSync(testFile);
},
Error,
- `Ensure path exists, expected 'dir', got 'file'`
+ `Ensure path exists, expected 'dir', got 'file'`,
);
Deno.removeSync(baseDir, { recursive: true });
diff --git a/std/fs/ensure_file.ts b/std/fs/ensure_file.ts
index b36379b3d..41565795c 100644
--- a/std/fs/ensure_file.ts
+++ b/std/fs/ensure_file.ts
@@ -17,7 +17,7 @@ export async function ensureFile(filePath: string): Promise<void> {
const stat = await Deno.lstat(filePath);
if (!stat.isFile) {
throw new Error(
- `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`
+ `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`,
);
}
} catch (err) {
@@ -48,7 +48,7 @@ export function ensureFileSync(filePath: string): void {
const stat = Deno.lstatSync(filePath);
if (!stat.isFile) {
throw new Error(
- `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`
+ `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`,
);
}
} catch (err) {
diff --git a/std/fs/ensure_file_test.ts b/std/fs/ensure_file_test.ts
index 1e51db451..d87de0051 100644
--- a/std/fs/ensure_file_test.ts
+++ b/std/fs/ensure_file_test.ts
@@ -16,7 +16,7 @@ Deno.test("ensureFileIfItNotExist", async function (): Promise<void> {
await Deno.stat(testFile).then((): void => {
throw new Error("test file should exists.");
});
- }
+ },
);
await Deno.remove(testDir, { recursive: true });
@@ -50,7 +50,7 @@ Deno.test("ensureFileIfItExist", async function (): Promise<void> {
await Deno.stat(testFile).then((): void => {
throw new Error("test file should exists.");
});
- }
+ },
);
await Deno.remove(testDir, { recursive: true });
@@ -83,7 +83,7 @@ Deno.test("ensureFileIfItExistAsDir", async function (): Promise<void> {
await ensureFile(testDir);
},
Error,
- `Ensure path exists, expected 'file', got 'dir'`
+ `Ensure path exists, expected 'file', got 'dir'`,
);
await Deno.remove(testDir, { recursive: true });
@@ -99,7 +99,7 @@ Deno.test("ensureFileSyncIfItExistAsDir", function (): void {
ensureFileSync(testDir);
},
Error,
- `Ensure path exists, expected 'file', got 'dir'`
+ `Ensure path exists, expected 'file', got 'dir'`,
);
Deno.removeSync(testDir, { recursive: true });
diff --git a/std/fs/ensure_link.ts b/std/fs/ensure_link.ts
index f446df781..ea8501b03 100644
--- a/std/fs/ensure_link.ts
+++ b/std/fs/ensure_link.ts
@@ -17,7 +17,7 @@ export async function ensureLink(src: string, dest: string): Promise<void> {
const destFilePathType = getFileInfoType(destStatInfo);
if (destFilePathType !== "file") {
throw new Error(
- `Ensure path exists, expected 'file', got '${destFilePathType}'`
+ `Ensure path exists, expected 'file', got '${destFilePathType}'`,
);
}
return;
@@ -41,7 +41,7 @@ export function ensureLinkSync(src: string, dest: string): void {
const destFilePathType = getFileInfoType(destStatInfo);
if (destFilePathType !== "file") {
throw new Error(
- `Ensure path exists, expected 'file', got '${destFilePathType}'`
+ `Ensure path exists, expected 'file', got '${destFilePathType}'`,
);
}
return;
diff --git a/std/fs/ensure_link_test.ts b/std/fs/ensure_link_test.ts
index e05d3a648..d4f2f30c2 100644
--- a/std/fs/ensure_link_test.ts
+++ b/std/fs/ensure_link_test.ts
@@ -19,7 +19,7 @@ Deno.test("ensureLinkIfItNotExist", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await ensureLink(testFile, linkFile);
- }
+ },
);
await Deno.remove(destDir, { recursive: true });
@@ -59,10 +59,10 @@ Deno.test("ensureLinkIfItExist", async function (): Promise<void> {
await Deno.writeFile(testFile, new TextEncoder().encode("123"));
const testFileContent1 = new TextDecoder().decode(
- await Deno.readFile(testFile)
+ await Deno.readFile(testFile),
);
const linkFileContent1 = new TextDecoder().decode(
- await Deno.readFile(testFile)
+ await Deno.readFile(testFile),
);
assertEquals(testFileContent1, "123");
@@ -72,10 +72,10 @@ Deno.test("ensureLinkIfItExist", async function (): Promise<void> {
await Deno.writeFile(testFile, new TextEncoder().encode("abc"));
const testFileContent2 = new TextDecoder().decode(
- await Deno.readFile(testFile)
+ await Deno.readFile(testFile),
);
const linkFileContent2 = new TextDecoder().decode(
- await Deno.readFile(testFile)
+ await Deno.readFile(testFile),
);
assertEquals(testFileContent2, "abc");
@@ -107,10 +107,10 @@ Deno.test("ensureLinkSyncIfItExist", function (): void {
Deno.writeFileSync(testFile, new TextEncoder().encode("123"));
const testFileContent1 = new TextDecoder().decode(
- Deno.readFileSync(testFile)
+ Deno.readFileSync(testFile),
);
const linkFileContent1 = new TextDecoder().decode(
- Deno.readFileSync(testFile)
+ Deno.readFileSync(testFile),
);
assertEquals(testFileContent1, "123");
@@ -120,10 +120,10 @@ Deno.test("ensureLinkSyncIfItExist", function (): void {
Deno.writeFileSync(testFile, new TextEncoder().encode("abc"));
const testFileContent2 = new TextDecoder().decode(
- Deno.readFileSync(testFile)
+ Deno.readFileSync(testFile),
);
const linkFileContent2 = new TextDecoder().decode(
- Deno.readFileSync(testFile)
+ Deno.readFileSync(testFile),
);
assertEquals(testFileContent2, "abc");
@@ -143,7 +143,7 @@ Deno.test("ensureLinkDirectoryIfItExist", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await ensureLink(testDir, linkDir);
- }
+ },
// "Operation not permitted (os error 1)" // throw an local matching test
// "Access is denied. (os error 5)" // throw in CI
);
@@ -162,7 +162,7 @@ Deno.test("ensureLinkSyncDirectoryIfItExist", function (): void {
assertThrows(
(): void => {
ensureLinkSync(testDir, linkDir);
- }
+ },
// "Operation not permitted (os error 1)" // throw an local matching test
// "Access is denied. (os error 5)" // throw in CI
);
diff --git a/std/fs/ensure_symlink.ts b/std/fs/ensure_symlink.ts
index be96d5b13..03a8db930 100644
--- a/std/fs/ensure_symlink.ts
+++ b/std/fs/ensure_symlink.ts
@@ -20,7 +20,7 @@ export async function ensureSymlink(src: string, dest: string): Promise<void> {
const destFilePathType = getFileInfoType(destStatInfo);
if (destFilePathType !== "symlink") {
throw new Error(
- `Ensure path exists, expected 'symlink', got '${destFilePathType}'`
+ `Ensure path exists, expected 'symlink', got '${destFilePathType}'`,
);
}
return;
@@ -53,7 +53,7 @@ export function ensureSymlinkSync(src: string, dest: string): void {
const destFilePathType = getFileInfoType(destStatInfo);
if (destFilePathType !== "symlink") {
throw new Error(
- `Ensure path exists, expected 'symlink', got '${destFilePathType}'`
+ `Ensure path exists, expected 'symlink', got '${destFilePathType}'`,
);
}
return;
diff --git a/std/fs/ensure_symlink_test.ts b/std/fs/ensure_symlink_test.ts
index d90495cbf..bc0741fed 100644
--- a/std/fs/ensure_symlink_test.ts
+++ b/std/fs/ensure_symlink_test.ts
@@ -17,7 +17,7 @@ Deno.test("ensureSymlinkIfItNotExist", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await ensureSymlink(testFile, path.join(testDir, "test1.txt"));
- }
+ },
);
await assertThrowsAsync(
@@ -25,7 +25,7 @@ Deno.test("ensureSymlinkIfItNotExist", async function (): Promise<void> {
await Deno.stat(testFile).then((): void => {
throw new Error("test file should exists.");
});
- }
+ },
);
});
diff --git a/std/fs/exists_test.ts b/std/fs/exists_test.ts
index 8b584d861..3c280f4c4 100644
--- a/std/fs/exists_test.ts
+++ b/std/fs/exists_test.ts
@@ -8,7 +8,7 @@ const testdataDir = path.resolve("fs", "testdata");
Deno.test("[fs] existsFile", async function (): Promise<void> {
assertEquals(
await exists(path.join(testdataDir, "not_exist_file.ts")),
- false
+ false,
);
assertEquals(await existsSync(path.join(testdataDir, "0.ts")), true);
});
@@ -21,7 +21,7 @@ Deno.test("[fs] existsFileSync", function (): void {
Deno.test("[fs] existsDirectory", async function (): Promise<void> {
assertEquals(
await exists(path.join(testdataDir, "not_exist_directory")),
- false
+ false,
);
assertEquals(existsSync(testdataDir), true);
});
@@ -29,7 +29,7 @@ Deno.test("[fs] existsDirectory", async function (): Promise<void> {
Deno.test("[fs] existsDirectorySync", function (): void {
assertEquals(
existsSync(path.join(testdataDir, "not_exist_directory")),
- false
+ false,
);
assertEquals(existsSync(testdataDir), true);
});
diff --git a/std/fs/expand_glob.ts b/std/fs/expand_glob.ts
index 8a4b0ed03..6d1f883b5 100644
--- a/std/fs/expand_glob.ts
+++ b/std/fs/expand_glob.ts
@@ -77,7 +77,7 @@ export async function* expandGlob(
includeDirs = true,
extended = false,
globstar = false,
- }: ExpandGlobOptions = {}
+ }: ExpandGlobOptions = {},
): AsyncIterableIterator<WalkEntry> {
const globOptions: GlobOptions = { extended, globstar };
const absRoot = isAbsolute(root)
@@ -110,7 +110,7 @@ export async function* expandGlob(
async function* advanceMatch(
walkInfo: WalkEntry,
- globSegment: string
+ globSegment: string,
): AsyncIterableIterator<WalkEntry> {
if (!walkInfo.isDirectory) {
return;
@@ -135,7 +135,7 @@ export async function* expandGlob(
match: [
globToRegExp(
joinGlobs([walkInfo.path, globSegment], globOptions),
- globOptions
+ globOptions,
),
],
skip: excludePatterns,
@@ -156,12 +156,12 @@ export async function* expandGlob(
}
if (hasTrailingSep) {
currentMatches = currentMatches.filter(
- (entry: WalkEntry): boolean => entry.isDirectory
+ (entry: WalkEntry): boolean => entry.isDirectory,
);
}
if (!includeDirs) {
currentMatches = currentMatches.filter(
- (entry: WalkEntry): boolean => !entry.isDirectory
+ (entry: WalkEntry): boolean => !entry.isDirectory,
);
}
yield* currentMatches;
@@ -184,7 +184,7 @@ export function* expandGlobSync(
includeDirs = true,
extended = false,
globstar = false,
- }: ExpandGlobOptions = {}
+ }: ExpandGlobOptions = {},
): IterableIterator<WalkEntry> {
const globOptions: GlobOptions = { extended, globstar };
const absRoot = isAbsolute(root)
@@ -217,7 +217,7 @@ export function* expandGlobSync(
function* advanceMatch(
walkInfo: WalkEntry,
- globSegment: string
+ globSegment: string,
): IterableIterator<WalkEntry> {
if (!walkInfo.isDirectory) {
return;
@@ -242,7 +242,7 @@ export function* expandGlobSync(
match: [
globToRegExp(
joinGlobs([walkInfo.path, globSegment], globOptions),
- globOptions
+ globOptions,
),
],
skip: excludePatterns,
@@ -263,12 +263,12 @@ export function* expandGlobSync(
}
if (hasTrailingSep) {
currentMatches = currentMatches.filter(
- (entry: WalkEntry): boolean => entry.isDirectory
+ (entry: WalkEntry): boolean => entry.isDirectory,
);
}
if (!includeDirs) {
currentMatches = currentMatches.filter(
- (entry: WalkEntry): boolean => !entry.isDirectory
+ (entry: WalkEntry): boolean => !entry.isDirectory,
);
}
yield* currentMatches;
diff --git a/std/fs/expand_glob_test.ts b/std/fs/expand_glob_test.ts
index 1eec4df42..8b4a90754 100644
--- a/std/fs/expand_glob_test.ts
+++ b/std/fs/expand_glob_test.ts
@@ -19,7 +19,7 @@ import {
async function expandGlobArray(
globString: string,
- options: ExpandGlobOptions
+ options: ExpandGlobOptions,
): Promise<string[]> {
const paths: string[] = [];
for await (const { path } of expandGlob(globString, options)) {
@@ -27,7 +27,7 @@ async function expandGlobArray(
}
paths.sort();
const pathsSync = [...expandGlobSync(globString, options)].map(
- ({ path }): string => path
+ ({ path }): string => path,
);
pathsSync.sort();
assertEquals(paths, pathsSync);
@@ -36,7 +36,7 @@ async function expandGlobArray(
assert(path.startsWith(root));
}
const relativePaths = paths.map(
- (path: string): string => relative(root, path) || "."
+ (path: string): string => relative(root, path) || ".",
);
relativePaths.sort();
return relativePaths;
@@ -98,7 +98,7 @@ Deno.test("expandGlobGlobstar", async function (): Promise<void> {
const options = { ...EG_OPTIONS, globstar: true };
assertEquals(
await expandGlobArray(joinGlobs(["**", "abc"], options), options),
- ["abc", join("subdir", "abc")]
+ ["abc", join("subdir", "abc")],
);
});
@@ -106,7 +106,7 @@ Deno.test("expandGlobGlobstarParent", async function (): Promise<void> {
const options = { ...EG_OPTIONS, globstar: true };
assertEquals(
await expandGlobArray(joinGlobs(["subdir", "**", ".."], options), options),
- ["."]
+ ["."],
);
});
@@ -127,7 +127,7 @@ Deno.test("expandGlobPermError", async function (): Promise<void> {
assertEquals(decode(await p.output()), "");
assertStringContains(
decode(await p.stderrOutput()),
- "Uncaught PermissionDenied"
+ "Uncaught PermissionDenied",
);
p.close();
});
diff --git a/std/fs/move.ts b/std/fs/move.ts
index 6aeca29ea..421ca0771 100644
--- a/std/fs/move.ts
+++ b/std/fs/move.ts
@@ -10,13 +10,13 @@ interface MoveOptions {
export async function move(
src: string,
dest: string,
- { overwrite = false }: MoveOptions = {}
+ { overwrite = false }: MoveOptions = {},
): Promise<void> {
const srcStat = await Deno.stat(src);
if (srcStat.isDirectory && isSubdir(src, dest)) {
throw new Error(
- `Cannot move '${src}' to a subdirectory of itself, '${dest}'.`
+ `Cannot move '${src}' to a subdirectory of itself, '${dest}'.`,
);
}
@@ -39,13 +39,13 @@ export async function move(
export function moveSync(
src: string,
dest: string,
- { overwrite = false }: MoveOptions = {}
+ { overwrite = false }: MoveOptions = {},
): void {
const srcStat = Deno.statSync(src);
if (srcStat.isDirectory && isSubdir(src, dest)) {
throw new Error(
- `Cannot move '${src}' to a subdirectory of itself, '${dest}'.`
+ `Cannot move '${src}' to a subdirectory of itself, '${dest}'.`,
);
}
diff --git a/std/fs/move_test.ts b/std/fs/move_test.ts
index fdf451125..73a96ce46 100644
--- a/std/fs/move_test.ts
+++ b/std/fs/move_test.ts
@@ -19,7 +19,7 @@ Deno.test("moveDirectoryIfSrcNotExists", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await move(srcDir, destDir);
- }
+ },
);
});
@@ -36,7 +36,7 @@ Deno.test("moveDirectoryIfDestNotExists", async function (): Promise<void> {
throw new Error("should not throw error");
},
Error,
- "should not throw error"
+ "should not throw error",
);
await Deno.remove(destDir);
@@ -57,11 +57,11 @@ Deno.test(
throw new Error("should not throw error");
},
Error,
- "should not throw error"
+ "should not throw error",
);
await Deno.remove(destDir);
- }
+ },
);
Deno.test("moveFileIfSrcNotExists", async function (): Promise<void> {
@@ -72,7 +72,7 @@ Deno.test("moveFileIfSrcNotExists", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await move(srcFile, destFile);
- }
+ },
);
});
@@ -103,7 +103,7 @@ Deno.test("moveFileIfDestExists", async function (): Promise<void> {
await move(srcFile, destFile);
},
Error,
- "dest already exists"
+ "dest already exists",
);
// move again with overwrite
@@ -113,7 +113,7 @@ Deno.test("moveFileIfDestExists", async function (): Promise<void> {
throw new Error("should not throw error");
},
Error,
- "should not throw error"
+ "should not throw error",
);
assertEquals(await exists(srcFile), false);
@@ -144,7 +144,7 @@ Deno.test("moveDirectory", async function (): Promise<void> {
assertEquals(await exists(destFile), true);
const destFileContent = new TextDecoder().decode(
- await Deno.readFile(destFile)
+ await Deno.readFile(destFile),
);
assertEquals(destFileContent, "src");
@@ -179,12 +179,12 @@ Deno.test(
assertEquals(await exists(destFile), true);
const destFileContent = new TextDecoder().decode(
- await Deno.readFile(destFile)
+ await Deno.readFile(destFile),
);
assertEquals(destFileContent, "src");
await Deno.remove(destDir, { recursive: true });
- }
+ },
);
Deno.test("moveIntoSubDir", async function (): Promise<void> {
@@ -198,7 +198,7 @@ Deno.test("moveIntoSubDir", async function (): Promise<void> {
await move(srcDir, destDir);
},
Error,
- `Cannot move '${srcDir}' to a subdirectory of itself, '${destDir}'.`
+ `Cannot move '${srcDir}' to a subdirectory of itself, '${destDir}'.`,
);
await Deno.remove(srcDir, { recursive: true });
});
@@ -225,7 +225,7 @@ Deno.test("moveSyncDirectoryIfDestNotExists", function (): void {
throw new Error("should not throw error");
},
Error,
- "should not throw error"
+ "should not throw error",
);
Deno.removeSync(destDir);
@@ -244,7 +244,7 @@ Deno.test("moveSyncDirectoryIfDestNotExistsAndOverwrite", function (): void {
throw new Error("should not throw error");
},
Error,
- "should not throw error"
+ "should not throw error",
);
Deno.removeSync(destDir);
@@ -286,7 +286,7 @@ Deno.test("moveSyncFileIfDestExists", function (): void {
moveSync(srcFile, destFile);
},
Error,
- "dest already exists"
+ "dest already exists",
);
// move again with overwrite
@@ -296,7 +296,7 @@ Deno.test("moveSyncFileIfDestExists", function (): void {
throw new Error("should not throw error");
},
Error,
- "should not throw error"
+ "should not throw error",
);
assertEquals(existsSync(srcFile), false);
@@ -368,7 +368,7 @@ Deno.test("moveSyncIntoSubDir", function (): void {
moveSync(srcDir, destDir);
},
Error,
- `Cannot move '${srcDir}' to a subdirectory of itself, '${destDir}'.`
+ `Cannot move '${srcDir}' to a subdirectory of itself, '${destDir}'.`,
);
Deno.removeSync(srcDir, { recursive: true });
});
diff --git a/std/fs/read_file_str.ts b/std/fs/read_file_str.ts
index 7420183e2..9aa50f15a 100644
--- a/std/fs/read_file_str.ts
+++ b/std/fs/read_file_str.ts
@@ -12,7 +12,7 @@ export interface ReadOptions {
*/
export function readFileStrSync(
filename: string,
- opts: ReadOptions = {}
+ opts: ReadOptions = {},
): string {
const decoder = new TextDecoder(opts.encoding);
return decoder.decode(Deno.readFileSync(filename));
@@ -26,7 +26,7 @@ export function readFileStrSync(
*/
export async function readFileStr(
filename: string,
- opts: ReadOptions = {}
+ opts: ReadOptions = {},
): Promise<string> {
const decoder = new TextDecoder(opts.encoding);
return decoder.decode(await Deno.readFile(filename));
diff --git a/std/fs/read_json_test.ts b/std/fs/read_json_test.ts
index edc5d8800..c910c6334 100644
--- a/std/fs/read_json_test.ts
+++ b/std/fs/read_json_test.ts
@@ -15,7 +15,7 @@ Deno.test("readJsonFileNotExists", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await readJson(emptyJsonFile);
- }
+ },
);
});
@@ -25,7 +25,7 @@ Deno.test("readEmptyJsonFile", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await readJson(emptyJsonFile);
- }
+ },
);
});
@@ -35,7 +35,7 @@ Deno.test("readInvalidJsonFile", async function (): Promise<void> {
await assertThrowsAsync(
async (): Promise<void> => {
await readJson(invalidJsonFile);
- }
+ },
);
});
diff --git a/std/fs/walk.ts b/std/fs/walk.ts
index 0292b77ef..8f2196833 100644
--- a/std/fs/walk.ts
+++ b/std/fs/walk.ts
@@ -44,7 +44,7 @@ function include(
path: string,
exts?: string[],
match?: RegExp[],
- skip?: RegExp[]
+ skip?: RegExp[],
): boolean {
if (exts && !exts.some((ext): boolean => path.endsWith(ext))) {
return false;
@@ -91,7 +91,7 @@ export async function* walk(
exts = undefined,
match = undefined,
skip = undefined,
- }: WalkOptions = {}
+ }: WalkOptions = {},
): AsyncIterableIterator<WalkEntry> {
if (maxDepth < 0) {
return;
@@ -144,7 +144,7 @@ export function* walkSync(
exts = undefined,
match = undefined,
skip = undefined,
- }: WalkOptions = {}
+ }: WalkOptions = {},
): IterableIterator<WalkEntry> {
if (maxDepth < 0) {
return;
diff --git a/std/fs/walk_test.ts b/std/fs/walk_test.ts
index 52fd4ff57..df4525b95 100644
--- a/std/fs/walk_test.ts
+++ b/std/fs/walk_test.ts
@@ -4,7 +4,7 @@ import { assert, assertEquals, assertThrowsAsync } from "../testing/asserts.ts";
export function testWalk(
setup: (arg0: string) => void | Promise<void>,
t: () => void | Promise<void>,
- ignore = false
+ ignore = false,
): void {
const name = t.name;
async function fn(): Promise<void> {
@@ -28,7 +28,7 @@ function normalize({ path }: WalkEntry): string {
export async function walkArray(
root: string,
- options: WalkOptions = {}
+ options: WalkOptions = {},
): Promise<string[]> {
const arr: string[] = [];
for await (const w of walk(root, { ...options })) {
@@ -59,7 +59,7 @@ testWalk(
async function emptyDir(): Promise<void> {
const arr = await walkArray(".");
assertEquals(arr, [".", "empty"]);
- }
+ },
);
testWalk(
@@ -69,7 +69,7 @@ testWalk(
async function singleFile(): Promise<void> {
const arr = await walkArray(".");
assertEquals(arr, [".", "x"]);
- }
+ },
);
testWalk(
@@ -86,7 +86,7 @@ testWalk(
count += 1;
}
assertEquals(count, 4);
- }
+ },
);
testWalk(
@@ -97,7 +97,7 @@ testWalk(
async function nestedSingleFile(): Promise<void> {
const arr = await walkArray(".");
assertEquals(arr, [".", "a", "a/x"]);
- }
+ },
);
testWalk(
@@ -111,7 +111,7 @@ testWalk(
assertEquals(arr3, [".", "a", "a/b", "a/b/c"]);
const arr5 = await walkArray(".", { maxDepth: 5 });
assertEquals(arr5, [".", "a", "a/b", "a/b/c", "a/b/c/d", "a/b/c/d/x"]);
- }
+ },
);
testWalk(
@@ -124,7 +124,7 @@ testWalk(
assertReady(4);
const arr = await walkArray(".", { includeDirs: false });
assertEquals(arr, ["a", "b/c"]);
- }
+ },
);
testWalk(
@@ -137,7 +137,7 @@ testWalk(
assertReady(4);
const arr = await walkArray(".", { includeFiles: false });
assertEquals(arr, [".", "b"]);
- }
+ },
);
testWalk(
@@ -149,7 +149,7 @@ testWalk(
assertReady(3);
const arr = await walkArray(".", { exts: [".ts"] });
assertEquals(arr, ["x.ts"]);
- }
+ },
);
testWalk(
@@ -162,7 +162,7 @@ testWalk(
assertReady(4);
const arr = await walkArray(".", { exts: [".rs", ".ts"] });
assertEquals(arr, ["x.ts", "y.rs"]);
- }
+ },
);
testWalk(
@@ -174,7 +174,7 @@ testWalk(
assertReady(3);
const arr = await walkArray(".", { match: [/x/] });
assertEquals(arr, ["x"]);
- }
+ },
);
testWalk(
@@ -187,7 +187,7 @@ testWalk(
assertReady(4);
const arr = await walkArray(".", { match: [/x/, /y/] });
assertEquals(arr, ["x", "y"]);
- }
+ },
);
testWalk(
@@ -199,7 +199,7 @@ testWalk(
assertReady(3);
const arr = await walkArray(".", { skip: [/x/] });
assertEquals(arr, [".", "y"]);
- }
+ },
);
testWalk(
@@ -212,7 +212,7 @@ testWalk(
assertReady(4);
const arr = await walkArray(".", { skip: [/x/, /y/] });
assertEquals(arr, [".", "z"]);
- }
+ },
);
testWalk(
@@ -227,7 +227,7 @@ testWalk(
assertReady(6);
const arr = await walkArray("b");
assertEquals(arr, ["b", "b/z"]);
- }
+ },
);
testWalk(
@@ -236,7 +236,7 @@ testWalk(
await assertThrowsAsync(async () => {
await walkArray("nonexistent");
}, Deno.errors.NotFound);
- }
+ },
);
testWalk(
@@ -258,5 +258,5 @@ testWalk(
assertEquals(arr.length, 3);
assert(arr.some((f): boolean => f.endsWith("/b/z")));
},
- true
+ true,
);
diff --git a/std/fs/write_file_str.ts b/std/fs/write_file_str.ts
index 670399dcc..bf972f204 100644
--- a/std/fs/write_file_str.ts
+++ b/std/fs/write_file_str.ts
@@ -21,7 +21,7 @@ export function writeFileStrSync(filename: string, content: string): void {
*/
export async function writeFileStr(
filename: string,
- content: string
+ content: string,
): Promise<void> {
const encoder = new TextEncoder();
await Deno.writeFile(filename, encoder.encode(content));
diff --git a/std/fs/write_json.ts b/std/fs/write_json.ts
index 28eb80d44..015957bba 100644
--- a/std/fs/write_json.ts
+++ b/std/fs/write_json.ts
@@ -12,7 +12,7 @@ export async function writeJson(
filePath: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
object: any,
- options: WriteJsonOptions = {}
+ options: WriteJsonOptions = {},
): Promise<void> {
let contentRaw = "";
@@ -20,7 +20,7 @@ export async function writeJson(
contentRaw = JSON.stringify(
object,
options.replacer as string[],
- options.spaces
+ options.spaces,
);
} catch (err) {
err.message = `${filePath}: ${err.message}`;
@@ -35,7 +35,7 @@ export function writeJsonSync(
filePath: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
object: any,
- options: WriteJsonOptions = {}
+ options: WriteJsonOptions = {},
): void {
let contentRaw = "";
@@ -43,7 +43,7 @@ export function writeJsonSync(
contentRaw = JSON.stringify(
object,
options.replacer as string[],
- options.spaces
+ options.spaces,
);
} catch (err) {
err.message = `${filePath}: ${err.message}`;
diff --git a/std/fs/write_json_test.ts b/std/fs/write_json_test.ts
index 45d27c4f1..c22bd7bf1 100644
--- a/std/fs/write_json_test.ts
+++ b/std/fs/write_json_test.ts
@@ -18,7 +18,7 @@ Deno.test("writeJsonIfNotExists", async function (): Promise<void> {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = await Deno.readFile(notExistsJsonFile);
@@ -39,7 +39,7 @@ Deno.test("writeJsonIfExists", async function (): Promise<void> {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = await Deno.readFile(existsJsonFile);
@@ -52,7 +52,7 @@ Deno.test("writeJsonIfExists", async function (): Promise<void> {
Deno.test("writeJsonIfExistsAnInvalidJson", async function (): Promise<void> {
const existsInvalidJsonFile = path.join(
testdataDir,
- "file_write_invalid.json"
+ "file_write_invalid.json",
);
const invalidJsonContent = new TextEncoder().encode("[123}");
@@ -64,7 +64,7 @@ Deno.test("writeJsonIfExistsAnInvalidJson", async function (): Promise<void> {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = await Deno.readFile(existsInvalidJsonFile);
@@ -86,7 +86,7 @@ Deno.test("writeJsonWithSpaces", async function (): Promise<void> {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = await Deno.readFile(existsJsonFile);
@@ -109,12 +109,12 @@ Deno.test("writeJsonWithReplacer", async function (): Promise<void> {
{ a: "1", b: "2", c: "3" },
{
replacer: ["a"],
- }
+ },
);
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = await Deno.readFile(existsJsonFile);
@@ -133,7 +133,7 @@ Deno.test("writeJsonSyncIfNotExists", function (): void {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = Deno.readFileSync(notExistsJsonFile);
@@ -154,7 +154,7 @@ Deno.test("writeJsonSyncIfExists", function (): void {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = Deno.readFileSync(existsJsonFile);
@@ -167,7 +167,7 @@ Deno.test("writeJsonSyncIfExists", function (): void {
Deno.test("writeJsonSyncIfExistsAnInvalidJson", function (): void {
const existsInvalidJsonFile = path.join(
testdataDir,
- "file_write_invalid_sync.json"
+ "file_write_invalid_sync.json",
);
const invalidJsonContent = new TextEncoder().encode("[123}");
@@ -179,7 +179,7 @@ Deno.test("writeJsonSyncIfExistsAnInvalidJson", function (): void {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = Deno.readFileSync(existsInvalidJsonFile);
@@ -201,7 +201,7 @@ Deno.test("writeJsonWithSpaces", function (): void {
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = Deno.readFileSync(existsJsonFile);
@@ -214,7 +214,7 @@ Deno.test("writeJsonWithSpaces", function (): void {
Deno.test("writeJsonWithReplacer", function (): void {
const existsJsonFile = path.join(
testdataDir,
- "file_write_replacer_sync.json"
+ "file_write_replacer_sync.json",
);
const invalidJsonContent = new TextEncoder().encode();
@@ -227,12 +227,12 @@ Deno.test("writeJsonWithReplacer", function (): void {
{ a: "1", b: "2", c: "3" },
{
replacer: ["a"],
- }
+ },
);
throw new Error("should write success");
},
Error,
- "should write success"
+ "should write success",
);
const content = Deno.readFileSync(existsJsonFile);