spatie/phpunit-snapshot-assertions

Config Option to preview new snapshots instead of creating them

Closed this issue · 3 comments

Hi there

Awesome library guys. So helpful. Like it a lot!

I'd like to propose a feature request: Disable auto-creating new snapshots and instead print out the content as preview.

Using the "--update-snapshots" one can still update/create those missing snapshots.

Thx for your consideration
Best
Dimitri

I'm open for this, but not convinced yet. Why wouldn't you want to create snapshots? Why add the assertion in the first place then?

The idea behind snapshots, as far as I understand, is to first create green code and then write a quick snapshot assertion. But if you want to still do TDD style such auto snapshot creation is not handy. I still do a lot of classic TDD style coding but have modified the auto creation of snapshots to a preview style and only create snapshots manually when finished. For this a config option would come in handy.

Fair enough! We'd accept a tested PR that adds a --no-create-snapshots, --dry-run-snapshots or similar flag to this package.