-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
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
// passes
it("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"');
});System Info
System:
OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900H
Memory: 23.12 GB / 31.19 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
Browsers:
Chrome: 111.0.5563.110
npmPackages:
@vitejs/plugin-vue: ^3.1.2 => 3.2.0
@vitejs/plugin-vue-jsx: ^1.3.9 => 1.3.10
@vitest/coverage-c8: ^0.29.2 => 0.29.2
vite: ^3.1.8 => 3.2.5
vitest: ^0.29.2 => 0.29.2 Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Type
Projects
Status
No status