-
Notifications
You must be signed in to change notification settings - Fork 23
Use Vue Test Utils to manage options like scoped slots and option normalizaiton #365
Conversation
…n components. It was being covered up by rendering the component as the Root Vue Component
A lot of issues covered up by some silent error handlers: unregistered components + mounting options using "data" as object literals instead of functions were the big ones. I added We have a lot of work to do regarding typing, but at least the API will look a bit more like Native Vue 😸 |
} | ||
beforeEach(mountCallback({ template, data }, { extensions })) | ||
|
||
it('registers global component', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a feature we should offer because it pollutes Vue state
…unit-test into jess/root-vue-node
The failing test fails locally with command
|
const component = { template, data } | ||
const component = { | ||
template, | ||
data() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so during the test, what if we check the .data
property and if it is an object, automatically make it into a function? Otherwise, this is a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is all good, I am worried about data: {}
to data: () => {}
change, I think we could make it convenient and transform it on the fly during mount
I know this is a breaking change, but it was a bug that was flying under the radar because we weren't failing the tests due to Vue runtime errors. If you try to mount a component with https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function Testing a Root Vue instance is separate from testing a Vue Component. I don't want to add it as a convenience because it has a very specific meaning for Vue components. |
Thank you for getting this passing :-) |
Weird, it seems that there's issues with the yarn registry. |
🎉 This PR is included in version 3.4.4 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
…malizaiton (cypress-io/cypress-vue-unit-test#365) * Use Vue Test Utils to manage options like scoped slots and option normalization * using createLocalVue to ensure global Vue namespace doesn't bleed over * fix: spec was demonstrating using data as an object, which is a bug in components. It was being covered up by rendering the component as the Root Vue Component * chore: cleaning up spec * fix: data should be a function, i18n plugin was throwing error * fix: plugins not passing options through. i18n spec artifically slow * Update src/index.ts * fix: ...localVue => localVue * update mixins test * enable slot AppInput spec * add full slots and scopedSlots test * Update src/index.ts Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
The typings here are really bad, but this should solve scopedSlots, slots, etc. We also get stubbing for free :-)
Likely we can also remove the plugin installation code.
This still needs a scopedSlot test to exercise that it's working.
closes #364