summaryrefslogtreecommitdiff
path: root/std/fs
diff options
context:
space:
mode:
Diffstat (limited to 'std/fs')
-rw-r--r--std/fs/copy.ts2
-rw-r--r--std/fs/empty_dir_test.ts3
-rw-r--r--std/fs/exists_test.ts2
-rw-r--r--std/fs/walk.ts16
4 files changed, 14 insertions, 9 deletions
diff --git a/std/fs/copy.ts b/std/fs/copy.ts
index 62e6f59e5..86fac78df 100644
--- a/std/fs/copy.ts
+++ b/std/fs/copy.ts
@@ -85,6 +85,8 @@ async function copyFile(
await Deno.copyFile(src, dest);
if (options.preserveTimestamps) {
const statInfo = await Deno.stat(src);
+ assert(statInfo.accessed != null, `statInfo.accessed is unavailable`);
+ assert(statInfo.modified != null, `statInfo.modified is unavailable`);
await Deno.utime(dest, statInfo.accessed, statInfo.modified);
}
}
diff --git a/std/fs/empty_dir_test.ts b/std/fs/empty_dir_test.ts
index b27ebd033..928ba80e6 100644
--- a/std/fs/empty_dir_test.ts
+++ b/std/fs/empty_dir_test.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import {
+ assert,
assertEquals,
assertStrContains,
assertThrows,
@@ -225,6 +226,8 @@ Deno.test(async function emptyDirPermission(): Promise<void> {
args: args
});
+ assert(stdout);
+
const output = await Deno.readAll(stdout);
assertStrContains(new TextDecoder().decode(output), s.output);
diff --git a/std/fs/exists_test.ts b/std/fs/exists_test.ts
index 06b908b9d..204799447 100644
--- a/std/fs/exists_test.ts
+++ b/std/fs/exists_test.ts
@@ -131,7 +131,7 @@ Deno.test(async function existsPermission(): Promise<void> {
args: args
});
- const output = await Deno.readAll(stdout);
+ const output = await Deno.readAll(stdout!);
assertStrContains(new TextDecoder().decode(output), s.output);
}
diff --git a/std/fs/walk.ts b/std/fs/walk.ts
index 108eebc46..890114525 100644
--- a/std/fs/walk.ts
+++ b/std/fs/walk.ts
@@ -65,9 +65,9 @@ export async function* walk(
includeFiles = true,
includeDirs = true,
followSymlinks = false,
- exts = null,
- match = null,
- skip = null
+ exts = undefined,
+ match = undefined,
+ skip = undefined
}: WalkOptions = {}
): AsyncIterableIterator<WalkInfo> {
if (maxDepth < 0) {
@@ -76,7 +76,7 @@ export async function* walk(
if (includeDirs && include(root, exts, match, skip)) {
yield { filename: root, info: await stat(root) };
}
- if (maxDepth < 1 || !include(root, null, null, skip)) {
+ if (maxDepth < 1 || !include(root, undefined, undefined, skip)) {
return;
}
const ls: FileInfo[] = await readDir(root);
@@ -119,9 +119,9 @@ export function* walkSync(
includeFiles = true,
includeDirs = true,
followSymlinks = false,
- exts = null,
- match = null,
- skip = null
+ exts = undefined,
+ match = undefined,
+ skip = undefined
}: WalkOptions = {}
): IterableIterator<WalkInfo> {
if (maxDepth < 0) {
@@ -130,7 +130,7 @@ export function* walkSync(
if (includeDirs && include(root, exts, match, skip)) {
yield { filename: root, info: statSync(root) };
}
- if (maxDepth < 1 || !include(root, null, null, skip)) {
+ if (maxDepth < 1 || !include(root, undefined, undefined, skip)) {
return;
}
const ls: FileInfo[] = readDirSync(root);