Skip to content

[Bug]: Tests fail if NO_COLOR=1 is set in containing environment #1136

@mgorny

Description

@mgorny

Version

  • latest

version

$ ./target/debug/lsd --version
lsd 1.1.5

But strictly speaking, it's 4d58400.

What OS are you seeing the problem on?

Linux

installation

Running cargo test from git checkout.

term

xterm-256color

ls-colors

No response

What happened?

failures:

---- display::tests::test_display_get_visible_width_with_colors stdout ----

thread 'display::tests::test_display_get_visible_width_with_colors' panicked at src/display.rs:616:13:
"\u{1b}[mHello,world!\u{1b}[m" should start with color
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- meta::symlink::tests::test_symlink_render_default_invalid_target_withcolor stdout ----

thread 'meta::symlink::tests::test_symlink_render_default_invalid_target_withcolor' panicked at src/meta/symlink.rs:130:9:
assertion `left == right` failed
  left: " ⇒ \u{1b}[38;5;124m/target\u{1b}[39m"
 right: " ⇒ \u{1b}[m/target\u{1b}[m"


failures:
    display::tests::test_display_get_visible_width_with_colors
    meta::symlink::tests::test_symlink_render_default_invalid_target_withcolor

test result: FAILED. 387 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.04s

What expected?

Tests passing independently of NO_COLOR=1 set in environment.

What else?

We're setting NO_COLOR=1 globally to ensure that test build and test logs don't contain color codes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions