Not working with Vue 3.0.3 and latest <script setup>
See original GitHub issueRelated: https://github.com/vuejs/vue-jest/issues/304
Seems 3.0.3 breaks test utils. The return value either here and here are different to normal.
I am not sure if we should fix this right now, or wait for the <script setup>
to stop been so experimental. It’s important to let people try the latest features, but I am not sure <script setup>
is meant for production yet - thoughts?
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Not working with Vue 3.0.3 and latest <script setup> · Issue #263
new <script setup> introduced in 3.0.3. It breaks things. Using vue@3.0.2 and the same version of compiler-sfc with this component works:.
Read more >Vue <script setup> Top level await causing template not to ...
The problem is, that if I have this top level await, my template doesn't render anymore, it's just a blank page in my...
Read more >Script Setup RFC for Vue 3.0.3 - YouTube
I try out and share my thoughts on the new script setup RFC as for Vue 3.0.3. Link to RFC: https://github.com/ vuejs /rfcs/pull/227Note:...
Read more >Explaining The New script setup Type in Vue 3 - LearnVue
If you've been working in Vite and Vue 3 recently, you'll notice that when you start a new project, your script section looks...
Read more >Quick Start - Vue.js
This command will install and execute create-vue, the official Vue project scaffolding tool. You will be presented with prompts for several optional features ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You are definitely not the first person to try this: https://github.com/vuejs/vue-test-utils-next/issues/435
Slight tangent, it feels like a bit of a code smell if you need to
expose
internals for testing - you cannot make an assertion based on the DOM state?I am not really a fan of the “closed by default” behavior. Well, I am, but I don’t like how it’s different to regular component. I think they should be consistent.
I posted about this in the RFC for script setup. You can follow there if you are interested.
@lmiller1990 Yes, it does. All my components template works great, I just cannot access anything from script.
Ok so I guess I’m using
expect()
with<script setup>
wrong? Now trying to find way to expose it, sinceexpose()
from RFC is not implemented yet I think. Some workaround is needed for vue-test-utils, and I just hope it already exists because I do not believe that I’m first person doing this 😉expect(wrapper.vm.demo).toHaveBeenCalled()
It of course works fine without setup.
P.S Thanks for that fast reply!