jejacks0n / teaspoon

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

Coverage output path ignored in 1.2.0 #578

Closed ukdave closed 3 years ago

ukdave commented 4 years ago

I just upgraded teaspoon from 1.1.5 to 1.2.0 and noticed that the HTML coverage report is no longer generated in the directory that I have configured.

My configuration in teaspoon_env.rb looks like this:

Teaspoon.configure do |config|
  # ...

  config.use_coverage = true
  config.coverage do |coverage|
    coverage.reports = %w[text-summary html]
    coverage.output_path = "log/coverage/js"
    coverage.ignore = [
      %r{/lib/ruby/gems/},
      %r{/vendor/*},
      %r{/support/},
      %r{/(.+)_helper.},
      %r{/assets/javascripts/plugin_config},
    ]

    coverage.statements = 100
    coverage.functions = 100
    coverage.branches = 100
    coverage.lines = 100
  end

  # ...
end

After updating to 1.2.0 the coverage report is generated in coverage instead of log/coverage/js.

I've had a look through the source code and I believe the issue is in how the arguments are passed to istanbul in the generate_report method of lib/teaspoon/coverage.rb:

Open3.capture2e(
  @executable, "report", "--include=#{input.shellescape}", "--dir #{output_path}", format
)

should be:

Open3.capture2e(
  @executable, "report", "--include=#{input.shellescape}", "--dir", output_path, format
)
jejacks0n commented 4 years ago

Thanks for this @ukdave, would you be willing to submit a PR to resolve this?

ukdave commented 4 years ago

Sure, I've submitted a pull request #579 to resolve this.

mathieujobin commented 3 years ago

I merged #579 thank you