-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
doctest outputs ANSI escapes to non-color TTYs, resulting in visible junk #832
Comments
Thanks! And for now you could use DOCTEST_CONFIG_COLORS_NONE |
I actually haven't added the code by @snej in the dev branch, and it would be cool if the library simply works by default - reopening |
You must have, the |
I tried using |
yeah, that works indeed, but it would be cool if the library detected as much as possible and handle stuff automatically so users don't have to dig through the docs - I don't see automatic detection as feature creep (while many other things could be considered as such) |
Sure thing, though I think it's more effort than just squeezing in an @snej If you are up for it then you can have a stab at implementing it and make a PR. |
Description
doctest’s check for whether to enable color output is too simplistic: it just tests
isatty(STDOUT_FILENO)
(e.g. in thecolor_to_stream
function.) But not all TTYs support ANSI color; one common exception is Xcode’s console pane.This causes junk to appear in the output for just about anyone developing native Mac or iOS apps unless they disable color on the command line.
Steps to reproduce
Run doctest tests in an Xcode project, with output going to the console pane as usual.
[0;36m
and the like in the console outputExtra information
On Unix systems you can test the
TERM
environment variable, but that doesn’t work on Windows. Here’s a reliable function that I’ve used in other projects:The text was updated successfully, but these errors were encountered: