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{shallowMount}from"@vue/test-utils";importAppfrom"@/App.vue";importAppScriptSetupfrom"@/AppScriptSetup.vue";describe("App.vue",()=>{it("renders the App",()=>{constmsg="new message";constwrapper=shallowMount(App);expect(wrapper.text()).toBe(msg);// This works as expected });});describe("AppScriptSetup.vue",()=>{it("renders the AppScriptSetup",()=>{constmsg="new message";constwrapper=shallowMount(AppScriptSetup);expect(wrapper.text()).toBe(msg);// This fails with the error: [Vue warn]: Property or method "msg" is not defined on the instance but referenced during render.});});
Subject of the issue
When using [email protected] with [email protected], I'm not able to test SFC components made with script setup syntactic sugar.
Steps to reproduce
yarn install [email protected]
script setup
syntactic sugarExpected behaviour
It should pass the simple test.
Actual behaviour
Open a terminal and run
yarn test:unit
at https://codesandbox.io/p/github/arthurrmp/vue-2-script-setup-test-utils to see it live.The same code works as intended using Vue 3, as seen at https://codesandbox.io/p/github/arthurrmp/vue-3-script-setup-test-utils
Possible Solution
I've not been able to find any alternatives.
The text was updated successfully, but these errors were encountered: