You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fantastic tool, thank you! I only hit a little snag: in my project I already have many Kotest/Junit5 units named after HTTP endpoints such as GET /example, and I'm hitting this error:
Caused by: java.lang.IllegalStateException: Test name cannot contain '/', was ...
at com.diffplug.selfie.junit5.SnapshotFileProgress.startTest(SnapshotSystemJUnit5.kt:188)
This happens for every test even though they do not invoke Selfie for snapshots. Could this requirement be loosened somehow? For example:
Escape the resulting name of snapshot files to remove the slash
Do not run this check in tests that do not make use of Selfie
Thank you.
The text was updated successfully, but these errors were encountered:
in your test names, replace / with some other filename-safe character like % or even division slash (if you're crazy).
have two test suites (Gradle makes this pretty easy, not sure about Maven), and only add Selfie to one of them.
I would love to merge a PR which relaxes this requirement, I think you nailed the two paths forward:
Do not run this check in tests that do not make use of Selfie
I think this will be hard. An intentional design decision in Selfie was "add the dependency and it just works". A downside of this is that the Selfie test runner can't know ahead of time whether any given test is going to use Selfie or not. Delaying the check to a lazy "only if used" is possible, but looks tricky to me. If it adds a ton of complexity to the code, then I don't want to merge it.
Escape the resulting name of snapshot files to remove the slash
This would be great! Selfie already has a rigorous escape system so that snapshot names and contents can be literally anything without causing any problems:
I think the right thing is to have a filenameEsc = PerCharacterEscaper.specifiedEscape("@@<(>):c\"q/f\b|p?q*s"). This would create an escaper that does the following transformation:
@ -> @@
< -> @(
" -> @q
/ -> @f (forward slash)
etc
It should be pretty straightforward from there, but there might be some gotchas I haven't thought of.
Fantastic tool, thank you! I only hit a little snag: in my project I already have many Kotest/Junit5 units named after HTTP endpoints such as
GET /example
, and I'm hitting this error:This happens for every test even though they do not invoke Selfie for snapshots. Could this requirement be loosened somehow? For example:
Thank you.
The text was updated successfully, but these errors were encountered: