samedi 13 juin 2020

[Vue warn]: option "propsData" can only be used during instance creation with the `new` keyword. Vue unit testing

I have a test code like the following, and I am getting '[Vue warn]: option "propsData" can only be used during instance creation with the new keyword.' this error. I have never seen such an error in anywhere and I don't really get why I am getting this vue warn. No clue at all. The code that I am testing on did not throw any vue warn, but this test is throwing the error.

localVue.use(Bootstrap);

let wrapper: any;
describe("example test.vue", () => {
  it("example test", () => {
    const parent = shallowMount(parentItem, {
      localVue,
      propsData: {
        abc: 11233
      }
    });

    const parentVM = parent.vm;

    wrapper = mount(item, {
      localVue,
      propsData: {
        id: 2
      },
      parentComponent: parentVM.$options
    });

    expect(wrapper.name()).toMatch("item");

  });

Aucun commentaire:

Enregistrer un commentaire