-
Notifications
You must be signed in to change notification settings - Fork 79
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
nuxt server environment support #531
Comments
Thanks for opening this issue. There are probably cases, such as using It seems that I can't do this in simple unit tests even for those tests which are not running this Nuxt environment once the plugin is installed. |
Nuxt hard codes |
I see, thanks for the clarification |
as a work around for my apicalls / nitro plugins i added all auto imported server stuff to my setup.ts as vitest.stubGlobal("defineEventHandler", (func: any) => func);
vitest.stubGlobal("defineNitroPlugin", (e: any) => e);
//etc Which works absolutely fine for the time being, if anyone has a better idea/way i'd love to know! I mock my own utilities the same way and then use them in unit tests like this (getService as MockedFunction<typeof getService>).mockReturnValue(
{mockedServiceCall: () => true}
); |
We currently support running composables/components in a browser-type environment (with happy-dom, and soon jsdom). But there are use cases where it might be useful to support running tests in a hybrid server environment where things like h3 utilities and nuxt ssr utilities work.
This could definitely be classed as non-essential and experimental, but we can track it here.
The text was updated successfully, but these errors were encountered: