Version
1.0.4
Reproduction link
https://github.com/saifahn/composition-api-context-store-undefined-vtu
Steps to reproduce
- Run the test suite via
npm run test:unit
You will see the error.
What is expected?
- Ideally vue-test-utils be able to handle this and provide the store to the context of the Composition API components.
- context.root.$store should return the store provided in the tests rather than undefined.
What is actually happening?
context.root.$store returns undefined, so tests involving components that use context.root.$store will fail.
- The component itself is functional, so it looks like a problem with vtu, unless I am mistaken.
I have seen people with similar problems using context.root.$router as well.
Here's one:
https://forum.vuejs.org/t/vue-composition-api-vue-router-unit-test/88702