vitest
vitest copied to clipboard
`toMatchInlineSnapshot` doesn't work with template literal tags, again
Describe the bug
I got used to behavior is that pressing u
does nothing most of the time. The most annoying thing is that it's always saying that snapshot is successfully updated, even if it doesn't for some reason :(
So now I encountered behavior where vitests doesn't update even with -u flag.
It should've been fixed previously https://github.com/vitest-dev/vitest/issues/723
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-hwjahu?file=test%2Fsuite.test.ts,package.json&initialPath=vitest
But the example object can be simplified.
System Info
System:
OS: Linux 5.0 undefined
CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
vitest: 0.23.2 => 0.23.2
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Yeah, Vitest has this RegExp to detect snapshots:
https://github.com/vitest-dev/vitest/blob/95da4d66933db46da368d5d66f422afd26fba4c1/packages/vitest/src/integrations/snapshot/port/inlineSnapshot.ts#L74
So, if you add a comment it doesn't work. PR welcome.
@sheremet-va thanks! I'll take into whats happened with previous regexp.
BUT why does Vitest tell me that snapshot was successfully updated, when it wasn't? Isn't that misleading? I was already discussing that before, that it shouldn't show all-green and then red on next run without -u.
BUT why does Vitest tell me that snapshot was successfully updated, when it wasn't? Isn't that misleading? I was already discussing that before, that it shouldn't show all-green and then red on next run without -u.
It didn't detect any snapshots actually, so it just showed you default message. I am not against "no snapshots found" message in this case. And show a number of updated snapshots, if there are updated snapshots.
Hey @sheremet-va, is this issue still open? If so, can I work on it?
Hey @sheremet-va, is this issue still open? If so, can I work on it?
No, I think it was fixed, but we forgot to close the issue since it's not linked automatically