b0g3r / perseus

WIP: snapshot management tool
MIT License
1 stars 1 forks source link

Fail test if there is no snapshot in place #9

Open Bobronium opened 3 years ago

Bobronium commented 3 years ago

Imagine, you run tests in CI and somehow snapshots are not there (e. g. you forgot to add them to commit): perseus will just silently create missing snapshots without any warnings and CI will pass.

I think it should at least skip the test, give some warning or cause failure.

Since warnings and skipped test does not always make pytest exit with non-zero return code, which would cause CI to fail, I suggest to fail test with some exception or pytest.fail().

Such behaviour should be pretty expected, as we did not actually test anything, but rather created a new snapshot.

Taking into account that perseus 1.0 must be compatible with snapshottest, I suggest to add an option that will trigger new behaviour, and in 2.0 make it default