summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-11-20 15:58:22 -0500
committerGitHub <noreply@github.com>2023-11-20 15:58:22 -0500
commit1eefe3e42b40ef8a2cd7cc4f29540aff11974165 (patch)
tree6b29b815beb6b951f610bf84ea41b43312c6cbb9 /cli/tests
parentc97a97240bb60d00f7a28ef327f444a9b6820f37 (diff)
fix: Deno.noColor should not be true when NO_COLOR is empty string (#21275)
Closes https://github.com/denoland/deno/issues/21274
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/tty_color_test.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/cli/tests/unit/tty_color_test.ts b/cli/tests/unit/tty_color_test.ts
index 3adc16b23..b49ffa6bd 100644
--- a/cli/tests/unit/tty_color_test.ts
+++ b/cli/tests/unit/tty_color_test.ts
@@ -24,3 +24,32 @@ Deno.test(
assertEquals(output, "false\n");
},
);
+
+Deno.test(
+ { permissions: { run: true, read: true } },
+ async function denoNoColorTrueEmptyVar() {
+ const { stdout } = await new Deno.Command(Deno.execPath(), {
+ args: ["eval", "console.log(Deno.noColor)"],
+ env: {
+ // https://no-color.org/ -- should not be true when empty
+ NO_COLOR: "",
+ },
+ }).output();
+ const output = new TextDecoder().decode(stdout);
+ assertEquals(output, "false\n");
+ },
+);
+
+Deno.test(
+ { permissions: { run: true, read: true } },
+ async function denoNoColorTrueEmptyVar() {
+ const { stdout } = await new Deno.Command(Deno.execPath(), {
+ args: ["eval", "console.log(Deno.noColor)"],
+ env: {
+ NO_COLOR: "1",
+ },
+ }).output();
+ const output = new TextDecoder().decode(stdout);
+ assertEquals(output, "true\n");
+ },
+);