茶匙+摩卡+伊斯坦布尔覆盖范围

时间:2014-09-10 04:27:36

标签: javascript ruby-on-rails node.js teaspoon

Teaspoon正在使用Mocha显示我的测试:localhost:3000 /茶匙/默认

我读到我可以将伊斯坦布尔与Teaspoon一起用于代码覆盖率报告。

我安装了npm istanbul,但我不知道如何用茶匙运行它。

我想在localhost:3000 / coverage或localhost:3000 /茶匙/默认/覆盖

中覆盖我的报道

配置是什么? 我在Teaspoon尝试了默认的但没有工作:

Teaspoon.setup do |config|
  # Coverage (requires istanbul -- https://github.com/gotwarlost/istanbul)
  config.coverage                      = true
  config.coverage_reports = ['text', 'html', 'cobertura']
  config.coverage_output_dir           = "coverage"
  config.statements_coverage_threshold = 50
  config.functions_coverage_threshold  = 50
  config.branches_coverage_threshold   = 50
  config.lines_coverage_threshold      = 50
end

1 个答案:

答案 0 :(得分:0)

此配置对我有用:

Teaspoon.configure do |config|
  config.mount_at = "/teaspoon"

  config.suite do |suite|
    suite.use_framework :mocha
    suite.javascripts += ["support/expect"]
  end

  config.formatters = ["tap"]
  config.color = true
  config.use_coverage = :default

  config.coverage do |coverage|
    coverage.reports = ["html", "cobertura"]
    coverage.output_path = "coverage"
  end
end