Skip to content
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

fix: escape $ characters in inline snapshots (fix #597) #599

Merged
merged 2 commits into from
Jan 21, 2022

Conversation

Demivan
Copy link
Member

@Demivan Demivan commented Jan 21, 2022

Fixes #597

@netlify
Copy link

netlify bot commented Jan 21, 2022

✔️ Deploy Preview for vitest-dev ready!

🔨 Explore the source changes: 5c125b8

🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/61eb0f94f87e7b000778d409

😎 Browse the preview: https://deploy-preview-599--vitest-dev.netlify.app

Copy link
Member

@edimitchel edimitchel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test?

@antfu antfu merged commit cba243c into vitest-dev:main Jan 21, 2022
@@ -37,6 +37,15 @@ test('inline snapshot', () => {
.filter(fn)
"
`)
const literal = `
Hello \${world}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Hello \${world}
Hello ${world}

No?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emm why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the thing we need to be escape ?
If we escape already on the Arrange step, this test won't be very significant, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would not test this bug anyway. Bug only affected generating inline snapshot, not comparing with it.
Will create test today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also spaces on each line are trimmed when comparing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline snapshot does not escape string enough
4 participants