-
Notifications
You must be signed in to change notification settings - Fork 16
New regex-based snapshot parsing breaks when using =
in the snapshot name
#122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yeah - I was worried the introduction of the REGEX might break someone 😟 . The REGEX needs to remain NON-Greedy or else it will eat into the actual snapshot. I might need to restrict the use of the A Few options:
In any case I think you will need to manually replace the "=" with something else unfortunately. |
'[', ']' and '=' are no longer allowed in snapshot names and scenario names. |
Seems a bit odd to add restrictions for names, and requiring people using this library to change how they name there snapshots because a the parser can't handle it? Even more so because this worked just fine before adding this feature. |
Note that this was a major version bump - 3.X to 4.X. There were many breaking changes in the 4.X release - especially for people using custom Serializers, Comparators & Reporters that go far beyond the above mechanical refactor. Breaking changes are commonly accepted in major version bumps as long as there is an upgrade path for existing users. In the end there were conflicting concerns. People using custom logic were not happy with how difficult it was to extract information about the snapshot from the raw string. The introduction of the REGEX gives structure to the snapshot and thus allows this information to be extracted. The introduction of "headers" allows further metadata to be injected into the snapshot for people using custom logic. I tended to agree that it was too difficult previously and these changes were necessary. Again - it's just a mechanical refactor "find & replace" for existing users to update to version 4.0. |
I think this restriction can be relaxed once encoding/decoding is implemented. That way you will be able to start using these characters again - the only difference is they will be escaped in the snapshot output. |
As seen here the name part of the regex is non-greedy, so it stops matching when it encounters the first
=
:java-snapshot-testing/java-snapshot-testing-core/src/main/java/au/com/origin/snapshots/Snapshot.java
Line 32 in 5330f07
We currently have snapshot names like:
Which worked fine on previous versions, but on v4 this is broken and our tests fail, which means this prevents us from upgrading to the latest version.
The text was updated successfully, but these errors were encountered: