In rails is it possible to get colour highlighting for the rake test command?

前端 未结 3 1656
梦如初夏
梦如初夏 2021-02-08 23:05

When running the rake test command from the terminal within a rails 3 project directory, the test result output is not coloured. Hence it cannot be interpreted at a gla

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-08 23:32

    I discovered that redgreen was abandoned years ago, and found this solution which works well and requires no script hacking. The output, however, shows which test is being run in real time. So it is a lot longer than built in test output. It does have nice colors.

    http://rubygems.org/gems/turn

    In my Gemfile:

    group :test do
      gem 'turn'
    end
    

    Then run:

    $ bundle install
    $ rake test
    

    The gem 'turn' works great. The caveat is that it doesn't seem to work with Mocha, due to monkey-patching issues. If you are using Mocha, you can use the redgreen gem. See instructions above in the approved answer for this question.

提交回复
热议问题