Skip to content

wrapper.destroy() does not completely destroy the wrapper object #1342

Closed
@blabuschagne

Description

@blabuschagne

Version

1.0.0-beta.29

Reproduction link

https://github.com/blabuschagne/vue-test-utils-destroy

Steps to reproduce

Once cloning the minimal production repo you can simply run the tests and see the expected vs the actual results.

What is expected?

The expected behaviour would be for the wrapper instance to have been destroyed i.e. the mutated properties should no longer exist.

What is actually happening?

The mutated properties on the wrapper remain intact after wrapper.destroy() has been called.


I came across this while testing a component which made use of a store.

I had the wrapper created via a beforeEach and destroyed via an afterEach. I expected this to provide isolation between my tests but found that some of the behaviour within the tests was affected by the preceding tests.

In order to achieve the test isolation I was looking for, I had to set the wrapper to null after calling destroy within the afterEach.

This doesn't only affect scenarios where a store is being made use of, as outlined by the link to minimal reproduction.

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