insta
insta copied to clipboard
Trailing whitespace in testcases is ignored for diffs
What happened?
I created test snapshots with excessive newlines. This was then corrected later, but there was no error or reported diff due to the now missing newlines at the end.
Reproduction steps
- assert a snapshot with a lot of newlines at the end
- update the value and remove the newlines
- no error/diff is reported
Insta Version
1.29
rustc Version
1.70
What did you expect?
I expected newlines changes to be reported, as this is for a CLI application, the trailing whitespaces are important.
That's unfortunately a limitation. I think one way to work with this would be to have users that need whitespace handling to add markers around it that make this more explicit.
Why is it a Limitation if you don’t mind me asking?
@TheNeikos it's a natural effect of how the indentation clean up system functions.
@TheNeikos it's a natural effect of how the indentation clean up system functions.
Hm, since the newlines in this case are trailing, why would indentation (which usually comes before non-whitespace characters) interact with those?
The code that cleans up indentation cannot disambiguate these cases.