Skip to content

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

Closed
@victorborrasdev

Description

@victorborrasdev

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!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions