-
Notifications
You must be signed in to change notification settings - Fork 632
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
BREAKING(testing/snapshot): change tab char serialization #3447
Conversation
testing/snapshot.ts
Outdated
@@ -204,7 +204,7 @@ export function serialize(actual: unknown): string { | |||
compact: false, | |||
iterableLimit: Infinity, | |||
strAbbreviateSize: Infinity, | |||
}).replace(/\\n/g, "\n"); | |||
}).replace(/\\n/g, "\n").replace(/\\t/g, "\t"); |
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 added option (escapeSequences
) for disabling the escape of this kind of chars in denoland/deno#19337. Let's use that option instead.
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.
Updated to use escapeSequences: false
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. Thanks for the initial idea!
Because of denoland/std#3447
Note that this change made it impossible for the same snapshot file to coexist on the old Deno and the new Deno... I worked around this by specifying a custom serializer, as shown in the link below. |
Because of the comment below, we cannot test features prior to Deno v1.34. denoland/std#3447 (comment)
Based on the Deno.inspect enhancements added in Deno 1.36, assertSnapshot has undergone a destructive change, so those supporting Deno 1.36 or earlier can only specify a custom serializer to ensure backward compatibility. denoland/std#3447 (comment)
Example test
Before
After