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

Inline snapshot escapes character ($) even though it's not necessary #1389

Closed
6 tasks done
jonasb opened this issue May 28, 2022 · 0 comments · Fixed by #1401
Closed
6 tasks done

Inline snapshot escapes character ($) even though it's not necessary #1389

jonasb opened this issue May 28, 2022 · 0 comments · Fixed by #1401

Comments

@jonasb
Copy link

jonasb commented May 28, 2022

Describe the bug

If a string in the inline snapshot includes the character $ it's escaped with a backslash in the output (\$) even though it's not needed. This causes eslint to complain.

Reproduction

https://stackblitz.com/edit/vitejs-vite-gswmr2?file=src/test.test.ts

import { test, expect } from 'vitest';

test('hello', () => {
  // when run, this string will be added to the inline snapshot: '"string with \$ character"'
  expect('string with $ character').toMatchInlineSnapshot();
});

System Info

System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 93.66 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 102.0.5005.61
    Firefox: 100.0.2
    Safari: 15.4
  npmPackages:
    vitest: ~0.12.9 => 0.12.9

Used Package Manager

npm

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants