Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail when run in unrecognised CI environment #12

Closed
hovinen opened this issue Jul 21, 2023 · 0 comments · Fixed by #13
Closed

Tests fail when run in unrecognised CI environment #12

hovinen opened this issue Jul 21, 2023 · 0 comments · Fixed by #13

Comments

@hovinen
Copy link
Contributor

hovinen commented Jul 21, 2023

Currently some of the tests will fail spuriously when their output is redirected to a file but the environment is not recognised as a CI environment. This unfortunately blocks my project's use of this crate.

The problem is that the code has a hard dependency on the is_terminal method and the tests cannot override that. To fix this, I would propose allowing that behaviour to be overridden with an additional environment variable. This seems reasonable since much of the rest of the crate's behaviour is also governed by environment variables.

I will prepare a PR for you to consider.

hovinen added a commit to hovinen/supports-color that referenced this issue Jul 21, 2023
Currently the tests fail in environments where the output is written to something other than a TTY or a known CI environment. This is because the code makes a hard-coded call to `is_terminal` and disables colour output if that returns false.

This change introduces an environment variable `IGNORE_IS_TERMINAL` which overrides the `is_terminal` check. The tests which depend on colour output now set this environment variable so that they pass in such environments.

Fixes zkat#12
@zkat zkat closed this as completed in #13 Jul 26, 2023
zkat pushed a commit that referenced this issue Jul 26, 2023
…n by environment variable. (#13)

Fixes: #12

Currently the tests fail in environments where the output is written to something other than a TTY or a known CI environment. This is because the code makes a hard-coded call to `is_terminal` and disables colour output if that returns false.

This change introduces an environment variable `IGNORE_IS_TERMINAL` which overrides the `is_terminal` check. The tests which depend on colour output now set this environment variable so that they pass in such environments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant