gkampitakis / go-snaps

Jest-like snapshot testing in Go 📸
https://pkg.go.dev/github.com/gkampitakis/go-snaps
MIT License
174 stars 6 forks source link

fix: update isSkippedFile, replace file absolute match w/ regex match #48

Closed parasyris closed 2 years ago

parasyris commented 2 years ago

Hey 👋 , I noticed an edge case issue on isFileSkipped. The run flag is accepting a regex but the isFileSkipped is doing an absolute match. I have seen there is a relevant fix but probably missed this point https://github.com/gkampitakis/go-snaps/commit/9c6ad4b3de7f4ff998935124bd105535112daff8.

So I changed to regex match and added a unit test.

Did also a minor change in testSkipped, shouldn't affect anything just moved the regex checking if a test is skipped at the end just to defer the regex matching.

gkampitakis commented 2 years ago

Thanks a lot for the contribution. Yup missed that.

Seems you need to run make format.