Skip to content

Clearing state before/after each test #517

Open
@ennioVisco

Description

@ennioVisco

I am writing a few tests that are changing some internal useState variables of a composable.
However, I noticed that the state of that composable is kept between tests.

This breaks a primary principle of unit testing:

  1. tests should be isolated.
  2. tests should work in any order they are run (dependent on 1.)

Even applying

beforeEach(() => {
    clearNuxtState();
}

the composable still keeps the state.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions