Skip to content

Add clarifying content for Vue lifecycle hooks #1400

Closed
@wes-harper-ibotta

Description

@wes-harper-ibotta

What problem does this feature solve?

This gives further explanation about how mount and shallowMount behave in conjunction with test runners, clarifying expectations for developers about how their component will be treated during and after each test.

I recently encountered a scenario where an intermittent test timeout occurred due to a setInterval created in the mounted hook, expecting the component to be destroyed (and the interval subsequently cleared) by vue-test-utils at the end of the spec.

What does the proposed API look like?

This is a simple addition to the common-tips section of the test utils docs with an example. I propose that the lifecycle hooks that can be expected to run automatically during each spec be elaborated on briefly after the "Shallow Rendering" section.

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