Describe the bug
Problem
In Vitest 3, the toThrow / toThrowError matcher now compares both the error instance and its properties. However, if the error instance and the error message are the same, but some random property differs, the extension reports a failure without showing the diff. Instead, I have to manually log the error object to understand what’s different.
Suggested Improvement
It would be very helpful if the diff view could also display the additional properties of the error instance, so the mismatch is immediately visible in the test output
Benefit
Including the additional properties in the diff would make debugging faster and reduce the need for manual logging.
🙏 Thanks for considering this improvement and making this great extension!
Reproduction
expect(() => {
throw Object.assign(new Error("Something went wrong"), { code: 123 });
}).toThrow(new Error("Something went wrong"));
// fails, but the diff does not show the extra `code` property
became
Output
No visible diff in the UI (see the screenshot above)
Extension Version
1.28.2
Vitest Version
3.2.4
Validations
Describe the bug
Problem
In Vitest 3, the
toThrow/toThrowErrormatcher now compares both the error instance and its properties. However, if the error instance and the error message are the same, but some random property differs, the extension reports a failure without showing the diff. Instead, I have to manually log the error object to understand what’s different.Suggested Improvement
It would be very helpful if the diff view could also display the additional properties of the error instance, so the mismatch is immediately visible in the test output
Benefit
Including the additional properties in the diff would make debugging faster and reduce the need for manual logging.
🙏 Thanks for considering this improvement and making this great extension!
Reproduction
became
Output
No visible diff in the UI (see the screenshot above)Extension Version
1.28.2
Vitest Version
3.2.4
Validations