-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using createError in component causes false positives and VITEST_AFTER_ENV_TEARDOWN unhandled error #3376
Comments
Did you try updating Vitest first? |
This issue was fixed in 0.30.0. |
Well don't I feel like a plonker, thank you for the response. :) Out of curiosity, could you help me find the initial issue that was raised about this? I'm going to look at the changelog now for validation. I feel like I googled everything about this and couldn't find any evidence of it already being fixed in another version so I appreciate the help. |
It was fixed without an open issue as part of #3103 |
Upgrading the version seems to have worked but I'm now seeing a different error message for what appears to be the same issue. As before, commenting out I've updated my tests to reflect the new version so they now make use of |
Hello @Katie-Adams. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
I have no idea how to run Nuxt components, so I would need a runnable reproduction. In stackblitz or github repo. |
I'll do my best to get one spun up now, thanks |
@sheremet-va |
Describe the bug
We're running a Nuxt 3 app and using Vitest with vue-test-utils to create unit tests. Up until now, no problems.
The tests I'm currently writing should catch if there's an issue with an ID we're seeking and, if so, redirect the app to our 404 page. We achieve this using the
createError
function provided by Nuxt.By all accounts the test I've written should - and does - pass. However, when I run the test, I get the below error message:
TypeError: Cannot set properties of undefined (setting 'VITEST_AFTER_ENV_TEARDOWN')
I can't fathom how to fix this error; the problem seems related to the
createError
function used in my Nuxt app, because when it is commented out, the test passes without the unhandled error.Reproduction
Nuxt 3 component, examples of where the createError is used
Test that cause the error
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: