Replies: 6 comments 11 replies
-
You did not follow this. Your function is async. It needs |
Beta Was this translation helpful? Give feedback.
-
|
Vitest caught 14 unhandled errors during the test run. |
Beta Was this translation helpful? Give feedback.
-
|
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.
-
|
I'm getting this randomly (but very frequently) when I use |
Beta Was this translation helpful? Give feedback.
-
|
I realise it's an old post, but if someone else finds this place and has the same error you could have the same issue as I did. My tests ran fine in terminal where I explicitly set the correct node version. But my system default was different, so when I ran tests through the vscode extension vitest I got the same error "Vitest caught 1 unhandled error during the test run". Hopefully this might help someone in the future :) Background: |
Beta Was this translation helpful? Give feedback.
-
|
For me it was some kind of strange memory leak over time. Found it via logHeapUsage: true, Ended up fixing via switching 'vmForks' to straight up 'forks'. tests take 3x as long now but at least they're totally isolated from each other and work now lol |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a function which I try to test using Vitest.
This is my function (I test the exported one):
And this is the
asyncExecfunction: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
getStagedFilesDifffunction 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