简体   繁体   English

茶匙+摩卡咖啡+伊斯坦布尔覆盖

[英]Teaspoon + Mocha + Istanbul Coverage

Teaspoon is working showing my tests with Mocha in: localhost:3000/teaspoon/default Teaspoon正在显示我在Mocha中的测试:localhost:3000 / teaspoon / default

I read that I can use Istanbul with Teaspoon for code coverage reports. 我读到我可以将伊斯坦布尔和Teaspoon一起用于代码覆盖率报告。

I installed with npm istanbul, but I don't know how to run it with teaspoon. 我安装了npm istanbul,但是我不知道如何用茶匙运行它。

I would like to reach my coverage in localhost:3000/coverage or localhost:3000/teaspoon/default/coverage 我想覆盖localhost:3000 / coverage或localhost:3000 / teaspoon / default / coverage

What is the configuration? 有什么配置? I tried the default one in Teaspoon but is not working: 我在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

This configuration is working for me: 此配置为我工作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM