-
Notifications
You must be signed in to change notification settings - Fork 258
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
test: Add tests for shallowMount issue with dynamic components #1312
test: Add tests for shallowMount issue with dynamic components #1312
Conversation
✔️ Deploy Preview for vue-test-utils-docs ready! 🔨 Explore the source changes: eeaaf1e 🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-test-utils-docs/deploys/620cd8afa772250007adff95 😎 Browse the preview: https://deploy-preview-1312--vue-test-utils-docs.netlify.app |
@@ -0,0 +1,19 @@ | |||
<template> | |||
<component :is="Hello" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't that use computedProperty
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cexbrayat This is what I meant when I added the note. It does not matter whether you use the computed property, its name is still what shallowMount
will give to component
. That's how weird this bug is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a third test, one that will pass, to better outline the issue.
66604e9
to
254bd9e
Compare
254bd9e
to
89fe6a7
Compare
Hmm strange indeed, thanks for the repo 👍 If you feel adventurous, you can try to inspect what's going on when the tests run, and you may be able to fix the issue: we would be very happy to accept the PR! |
@cexbrayat The issue was exactly where @freakzlike had suggested. My fix is to ensure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine! @cexbrayat ?
@phobetron can you fix the linting errors? |
416dd8d
to
710d68f
Compare
@lmiller1990 Sorry about that! I think my local has a different default line length. Should be fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks 👍
@phobetron : the CI is failing because |
@cexbrayat That makes sense. I've reduced the test code to the minimum necessary to cover the error case. Should pass everything now 😅 |
9e5563d
to
eeaaf1e
Compare
@cexbrayat Sorry, decided to make another minor style adjustment. |
Looks great, thank you for taking the time to investigate and fix this, we really appreciate it! |
This PR adds a minimal set of tests to describe issue #1277, which regards how dynamic components, when shallow mounted, are stubbed with the name of a computed property that returns a component's name instead of the component itself.
The test component outlines the most extreme error case: a computed property does not need to be referenced in order to trigger the issue, it merely needs to both exist and return the component that is directly referenced.
This PR now also implements a possible simple fix for the issue.
cc: @cexbrayat