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: spying on wrapper.vm for script setup methods using Vue 3.2.45 and VTU 2.2.2 stop working #1859

Closed
felixzapata opened this issue Nov 14, 2022 · 4 comments · Fixed by #1860
Labels
bug Something isn't working

Comments

@felixzapata
Copy link

Describe the bug

All the tests we have using explicit casting for wrapper.vm in order to spy methods stop working after updating to Vue 3.2.45 and VTU 2.2.2.

Related bugs:

To Reproduce

This is the minimal sample based on one of the failing tests. With the previous version, this test passes.

https://stackblitz.com/edit/vitest-dev-vitest-pcp793?file=components%2FHello.vue

Expected behavior

The test must be passed.

Related information:

System:
    OS: macOS 11.6.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 57.19 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
    Yarn: 3.2.3 - ~/.nvm/versions/node/v18.7.0/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
  Browsers:
    Chrome: 107.0.5304.110
    Chrome Canary: 110.0.5417.0
    Firefox: 106.0.5
    Safari: 15.5
    Safari Technology Preview: 15.4
  npmPackages:
    @intlify/core-base: 9.2.2 => 9.2.2 
    @intlify/unplugin-vue-i18n: 0.7.3 => 0.7.3 
    @vitejs/plugin-vue: 3.2.0 => 3.2.0 
    @vue/eslint-config-typescript: 11.0.2 => 11.0.2 
    @vue/test-utils: 2.2.2 => 2.2.2 
    @vue/tsconfig: 0.1.3 => 0.1.3 
    vite: 3.2.3 => 3.2.3 
    vitest: 0.25.1 => 0.25.1 
    vue: 3.2.45 => 3.2.45 
    vue-i18n: 9.2.2 => 9.2.2 
    vue-loader: 17.0.1 => 17.0.1 
    vue-router: 4.1.6 => 4.1.6 
    vue-tsc: 1.0.9 => 1.0.9

Additional context
NA

@felixzapata felixzapata 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#1859

The proxy needs to implement `defineProperty` to allow spying.
cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Nov 14, 2022
Fixes vuejs#1859

The proxy needs to implement `defineProperty` to allow spying.
@cexbrayat
Copy link
Member

👍 Thanks for the repro

This should be fixed by #1860

Vue changed its internal, and we now have to do a bit more work in VTU to allow the same feature than previously. You can stay on Vue v3.2.44 until this is released

@felixzapata
Copy link
Author

👍 Thanks for the repro

This should be fixed by #1860

Vue changed its internal, and we now have to do a bit more work in VTU to allow the same feature than previously. You can stay on Vue v3.2.44 until this is released

ok, just to confirm, Vue 3.2.44 and VTU 2.2.1, correct?

@cexbrayat
Copy link
Member

Exactly

@cexbrayat cexbrayat changed the title Bug: explicit cast for wrapper.vm using Vue 3.2.45 and VTU 2.2.2 stop working Bug: spying on wrapper.vm for script setup methods using Vue 3.2.45 and VTU 2.2.2 stop working Nov 14, 2022
cexbrayat added a commit that referenced this issue Nov 15, 2022
Fixes #1859

The proxy needs to implement `defineProperty` to allow spying.
@felixzapata
Copy link
Author

it works now, thanks.

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