diff --git a/CHANGELOG.md b/CHANGELOG.md index 6208f6b..32e5246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [4.1.2] - 2018-03-21 + +- Fix `--no-coverage` option introducing errors when running non `run` commands. +- `--no-coverage` option is now available to all phpspec commands (not only + `run`). (#30) + ## [4.1.1] - 2018-03-19 - Added `--no-coverage` option which can skip code coverage generation during @@ -80,6 +86,7 @@ as [leanphp/phpspec-code-coverage][0]. - Support configuring a blacklist of files to be excluded from code coverage reports (`blaclist_files` option). +[4.1.2]: https://github.com/leanphp/phpspec-code-coverage/releases/tag/v4.1.2 [4.1.1]: https://github.com/leanphp/phpspec-code-coverage/releases/tag/v4.1.1 [4.1.0]: https://github.com/leanphp/phpspec-code-coverage/releases/tag/v4.1.0 [4.0.0]: https://github.com/leanphp/phpspec-code-coverage/releases/tag/v4.0.0 diff --git a/src/CodeCoverageExtension.php b/src/CodeCoverageExtension.php index e275c01..03a14cc 100644 --- a/src/CodeCoverageExtension.php +++ b/src/CodeCoverageExtension.php @@ -24,12 +24,9 @@ class CodeCoverageExtension implements \PhpSpec\Extension public function load(ServiceContainer $container, array $params = []) { foreach ($container->getByTag('console.commands') as $command) { - if ($command->getName() == 'run') { - $command->addOption('no-coverage', null, InputOption::VALUE_NONE, 'Skip code coverage generation'); - } + $command->addOption('no-coverage', null, InputOption::VALUE_NONE, 'Skip code coverage generation'); } - $container->define('code_coverage.filter', function () { return new Filter(); }); @@ -107,7 +104,7 @@ public function load(ServiceContainer $container, array $params = []) $skipCoverage = false; $input = $container->get('console.input'); - if ($input->getOption('no-coverage')) { + if ($input->hasOption('no-coverage') && $input->getOption('no-coverage')) { $skipCoverage = true; }