test-utils icon indicating copy to clipboard operation
test-utils copied to clipboard

No data on Option API component returned by mountSuspended

Open kingyue737 opened this issue 1 year ago • 3 comments

Environment


  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-ddvycp

Describe the bug

const wrapper = await mountSuspended(OptionAPIComponent)

wrapper.vm.$data is empty wrapper.setData({...data}) will result into error:

TypeError: Cannot add property, object is not extensible

Furthermore, I cannot call any method of the component instance:

TypeError: wrapper.vm.myMethod is not a function

Additional context

Component written in composition api doesn't have this issue. @vue/test-utils doesn't have this issue.

Logs

No response

kingyue737 avatar Jan 25 '24 06:01 kingyue737