the original example unit test in the app that I created with vue cli 4.5.8 doesn't work (typescript-jest)
Version
3.0.2
Reproduction link
https://github.com/alperkay/vue-3-default-unit-test-error
Steps to reproduce
-Make sure you have the latest vue cli which is 4.5.8 as of this writing.
-Run vue create example-app
-Select "Manually select features"
-Select Babel, Typescript, unit testing
-Select 3.x preview
-Select use class-style component syntax "yes"
-use Babel "yes"
-pick Jest for unit testing
Once the app is created, cd into the directory and run npm run test:unit
.
The sample test fails with the following error:
console.warn node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:40
[Vue warn]: Property "msg" was accessed during render but is not defined on instance.
at <Anonymous msg="new message" ref="VTU_COMPONENT" >
at <VTUROOT>
What is expected?
The unit test should recognize the prop being passed to the HelloWorld.vue component.
What is actually happening?
It doesn't detect / take into account the prop provided inside the example.spec.ts file. It fails with this error:
console.warn node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:40
[Vue warn]: Property "msg" was accessed during render but is not defined on instance.
at <Anonymous msg="new message" ref="VTU_COMPONENT" >
at <VTUROOT>
Please open the issue on the relevant repository like vue-class-component if this was already fixed in https://github.com/vuejs/vue-cli/issues/5974
Please open the issue on the relevant repository like vue-class-component if this was already fixed in vuejs/vue-cli#5974
You're totally right. I didn't realise that this was happening due to vue-class-component. I'll open the issue there. Thanks for noticing.