Code Monkey home page Code Monkey logo

Comments (6)

mathieutu avatar mathieutu commented on June 6, 2024 1

If you want to keep it in cli it can be something like

  • SNAPSHOTS_CREATION=false phpunit for avoiding snapshot creation (or WITHOUT_CREATING_SNAPSHOT=true if you prefer)
  • SNAPSHOTS_UPDATE=true phpunit to allow snapshot update if already existing.

But with that, we also can set it in .env, in CI env var, in phpunit.xml file, etc. so the users can do whatever they want.

from phpunit-snapshot-assertions.

mfn avatar mfn commented on June 6, 2024 1

I did something mildly related in our project:

I learned that when you're developing locally, you really always just want to update the snapshots. You'll see the diff anyway in your favorite VCS. But with a lots-of-devs it's easy to have someone not add this setting into their favourite IDE integration etc. So I extended the trait from this package and implemented my own shouldUpdateSnapshots with some env checking.

And in fact, if the env vars would have been supported already, I could have added this to the shared phpunit.xm.dist for example, not needing to change anything with the package.

I like the idea and too think that env vars are more flexible; the package could just keep the existing behaviour (e.g. command line overrides env var?) and add the new ones.

from phpunit-snapshot-assertions.

freekmurze avatar freekmurze commented on June 6, 2024

I like that users of our package can now simply add something to the command to change certain behaviour. What would the required steps be for a user to run that tests without creating snapshots?

from phpunit-snapshot-assertions.

freekmurze avatar freekmurze commented on June 6, 2024

I would be open for a PR that allows listening for env vars and while still keeping support for the current command line parameters.

from phpunit-snapshot-assertions.

mathieutu avatar mathieutu commented on June 6, 2024

Ok I'm doing it.

Do you have a preference for the env var names ?
CREATE_SNAPSHOTS=false and UPDATE_SNAPSHOTS=true are ok for you?

from phpunit-snapshot-assertions.

freekmurze avatar freekmurze commented on June 6, 2024

We'll continue the conversation in #126

from phpunit-snapshot-assertions.

Related Issues (20)

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.