-
Notifications
You must be signed in to change notification settings - Fork 278
Description
Describe the bug
When testing a component that calls setData with a non-primitive class/object, the object gets set into the component VM without the prototype properties which breaks what should be a straightforward test. If you set the data property on the VM property directly with wrapper.vm.foo = bar it works as expected.
To Reproduce
Made a very basic example that illustrates the bug relating to the mergeDeep behaviour when calling setData
https://stackblitz.com/edit/vue3-script-setup-with-vite-prcxxz?file=src%2Fcomponents%2FHelloWorld.spec.ts,src%2Fcomponents%2FMyObject.js,src%2Fcomponents%2FHelloWorld.vue,src%2FApp.vue
Expected behavior
I expect that calling setData will simply set the property on the component's VM without modification.
Related information:
@vue/test-utilsversion: 2.0.0Vueversion: 3.2.37nodeversion: 16.15.0npm(oryarn) version: 8.10.0
I can see a fix was applied specifically for Date objects but feel the real problem isn't solved.