使用gb如何获取代码覆盖率?

huangapple go评论78阅读模式
英文:

How to get code coverage using gb?

问题

运行gb

gb test .../<regex>/... -v

是可以的,但是运行gb test .../<regex>/... -coverprofile=cover.out会出现以下错误:

testing: cannot use -test.coverprofile because test binary was not built with coverage enabled

go test -coverprofile cover.out是可以的。如何在使用gb时获取代码覆盖率?

英文:

Running gb:

gb test .../&lt;regex&gt;/... -v

works, but running gb test .../&lt;regex&gt;/... -coverprofile=cover.out results in:

testing: cannot use -test.coverprofile because test binary was not built with coverage enabled

while go test -coverprofile cover.out works. How to get code coverage using gb as well?

答案1

得分: 1

-coverprofile标志在gb中尚不受支持。

您可以在https://github.com/constabulary/gb/issues/367上查看状态。

那里还发布了一个解决方法,您可以使用。

英文:

-coverprofile flag is not supported in gb yet.

You can check the status at https://github.com/constabulary/gb/issues/367.

There is also a workaround posted there, which you can use.

huangapple
  • 本文由 发表于 2016年1月25日 06:05:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/34982070.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定