-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed as not planned
Labels
Description
Describe the bug
If the environment isn't a tty, vitest doesn't color its output, but if I run vitest in my terminal and pipe its stdout to a file or program, its still color the output (showing ESC[1mESC[44m in the log).
Reproduction
In a project with a configured vitest and a terminal
vitest foo=> colored output is okvitest foo > foo.log=>ESC[1mESC[44min the log and shouldn't be therevitest foo |tee -a foo.log=>ESC[1mESC[44min the log and shouldn't be there
Workaround
adding env var NO_COLOR=1 works, NO_COLOR=1 vitest foo > foo.log does not show any color control char in the log, but when stdout isn't a tty it should be useless to add this.
System Info
System:
OS: Linux 6.12 Debian GNU/Linux 13 (trixie) 13 (trixie)
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 18.36 GB / 31.10 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 22.21.0 - /usr/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 11.7.0 - /home/sesamath/usr/bin/npm
pnpm: 10.26.2 - /home/sesamath/usr/bin/pnpm
Browsers:
Chrome: 143.0.7499.192
Chromium: 143.0.7499.169
Firefox: 140.6.0esr
Firefox Developer Edition: 140.6.0esr
npmPackages:
playwright: ^1.57.0 => 1.57.0
vite: ^7.3.0 => 7.3.0
vitest: ^4.0.16 => 4.0.16Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable