【问题标题】:Teaspoon + Mocha + Istanbul Coverage茶匙 + 摩卡 + 伊斯坦布尔报道
【发布时间】:2014-09-10 04:27:35
【问题描述】:

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

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

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

我想在 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

【问题讨论】:

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


    【解决方案1】:

    此配置对我有用:

    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
    

    【讨论】:

    • 根据您的配置,到达覆盖范围的 url 是什么?
    • @FedericoBucchi 对此没有引用我的话,但我认为这将在 config.root + '/coverage' 处生成一个包含该信息的 HTML 文件。
    猜你喜欢
    • 1970-01-01
    • 2016-11-16
    • 2016-02-10
    • 1970-01-01
    • 2014-02-11
    • 2023-03-19
    • 1970-01-01
    • 2013-12-21
    • 1970-01-01
    相关资源
    最近更新 更多