Unit/Jest test with bootstrap vue Fail

153 Views Asked by At

I got this error when I try to run a test on bootstrap vue components:
"ReferenceError: BootstrapVue is not defined" In the .spec.js file I added this:

  import TableSummary from "@/components/TableSummary";
  import { createLocalVue, mount } from "@vue/test-utils";

   const localVue = createLocalVue();

   localVue.use(BootstrapVue);

   describe('TableSummary', ()=> {
     test('if the user is typing, the button becomes enabled', async ()=> {
       const wrapper = mount(TableSummary, { localVue });
       wrapper.setData({isDisabled: true});
       await wrapper.vm.$nextTick;
       expect(wrapper.find('input').state.isDisabled).toBe(false);
     });
   });

I ran the same instructions as a correct answer here on stack overflow but still, it doesn't work for me... I couldn't comment on the answer as I am not level 50, and I had to open a new question.

1

There are 1 best solutions below

2
On

I think you need to import the BootstrapVue

import BootstrapVue from 'bootstrap-vue'