Skip to content

shallowMount(Parent).contains(Child) returns false if Parent uses Child as a dynamic component (#853) #882

Closed
@caugner

Description

@caugner

Version

1.0.0-beta.23

Reproduction link

https://gitlab/mygroup/myproject

Steps to reproduce

Parent.spec.js

import { shallowMount } from "@vue/test-utils";
import { expect } from "chai";
import { Parent, Child } from "@/components";

describe("Parent.vue", function() {

  it("contains Child", () => {
    expect(shallowMount(Parent).contains(Child)).to.be.true;
  });
});

Parent.vue:

<template>
  <Child />
</template>

<script>
export default {
  components: {
    Child: () => import("@/components/Child")
  }
}
</script>

What is expected?

The tests should pass (like they did in 1.0.0-beta.20).

What is actually happening?

  1) Parent.vue
       contains Child:

      AssertionError: expected false to be true
        expected - actual

      -false
       true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions