How to color unit tests with lib minitest or Test:Unit?

前端 未结 7 1374
执念已碎
执念已碎 2021-02-04 06:42

I would like to have unit tests output color in my dev environment. However, I can\'t make it work on Linux (Debian and Ubuntu). When I include the following libs:



        
7条回答
  •  情深已故
    2021-02-04 07:14

    step 1 : use the latest version of the gem (I think it will be fixed in Ruby 1.9.3)

    gem install minitest
    

    step 2 : require "minitest/pride" on the command line, not in your code

    ruby -rminitest/pride your_ruby_script.rb
    

    .. and in your code simply require 'minitest/autorun'

    require 'minitest/autorun'
    

    If you use Rubymine, just add

    -rminitest
    

    in the default configuration of the tests. => the configuration would like

    -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -rminitest/pride
    

提交回复
热议问题