In the test block, the color is displayed using the console, but not tmux, if the -use-color option is not specified

If I create a new Rails application (3.2.12). Add the test-unit stone to my development, test group, and then to the forest resource. When I run tests with Mac console.app, I get color output.

 bundle exec rake test 

When I create a tmux session (in console.app) for the application and run the same command. I do not get color rendering. However, if I pass the "useuse" switch, then I get the color output for tests in tmux.

 bundle exec rake test TESTOPTS="--use-color" 

I set 256 colors in tmux.config with set -g default-terminal "screen-256color" . Any idea why I don't get the color in tmux when I run the rake command without TESTOPTS?

0
ruby-on-rails tmux testunit
source share
1 answer

It looks like the test module is guessing if the terminal supports color (mostly) by looking at the TERM environment variable. Unfortunately, screen-256color does not satisfy checks what it does .

It might be prudent to request that his recognition of screen be expanded to include screen-256color as well.

I think you can leave some entries in the configuration file to provide default arguments. The first of test-unit.yml (in the current directory) or ~/.test-unit.yml (the "hidden" file in your home directory) will be loaded:

 runner: console console_options: arguments: --use-color=yes 
+1
source share

All Articles