我可以让lein cloverage跳过特定测试吗? [英] Can I make lein cloverage skip specific tests?
问题描述
我正在一个Leiningen项目上,该项目的集成测试注释为...
I'm on a Leiningen project that has its integration tests annotated like...
(deftest ^:manual test-v3-preview
(preview-client "http://localhost:10313/v3/preview"))
当我 lein cloverage
时,这些测试总是失败。有什么我可以传递给lein cloverage的论点来跳过 ^ manual
测试吗?
These tests always fail when I lein cloverage
. Are there arguments I can pass to lein cloverage that skips the ^manual
tests?
推荐答案
从三叶草 1.0.11
(当前未发布)开始,您可以指定:test-ns-regex
选项。请参阅自述文件中的文档。
As of cloverage 1.0.11
(currently unreleased) you can specify a :test-ns-regex
option. See documentation in the README.
Using a negative lookahead regex you can run all namespaces that do not contain the string in the lookahead. E.g.
#"^((?!manual-test).)*$"
这里是一个完整的示例,因为我花了太多时间弄清楚如何做到这一点。您还需要将cloverage版本指定为环境变量,因为否则它将使用最新发布的版本。
Here is a full example since I spent way too long figuring out how to do this. You also need to specify the cloverage version as an environment variable because otherwise it uses the latest released version.
在 project.clj $ c中$ c>:
:profiles
{:cloverage {:plugins [[lein-cloverage "1.0.11-20180518.155437-26"]]
:cloverage {:test-ns-regex [#"^((?!manual-test).)*$"]}}}
然后运行它:
CLOVERAGE_VERSION=1.0.11-20180518.155428-32 lein with-profile +test,+cloverage cloverage
这篇关于我可以让lein cloverage跳过特定测试吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!