0

Teaspoon 正在使用 Mocha 显示我的测试:localhost:3000/teaspoon/default

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

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

我想在 localhost:3000/coverage 或 localhost:3000/teaspoon/default/coverage 中达到我的覆盖范围

什么是配置?我尝试了 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
4

1 回答 1

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
于 2014-09-12T07:31:58.337 回答