From 6a030a5396f9c838b4d4523f43ab2d9e2f502e04 Mon Sep 17 00:00:00 2001 From: Antonio Musolino Date: Tue, 1 Mar 2022 04:37:50 +0100 Subject: fix(runtime): disable console color for non tty stdout (#13782) --- cli/tests/unit/tty_color_test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cli/tests/unit/tty_color_test.ts (limited to 'cli/tests') 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(); +}); -- cgit v1.2.3