You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{createLocalVue,mount}from'@vue/test-utils';importAppTogglefrom'./toggle.vue';constlocalVue=createLocalVue();describe('Toggle',()=>{it('should toggle the slots',async()=>{constwrapper=mount(AppToggle,{ localVue });expect(wrapper.vm.toggle).toBeTruthy();// vm.toggle is undefinedwrapper.vm.toggleSlots();// vm.toggleSlots is undefinedexpect(wrapper.vm.toggle).toBeFalsy();});});
If I write the component using the options API, test test passes, but with the composition API the test fails because the variables and functions are not defined on wrapper.vm. How can I access the variables and functions?
The text was updated successfully, but these errors were encountered:
Hi there, we're experiencing the same issue. Also not sure whether it is an issue with vue2-jest or with vue. We're using Vue 2.7.14, vue2-jest v27.0.0. Would be glad for any help too!
Hi all,
This may be a Vue issue and not Jest specific so let me know if that's the case but I thought I'd try asking here.
I'm updating a project to Vue 2.7 and I wanted to test the composition API. I created the following component:
and I wrote the following test:
If I write the component using the options API, test test passes, but with the composition API the test fails because the variables and functions are not defined on
wrapper.vm
. How can I access the variables and functions?The text was updated successfully, but these errors were encountered: