diff options
author | Antonio Musolino <antoniomusolino007@gmail.com> | 2022-03-01 04:37:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-01 12:37:50 +0900 |
commit | 6a030a5396f9c838b4d4523f43ab2d9e2f502e04 (patch) | |
tree | 2ad4c356bb5c5ec5b91dbcd5dd9e3442fed0c2bc /cli/tests | |
parent | a41d399f5f728c73b652c3f5f5c2bf57d2054153 (diff) |
fix(runtime): disable console color for non tty stdout (#13782)
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/tty_color_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/tests/unit/tty_color_test.ts b/cli/tests/unit/tty_color_test.ts new file mode 100644 index 000000000..d64c278bf --- /dev/null +++ b/cli/tests/unit/tty_color_test.ts @@ -0,0 +1,14 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +import { assertEquals } from "./test_util.ts"; + +// Note tests for Deno.setRaw is in integration tests. + +Deno.test({ permissions: { run: true } }, async function noColorIfNotTty() { + const p = Deno.run({ + cmd: [Deno.execPath(), "eval", "console.log(1)"], + stdout: "piped", + }); + const output = new TextDecoder().decode(await p.output()); + assertEquals(output, "1\n"); + p.close(); +}); |