-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat(amber): normalise line endings between os #377
Conversation
Codecov Report
@@ Coverage Diff @@
## master #377 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 19
Lines 992 1005 +13
=========================================
+ Hits 992 1005 +13 |
251a5cb
to
16091b1
Compare
1624bde
to
9adf5f9
Compare
After serializing, new line control characters are normalised. This is needed | ||
for interoperablity of snapshot matching between systems that do not use the | ||
same new line control characters. Example snapshots generated on windows os | ||
should not break when running the tests on a unix based system and vice versa. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth calling out as effectively snapshots will never show a control character mismatch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this, however it's a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm thinking since it's a breaking change how about we roll our own line end character for amber files; i.e. \r
and \n
get translated into ambr specific values e.g.
assert "a\rb\r\nc\nd" == snapshot
'
a␍
b␍
c
'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd then switch to byte mote for reading/writing the snapshots?
Carriage return vs. Newline doesn't happen too frequently, and I find it does make it a bit harder to read the raw snapshot file that way (mainly due to the introduction of "noise")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a wider sweeping change though, than currently where only a few files need be updated
4fcd31f
to
1f8ece6
Compare
After serializing, new line control characters are normalised. This is needed | ||
for interoperablity of snapshot matching between systems that do not use the | ||
same new line control characters. Example snapshots generated on windows os | ||
should not break when running the tests on a unix based system and vice versa. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this, however it's a breaking change.
Co-authored-by: Noah <noah.negin-ulster@tophatmonocle.com>
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Make sure to mark as a breaking change. Might also be worth adding a note to the readme explaining how line endings are handled?
# [0.8.0](v0.7.2...v0.8.0) (2020-10-27) ### Features * **amber:** normalise line endings between operating systems ([#377](#377)) ([82b624d](82b624d))
🎉 This PR is included in version 0.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Related Issues
Checklist
Additional Comments
Exposing the windows runner for debugging