dimanche 4 août 2019

Can I completely ignore child components when testing Vue?

I'm using BootstrapVue. I have a component. It has a few child components. One of the child components uses b-modal.

I have been attempting to get components with Bootstrap b-modal for ages now with no luck - any parent component that has a child component that uses b-modal gives me the following error:

node_modules/bootstrap-vue/es/components/modal/modal.js:3
import bBtn from '../button/button';
       ^^^^

SyntaxError: Unexpected identifier

I have tried many different ways to import these components into my test file, including:

import BootstrapVue from 'bootstrap-vue';
import bModal from 'bootstrap-vue/es/components/modal/modal';
import BButton from 'bootstrap-vue/es/components/button/button'; 
import bBtn from 'bootstrap-vue/es/components/button/button'; 
import bButton from 'bootstrap-vue/es/components/button/button'; 

But it doesn't seem to matter how I import this component, it just cannot be found. I've tried stubbing the child components that use this bButton component, as well as the button component itself. No luck,

So can I add something to my shallowMount that would 100% ignore the child component?

Aucun commentaire:

Enregistrer un commentaire