Why do tests with no asserts or expects pass? #5361
designermonkey
started this conversation in
General
Replies: 1 comment 6 replies
-
The test fails only if the function throws an error. An empty function doesn't throw an error. With this approach you can use any assertion library you like, or just throw an error manually if needed. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been doing unit testing for years in PHP and Java and if you define a test in those languages without asserting that something happened, the test fails. This is what I thought all unit testing frameworks did. Then I come to
vitest
.Can someone explain to me why, if I have a
test
in my file with nothing in it, it passes?Beta Was this translation helpful? Give feedback.
All reactions