Comments (10)
The opposite would have been more standard, think of phpunit, it only generates code-coverage reports if you add --coverage and doesnt generate any by default...
Typically you dont want code coverage in dev env and would enable it in CI explicitely...
Do you mind me submitting a MR to invert this?
from phpspec-code-coverage.
Thank you for input. I believe this would be a good enhancement. Would you be willing to submit a PR for this functionality?
A quick workaround for now could be to use separate configuration files (phpspec.yml
), one with coverage and one without.
Thanks again.
from phpspec-code-coverage.
That's exactly what I ended up doing, in the meantime... :-)
from phpspec-code-coverage.
Actually, I have noticed just now that there is a --no-code-generation
when running in phpspec
. Could you check that it works as intended and disables code generation? Wouldn't that accomplish same result?
from phpspec-code-coverage.
I don't think it's the same?
This disables the "automatic code generation".
Function lorem does not exist. Do you want to generate it? (Y/n)
Don't think it has anything to do with generating code coverage for spec tests? ;)
from phpspec-code-coverage.
Oh yes, my bad.
from phpspec-code-coverage.
I've created a pull request to add this functionality.
Run with code coverage:
bin/phpspec run --coverage
Run without code coverage:
bin/phpspec run
from phpspec-code-coverage.
There is --no-coverage
as of version v4.1.1
of extension which accomplishes this.
Thank you everyone for contributing. Closing.
from phpspec-code-coverage.
@cdaguerre @TomSchillemans let me first start by saying that I don't really mind having additional options in the package to support that and I would happily accept the PR for additional feature, however I feel like it's necessary to clarify regarding why the current behaviour is (semi-)consistent with that of phpunit and why just need to implement an additional feature (and not invert what was already implemented).
First, there are 23 ways one can use phpunit's code generation:
- By having a
phpunit.xml
config where you specify phpunit's configuration (including options for code coverage, including the paths where reports are generated). When that is the case, both phpunit and this extension allows you to use--no-coverage
to ignore Code Coverage configuration. This part is consistent withphpunit
. - By supplying Code Coverage configuration to phpunit via arguments passed via CLI (you can still optionally have
phpunit.xml
for generic cases). This allows you to enable code coverage gathering
all the time, but generate reports only when you supply specific arguments tophpunit
(i.e.--coverage-html <path>
,--coverage-text
etc.). We currently do not have this and would need to implement this in a PR - (Updated) You can have a generic
phpunit.xml.dist
which is the git repository and has CI specific configuration, while the developers could always customize it by providing aphpunit.xml
instead (the latter would never be checked into git and allow you to control howphpunit
works on developers machine). This feature is really out of scope for this extension
To summarize, we would need to implement a feature to support specifying code coverage configuration parameters via cli instead of only supporting configuration file. I will make a separate issue for this and have a look if I can sort this out during the weekend.
from phpspec-code-coverage.
p.s. There is even a third-case in phpunit
which would also allow you to accomplish the same thing: You can have a generic phpunit.xml.dist
which is the git repository and has CI specific configuration, while the developers could always customize it by providing a phpunit.xml
instead (the latter would never be checked into git and allow you to control how phpunit
works on developers machine). This feature is really out of scope for this extension
from phpspec-code-coverage.
Related Issues (17)
- [backport] Print code coverage ratio in command output HOT 1
- PHPSpec v4 support HOT 5
- Should this package work with PhpSpec code generation? HOT 2
- Documentation suggestion HOT 3
- phpunit/php-code-coverage v6 support HOT 3
- Update phpdoc comments HOT 1
- Add coding style guide and checker
- Functional / Integration tests
- Integrate with ScrutinizerCI
- `--no-coverage` argument bugfixes
- Support providing configuration parameters via CLI
- phpspec v5 HOT 3
- Wrong phpunit/php-code-coverage version requirements for version 4.0.0 HOT 1
- PHP 7+ focused release HOT 1
- Add code coverage report examples to README
- Windows based CI (appveyor)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpspec-code-coverage.