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
Component Testing - Option for loading plugins and modules in NuxtJS #22518
Comments
has anyone cracked this? |
Can anyone investigate this topic? |
+1 |
Bump! I'm having the same issue where @nuxtjs/i18n isn't loaded which messes up components that use translations |
Bump! I also have the same problem with a nuxt 2 project that is using
|
Me too! |
+1 here. Trying to install cypress on an existing project with multiple plugins. |
+1 there. Realy need this function |
+1 |
I wanna to share example of my code I use vuetify, axios and event bus
|
What would you like?
For now, component testing in cypress doesn't load up plugins and modules listed in
nuxt.config.js
file when used with NuxtJS framework.It will be nice to have an option to include NuxtJS plugin or module inside tests.
There is a way to load "pure Vue" plugins in
@cypress/vue
package, but NuxtJS modules and plugins have different interface and approach.So we need dedicated option for loading extensions made for NuxtJS.
Why is this needed?
Most of components in my project depend on many different modules imported into NuxtJS in
nuxt.config.js
.For example, my component uses dayjs from this module: https://www.npmjs.com/package/@nuxtjs/dayjs. For now component testing throws errors because of undefined
this.$dayjs
.Another example: almost every of my component contains at least one child component from Vuetify module (https://www.npmjs.com/package/@nuxtjs/vuetify). Now in each test, part of HTML template is not rendered due to missing components from the Vuetify module. I use nearly all of them, so mocking almost the entire library seems hard and impossible to maintain.
Some of NuxtJS modules/plugins has their equivalents in "pure Vue" (and can be used as a normal plugin inside
@cypress/vue
, but this sometimes requires installing a separate package just for testing purposes). But there are some extensions that are made especially for Nuxt, and we will have to do some odd hacky workarounds (that are sometimes almost impossible without forking and exporting some stuff outside the module).Anyway, if cypress have an option to select Nuxt as a framework inside Component Testing settings, I will expect that as basic stuff as plugins and modules in Nuxt will work without any advanced hacks and workarounds.
Other
Steps to reproduction:
The text was updated successfully, but these errors were encountered: