You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a failing test using .not.toThrowErrorMatchingInlineSnapshot() to demonstrate to my colleague the error that they have to address.
However, when they fixed the error - the test still doesn't pass, because vitest returns Error: snapshot function didn't throw for this test.
I expect .not.toThrowErrorMatchingInlineSnapshot() to assert that error was either not thrown, or it was thrown but didn't match the snapshot.
Current behaviour is more like expect().toTrowError.not.matchingInlineSnapshot(), hope this makes sense!
// passesit("throws",()=>{expect(()=>{throw"Bla-bla";}).toThrowErrorMatchingInlineSnapshot('"Bla-bla"');});// fails with `Error: snapshot function didn't throw`it("doesn't throw",()=>{expect(()=>{}).not.toThrowErrorMatchingInlineSnapshot('"Bla-bla"');});
The text was updated successfully, but these errors were encountered:
Maxim-Mazurok
changed the title
.not.toThrowErrorMatchingInlineSnapshot() doesn't work
.not.toThrowErrorMatchingInlineSnapshot() doesn't work as expected
Mar 28, 2023
After rereading this, I am not sure it makes sense to support "not" operator. What string should it generate then? Just anything except the current value?
Describe the bug
I created a failing test using
.not.toThrowErrorMatchingInlineSnapshot()
to demonstrate to my colleague the error that they have to address.However, when they fixed the error - the test still doesn't pass, because vitest returns
Error: snapshot function didn't throw
for this test.I expect
.not.toThrowErrorMatchingInlineSnapshot()
to assert that error was either not thrown, or it was thrown but didn't match the snapshot.Current behaviour is more like
expect().toTrowError.not.matchingInlineSnapshot()
, hope this makes sense!Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-cmmyai?file=test/basic.test.ts
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: