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

shallowMount doesn't stub instances of the same component #1162

Closed
victorborrasdev opened this issue Dec 20, 2021 · 4 comments · Fixed by #1979
Closed

shallowMount doesn't stub instances of the same component #1162

victorborrasdev opened this issue Dec 20, 2021 · 4 comments · Fixed by #1979
Assignees
Labels
bug Something isn't working

Comments

@victorborrasdev
Copy link

Expected behavior

When using shallowMount on a component that contains itself, nested instances should be stubbed, so the output for the reproduction in the shared repo should be something like:

    <ul>
      <li>Option 1
        <!--v-if-->
      </li>
      <li>Option 2 <list-stub></list-stub>
      </li>
      <li>Option 3
        <!--v-if-->
      </li>
    </ul>

Current behavior

Nested instances are being mounted as if we were using mount. Current output is:

    <ul>
      <li>Option 1
        <!--v-if-->
      </li>
      <li>Option 2 <ul>
          <li>Option 2.1
            <!--v-if-->
          </li>
          <li>Option 2.2
            <!--v-if-->
          </li>
        </ul>
      </li>
      <li>Option 3
        <!--v-if-->
      </li>
    </ul>

Reproduction:

https://github.com/victorborrasdev/vue-test-utils-nested-stubs

Please let me know if you need any additional info. Thanks!

@cexbrayat
Copy link
Member

@victorborrasdev Thank you for the repro 👍 I'm not sure how VTU should behave in that case, both seem acceptable.

@lmiller1990 @xanf WDYT about this?

@xanf
Copy link
Collaborator

xanf commented Dec 20, 2021

Definitely an issue, I will take a look at it asap

@xanf xanf self-assigned this Dec 20, 2021
@lmiller1990 lmiller1990 added the bug Something isn't working label Dec 20, 2021
@mateuszjanusz
Copy link

Any follow-up on this one? 🙏

@cexbrayat
Copy link
Member

@mateuszjanusz I don't think someone looked into it. Any help is appreciated, feel free to take a look and open a PR to fix this if you want to, and we'll gladly merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants