vue-property-decorator icon indicating copy to clipboard operation
vue-property-decorator copied to clipboard

[Vue warn]: Injection "alertService" not found

Open felocru opened this issue 3 years ago • 1 comments

Hello.

I have version 8.4.2.

I am doing my tests with jest and one of my components makes use of InjectReactive and Inject. Whenever I run the test I have the always problem:

console.error
    [Vue warn]: Injection "alertService" not found
    
    found in
    
    ---> <ParticipantesComponent>
           <Root>

      at warn (node_modules/vue/dist/vue.runtime.common.dev.js:621:15)
      at resolveInject (node_modules/vue/dist/vue.runtime.common.dev.js:2471:11)
      at initInjections (node_modules/vue/dist/vue.runtime.common.dev.js:2423:16)
      at VueComponent.Vue._init (node_modules/vue/dist/vue.runtime.common.dev.js:4986:5)
      at new VueComponent (node_modules/vue/dist/vue.runtime.common.dev.js:5134:12)
      at createComponentInstanceForVnode (node_modules/vue/dist/vue.runtime.common.dev.js:3277:10)
      at init (node_modules/vue/dist/vue.runtime.common.dev.js:3108:45)

  console.error
    [Vue warn]: Injection "__reactiveInject__" not found

Test:

describe('Componente: Participantes', () => {
  let wrapper: Wrapper<ParticipanteClass>;
  let participante: ParticipanteClass;
  const localVue = createLocalVue();

  const i18n = config.initI18N(localVue);
  const store = config.initVueXStore(localVue);

  bootstrapVueConfig.initBootstrapVue(localVue);

  localVue.use(BootstrapVue);

  beforeEach(() => {
    wrapper = mount<ParticipanteClass>(Participante, {
      store,
      i18n,
      localVue,
      data() {
        return {
          isBusyPp: false,
        };
      },
    });

    participante = wrapper.vm;
  });

  it('Busca persona por CVU', () => {
    // const button = wrapper.find('b-button#agregar-participante-persona');
    const button = wrapper.findComponent(BButton);
    button.trigger('click');
  });
});

Could you help me. Thanks.

felocru avatar Jul 12 '21 21:07 felocru

Same here.

ig-onoffice-de avatar Jul 30 '21 14:07 ig-onoffice-de