Skip to content

Cleanup done automatically for Jest/Mocha/Jasmine (according to docs) #12

Closed
@jamiecoe

Description

@jamiecoe

Apparently cleanup() is done automatically if the testing framework you're using supports the afterEach global (like mocha, Jest, and Jasmine):

https://testing-library.com/docs/react-testing-library/api#cleanup

Would this make the following section of the README unnecessary?

Note:

If you read the docs for render you'll see that it's recommended to be used with the cleanup function. This will ensure you don't end up with lots of copies of your component in the same document.

You can use Jest's handy method that runs after each test to do this: afterEach(cleanup).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions