-
Notifications
You must be signed in to change notification settings - Fork 316
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
Mitigate linebreak issues in snapshot tests #1937
Comments
The problem is the line breaks are calculated before the There isn't much we can do about this, other than set
to get rid of the line breaks. In short, if you use cli and In theory
|
AHA! I have not come across that in the docs I've been reading, so either that's user error or something else that should be documented. |
You could also do |
Are you saying that |
Yes, it sets both. |
I periodically struggle with linebreak differences in snapshot tests and I've seen it come up in Slack a few times. Highlights of the situation:
local_reproducible_output()
was supposed to design this away".expect_snapshot(transform =)
to replace, e.g. a volatile filepath (as is true above). @gaborcsardi indicates that one factor here is that the wrapping is done before thetransform
function is applied. Now that I think about it, at least in the cli case, I can see why it's this way.cli.width
instead of justwidth
.Various ideas that might help:
expect_snapshot(transform =)
is prone to creating linebreak problems and is best used in combination with explicit width setting. Make it wide folks!expect_snapshot()
get smarter aboutwidth
or gain awidth
argument?width
vs.cli.width
, but I feel like there's something here.The text was updated successfully, but these errors were encountered: