Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

isVueInstance is deprecated and will be removed in future releases

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

like image 653
MaynorSong Avatar asked May 09 '20 01:05

MaynorSong


People also ask

Is Vue instance is deprecated?

isVueInstance is deprecated and will be removed in future releases.

What is wrapper VM?

A Wrapper is an object that contains a mounted component or vnode and methods to test the component or vnode.

What is VM in Vue?

A Vue instance is essentially a ViewModel as defined in the MVVM pattern, hence the variable name vm you will see throughout the docs. When you instantiate a Vue instance, you need to pass in an options object which can contain options for data, template, element to mount on, methods, lifecycle callbacks and more.


1 Answers

Here's how to rigorously check VueInstance

https://github.com/vuejs/vue-test-utils/blob/2d6b49780c7e1d663b877ddf5d6492ed7b510379/packages/test-utils/src/wrapper.js#L400

it('is instantiated', () => {
    expect(wrapper.vm).toBeTruthy();
});
like image 93
Ikuo Saito Avatar answered Oct 07 '22 01:10

Ikuo Saito