Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: wrapper.vm does not contain props when using script setup syntax with Vue 3.2.45 and VTU 2.2.2 #1863

Closed
misaacs21 opened this issue Nov 14, 2022 · 1 comment · Fixed by #1864
Labels
bug Something isn't working

Comments

@misaacs21
Copy link

Describe the bug
When upgrading to Vue 3.2.45 and VTU 2.2.2, wrapper props are not available via wrapper.vm as they used to be, and all return undefined when accessed. They are available on wrapper.vm.$.props, however.

To Reproduce
Reproduction: https://stackblitz.com/edit/vitest-dev-vitest-unycdj?file=test/basic.test.js
This same setup passes on previous versions.

Expected behavior
Props should be accessible via wrapper.vm when using script setup as they were in previous versions, and tests in the reproduction should pass.

Related information:

  • @vue/test-utils version: 2.2.2
  • Vue version: 3.2.45
  • node version: 16.14.2
  • npm version: 7.17.0
@misaacs21 misaacs21 added the bug Something isn't working label Nov 14, 2022
cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Nov 14, 2022
Fixes vuejs#1863

It turns out `vm` is not enough, and we need to proxy to `vm.$.ctx` which contains the props as well.
cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Nov 14, 2022
Fixes vuejs#1863

It turns out `vm` is not enough, and we need to proxy to `vm.$.ctx` which contains the props as well.
cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Nov 14, 2022
Fixes vuejs#1863

It turns out `vm` is not enough, and we need to proxy to `vm.$.ctx` which contains the props as well.
@cexbrayat
Copy link
Member

@misaacs21 Thanks for the repro 👍

I think I have a fix for this, see #1864

cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Nov 15, 2022
Fixes vuejs#1863

It turns out `vm` is not enough, and we need to proxy to `vm.$.ctx` which contains the props as well.
cexbrayat added a commit that referenced this issue Nov 15, 2022
Fixes #1863

It turns out `vm` is not enough, and we need to proxy to `vm.$.ctx` which contains the props as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants