jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

Coverage is not working. #169

Closed lenntt closed 10 years ago

lenntt commented 10 years ago

When I add in my config:

  config.lines_coverage_threshold      = 100
  config.coverage = true

And I run my teaspoon rake task Then I get the following error after teaspoon executes my specs:

undefined method `+' for nil:NilClass
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/check_coverage.rb:25:in `block in check_coverage_options'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/check_coverage.rb:22:in `each'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/check_coverage.rb:22:in `inject'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/check_coverage.rb:22:in `check_coverage_options'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/check_coverage.rb:10:in `check_coverage'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/coverage.rb:19:in `block in reports'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/coverage.rb:11:in `reports'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/formatters/base_formatter.rb:58:in `log_coverage'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/formatters/base_formatter.rb:39:in `result'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/formatters/dot_formatter.rb:38:in `result'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/runner.rb:51:in `block in notify_formatters'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/runner.rb:49:in `each'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/runner.rb:49:in `notify_formatters'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/runner.rb:41:in `output_from'
../vendor/bundle/ruby/2.0.0/gems/teaspoon-0.7.9/lib/teaspoon/runner.rb:27:in `process'
...

Apparently line is nil. What am I doing wrong?

lenntt commented 10 years ago

apparently, I should've set config.coverage_reports and config.coverage_output_dir for coverage. I think a default value or a better error would have helped here.

However, setting config.lines_coverage_threshold = 100 still gives me the same error. How does this work?

jejacks0n commented 10 years ago

I agree with you, and I'm redoing the coverage v0.8 -- I merged it without fully vetting it. So thanks for the heads up.