Replies: 3 comments 9 replies
-
You did not follow this. Your function is async. It needs |
Beta Was this translation helpful? Give feedback.
5 replies
-
Vitest caught 14 unhandled errors during the test run. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Is there any way to catch what throws this error? Pretty hard to pinpoint it in large codebase. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a function which I try to test using Vitest.
This is my function (I test the exported one):
And this is the
asyncExec
function:I wrote the following test:
But then I got the error:
I have followed this: https://vitest.dev/api/expect.html#tothrowerror
So I don't understand why doesn't it work..?
I tried the following also:
But got the error:
AssertionError: expected [Function] to throw an error
.Then I wrapped the
getStagedFilesDiff
function withtry {} catch {}
as follows:Then the test completed successfully (when using the previous test code, not the original one - first one).
Beta Was this translation helpful? Give feedback.
All reactions