One of the thing I like in Nuxt is not having to include all used components. But this is not working with Jest.
I started from the default nuxt app with jest. I added a custom element in 'Logo.Vue' like this :
<template>
<div class="VueToNuxtLogo">
<MyComponent />
</div>
</template>
I added the component file 'MyComponent.vue':
<template>
<span>My great component<span>
</template>
When I run the app, I can see MyComponent.
But the 'Logo.spec.js' test return this error : [Vue warn]: Unknown custom element: <MyComponent> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
If I include the component like this, test is OK.
import MyComponent from './MyComponent'
export default {
components: { MyComponent }
}
Is there any way to automatically import components using Jest like Nuxt do ?