Giter VIP home page Giter VIP logo

Comments (10)

cdaguerre avatar cdaguerre commented on August 22, 2024 1

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.

ek9 avatar ek9 commented on August 22, 2024

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.

UrGuardian4ngel avatar UrGuardian4ngel commented on August 22, 2024

That's exactly what I ended up doing, in the meantime... :-)

from phpspec-code-coverage.

ek9 avatar ek9 commented on August 22, 2024

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.

UrGuardian4ngel avatar UrGuardian4ngel commented on August 22, 2024

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.

ek9 avatar ek9 commented on August 22, 2024

Oh yes, my bad.

from phpspec-code-coverage.

dannylewis-sheffield avatar dannylewis-sheffield commented on August 22, 2024

I've created a pull request to add this functionality.

#20

Run with code coverage:
bin/phpspec run --coverage

Run without code coverage:
bin/phpspec run

from phpspec-code-coverage.

ek9 avatar ek9 commented on August 22, 2024

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.

ek9 avatar ek9 commented on August 22, 2024

@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:

  1. 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 with phpunit.
  2. 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 to phpunit (i.e. --coverage-html <path>, --coverage-text etc.). We currently do not have this and would need to implement this in a PR
  3. (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 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

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.

ek9 avatar ek9 commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.