Description
Describe the bug
I sometimes use the vm
property of a Wrapper to access global properties. This comes up most often in tests that use a real router, then make an assertion about vm.$route
. However, it seems that vm
does not provide access to global properties for Composition API components.
To Reproduce
In this repository, there are 4 variations on a component. A plugin adds a global property named foo
. For 2 of the components, vm.foo
is defined, but for the other 2, vm.foo
is not defined. This is what I see when I run tests:
✓ provides access to a global property from an Options API component
× provides access to a global property from a Composition API component
× provides access to a global property from an Options API component with a setup() function
✓ provides access to a global property from an Options API component with a setup() function that does not return
Expected behavior
It would be great to be able to access global properties from vm
for all components.
Related information:
npmPackages:
@vue/test-utils: ^2.4.1 => 2.4.1
vitest: ^0.33.0 => 0.33.0
vue: ^3.3.4 => 3.3.4
Additional context
Just to link issues, I think this issue may be related to #2008.