[英]How to turn off code coverage for phpunit 5.4+
In older versions of phpunit you could turn off code coverage reporting with the flag: --no-coverage
. 在较早版本的phpunit中,您可以使用
--no-coverage
标志关闭代码覆盖率报告。 This allowed our suite to run much faster on CI environments, etc. In the current stable version (5.4) I don't see this option in the docs . 这使我们的套件可以在CI环境等上更快地运行。在当前的稳定版本(5.4)中,我在docs中看不到此选项。 What's the current way to turn off code coverage?
当前关闭代码覆盖率的方法是什么?
The --no-coverage
option might be missing from the documentation but it works for me. 文档中可能没有
--no-coverage
选项,但它对我有用。
It's still in PHPUnit's code as well, see Command.php:66 and Command.php:523 . 它也仍然在PHPUnit的代码中,请参阅Command.php:66和Command.php:523 。
I've created a tiny test project with 1 class and 1 test to try it out. 我创建了一个包含1个班级和1个测试的小型测试项目来进行尝试。 I've enabled code coverage output (HTML) in the
<logging>
section of phpunit.xml . 我已经在phpunit.xml的
<logging>
部分中启用了代码覆盖率输出(HTML)。
Running phpunit without the option: 不带选项运行phpunit:
$ phpunit
PHPUnit 5.4.6 by Sebastian Bergmann and contributors.
[removed irrelevant output]
OK (1 test, 1 assertion)
Generating code coverage report in HTML format ... done
Code coverage is being generated and outputted. 代码覆盖率正在生成和输出。
Running phpunit with the option: 使用以下选项运行phpunit:
$ phpunit --no-coverage
PHPUnit 5.4.6 by Sebastian Bergmann and contributors.
[removed irrelevant output]
OK (1 test, 1 assertion)
No code coverage generation. 没有代码覆盖率生成。 (The command ran faster too.)
(命令也运行得更快。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.