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

the original example unit test in the app that I created with vue cli 4.5.8 doesn't work (typescript-jest) #2473

Closed
alperkay opened this issue Oct 23, 2020 · 2 comments

Comments

@alperkay
Copy link

alperkay commented Oct 23, 2020

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>
@posva
Copy link
Member

posva commented Oct 23, 2020

Please open the issue on the relevant repository like vue-class-component if this was already fixed in vuejs/vue-cli#5974

@posva posva closed this as completed Oct 23, 2020
@alperkay
Copy link
Author

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.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants