summaryrefslogtreecommitdiff
path: root/cli/js/chmod_test.ts
diff options
context:
space:
mode:
authorMaximilien Mellen <maxmellen0@gmail.com>2020-02-19 21:36:18 +0100
committerGitHub <noreply@github.com>2020-02-19 15:36:18 -0500
commit90125566bbaed8b5c6e55ca8dbc432e3433fb73c (patch)
treebf798a408b26264641260395ce8cfc9d4bb37637 /cli/js/chmod_test.ts
parent852823fa505d75d61e70e1330bbf366aa248e650 (diff)
Enable TS strict mode by default (#3899)
Fixes #3324 Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'cli/js/chmod_test.ts')
-rw-r--r--cli/js/chmod_test.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/cli/js/chmod_test.ts b/cli/js/chmod_test.ts
index 3ecb4256a..b3b0a2ae2 100644
--- a/cli/js/chmod_test.ts
+++ b/cli/js/chmod_test.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { testPerm, assertEquals } from "./test_util.ts";
+import { testPerm, assert, assertEquals } from "./test_util.ts";
const isNotWindows = Deno.build.os !== "win";
@@ -16,6 +16,7 @@ testPerm({ read: true, write: true }, function chmodSyncSuccess(): void {
// Check success when not on windows
if (isNotWindows) {
const fileInfo = Deno.statSync(filename);
+ assert(fileInfo.mode);
assertEquals(fileInfo.mode & 0o777, 0o777);
}
});
@@ -35,14 +36,17 @@ if (isNotWindows) {
Deno.symlinkSync(filename, symlinkName);
let symlinkInfo = Deno.lstatSync(symlinkName);
+ assert(symlinkInfo.mode);
const symlinkMode = symlinkInfo.mode & 0o777; // platform dependent
Deno.chmodSync(symlinkName, 0o777);
// Change actual file mode, not symlink
const fileInfo = Deno.statSync(filename);
+ assert(fileInfo.mode);
assertEquals(fileInfo.mode & 0o777, 0o777);
symlinkInfo = Deno.lstatSync(symlinkName);
+ assert(symlinkInfo.mode);
assertEquals(symlinkInfo.mode & 0o777, symlinkMode);
}
);
@@ -86,6 +90,7 @@ testPerm({ read: true, write: true }, async function chmodSuccess(): Promise<
// Check success when not on windows
if (isNotWindows) {
const fileInfo = Deno.statSync(filename);
+ assert(fileInfo.mode);
assertEquals(fileInfo.mode & 0o777, 0o777);
}
});
@@ -105,14 +110,17 @@ if (isNotWindows) {
Deno.symlinkSync(filename, symlinkName);
let symlinkInfo = Deno.lstatSync(symlinkName);
+ assert(symlinkInfo.mode);
const symlinkMode = symlinkInfo.mode & 0o777; // platform dependent
await Deno.chmod(symlinkName, 0o777);
// Just change actual file mode, not symlink
const fileInfo = Deno.statSync(filename);
+ assert(fileInfo.mode);
assertEquals(fileInfo.mode & 0o777, 0o777);
symlinkInfo = Deno.lstatSync(symlinkName);
+ assert(symlinkInfo.mode);
assertEquals(symlinkInfo.mode & 0o777, symlinkMode);
}
);