diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/tty_test.ts | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/cli/tests/unit/tty_test.ts b/cli/tests/unit/tty_test.ts index 8787db3e1..88b25d758 100644 --- a/cli/tests/unit/tty_test.ts +++ b/cli/tests/unit/tty_test.ts @@ -1,21 +1,15 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -import { assert, assertThrows } from "./test_util.ts"; +import { assert } from "./test_util.ts"; // Note tests for Deno.stdin.setRaw is in integration tests. -Deno.test({ permissions: { read: true } }, function consoleSizeFile() { - const file = Deno.openSync("cli/tests/testdata/assets/hello.txt"); - assertThrows(() => { - Deno.consoleSize(file.rid); - }, Error); - file.close(); -}); - -Deno.test(function consoleSizeError() { - assertThrows(() => { - // Absurdly large rid. - Deno.consoleSize(0x7fffffff); - }, Deno.errors.BadResource); +Deno.test(function consoleSize() { + if (!Deno.isatty(Deno.stdout.rid)) { + return; + } + const result = Deno.consoleSize(); + assert(typeof result.columns !== "undefined"); + assert(typeof result.rows !== "undefined"); }); Deno.test({ permissions: { read: true } }, function isatty() { |