mardi 28 juin 2016

minitest-reporters does not change minitest output style

I have been trying to use the minitest-reporters gem to alter the output style of Ruby's builtin minitest testing library. However, it does not actually change the output.

It should be noted that I am not using Rails or Rake, but I didn't think that would make a difference. I am simply trying to test a Ruby command-line program that I have written.

Here's a dumb little test case (let's call it dumbtest.rb) that I was trying out:

require 'minitest/autorun'
require 'minitest/reporters'

Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true), Minitest::Reporters::SpecReporter.new]

describe "MiniTest demo" do
  describe "when asked about the number 2" do
    it "should be equal to the number 2" do  
      2.must_equal 2
    end 
  end 
end

When I run the test, it just produces the default minitest output (i.e. colorless, no descriptions of passing tests, etc.):

$ ruby -Ilib:test dumbtest.rb 
Run options: --seed 48983

# Running:

.

Finished in 0.001356s, 737.6595 runs/s, 737.6595 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips

With minitest-reporters enabled, I expect the output to look something more like this (i.e. list both passing and failing tests as opposed to just failing, the word PASS is colored green, the final summary is color-coded, etc.):

enter image description here

There are no runtime errors. It's just not working for me. Any idea why?

Aucun commentaire:

Enregistrer un commentaire