Odd behavior with toThrowErrorMatchingInlineSnapshot
with multiline error message
#4662
Closed
6 tasks done
Labels
Describe the bug
While updating to vitest v1 on my project hi-ogawa/js-utils#185 (comment), I noticed that the snapshot generated by
toThrowErrorMatchingInlineSnapshot
for multiline error message becomes mismatch on next run.Here is a repro https://stackblitz.com/edit/vitest-dev-vitest-fmwjqc?file=test%2Fbasic.test.ts and the failing snapshot is following:
I added similar cases in the repro. Interestingly I found that directly taking a snapshot
Error
instance viatoMatchInlineSnapshot
seems to be okay:It's most likely that #4396 introduced this issue, so hopefully I can figure it out myself, but if maintainers have some idea to fix (or intend to revert the PR?), then I'm happy with that as well.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-fmwjqc?file=test%2Fbasic.test.ts
npm run test:ui
u
shortcut<Enter>
I also made a repro with v1.0.0-beta.3 which is the last version before #4396 and there's no issue with this version:
https://stackblitz.com/edit/vitest-dev-vitest-tkskse?file=test%2Frepro.test.ts
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: