Describe the bug
Rendered snapshots have a double quote " added immediately after the first ` (or ' for inline snapshots, which feels wrong too?).
This occurs with no UI framework at all, as well as with Vue 3, using composition API and script setup. I haven't tested other frameworks but since it happens without an it probably happens with all of them.
This causes all snapshots to be escaped with \\ everywhere making them much harder to read and compare.
Reproduced here: https://stackblitz.com/edit/vitejs-vite-pdqfzn
Reproduction
- Install vite
npm create vite@latest
- Add a test that will render snapshots:
import { test, it, describe, expect } from 'vitest';
describe('App', () => {
it('should render the html inline', () => {
expect(`<div class="test">Hello World</div>`).toMatchInlineSnapshot(
'"<div class=\\"test\\">Hello World</div>"'
);
});
it('should render the html in a snapshot file', () => {
expect(`<div class="test">Hello World</div>`).toMatchSnapshot();
});
});
=> snapshots are rended with \\ everywhere to escape quotes.
System Info
System:
OS: Linux 5.4 Amazon Linux 2
CPU: (16) x64 Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
Memory: 18.33 GB / 62.79 GB
Container: Yes
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
Browsers:
Firefox: support!
Mozilla Firefox 78.11.0esr
npmPackages:
@vitejs/plugin-vue: ^2.1.0 => 2.1.0
vite: ^2.7.13 => 2.7.13
vitest: ^0.5.3 => 0.5.3
Used Package Manager
npm
Validations
Describe the bug
Rendered snapshots have a double quote
"added immediately after the first`(or'for inline snapshots, which feels wrong too?).This occurs with no UI framework at all, as well as with Vue 3, using composition API and
script setup. I haven't tested other frameworks but since it happens without an it probably happens with all of them.This causes all snapshots to be escaped with
\\everywhere making them much harder to read and compare.Reproduced here: https://stackblitz.com/edit/vitejs-vite-pdqfzn
Reproduction
npm create vite@latest=> snapshots are rended with
\\everywhere to escape quotes.System Info
System: OS: Linux 5.4 Amazon Linux 2 CPU: (16) x64 Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz Memory: 18.33 GB / 62.79 GB Container: Yes Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm Browsers: Firefox: support! Mozilla Firefox 78.11.0esr npmPackages: @vitejs/plugin-vue: ^2.1.0 => 2.1.0 vite: ^2.7.13 => 2.7.13 vitest: ^0.5.3 => 0.5.3Used Package Manager
npm
Validations