isVueInstance is deprecated and will be removed in future releases

Viewed 4885

I am new with JEST and have received the above warning. I want to know which is the alternative since is being deprecated.

Here is the test that I am making:

it('is instantiated', () => {
expect(wrapper.isVueInstance()).toBeTruthy();

});

enter image description here

3 Answers

The right answer should be the following:

it('is instantiated', () => {
    expect(wrapper.exists()).toBeTruthy();
});

From test/specs/wrapper/find.spec.js in vue-test-utils repository, you can see that when wrapper doesnt exists they assert Wrapper object with exists().

  it('returns empty Wrapper with error if no nodes are found', () => {
    const wrapper = mountingMethod(Component)
    const selector = 'pre'
    const error = wrapper.find(selector)
    expect(error.exists()).toEqual(false)
    expect(error.selector).toEqual(selector)
  })
Related