Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

feat(cleanup): add after each cleanup helper #19

Merged
merged 3 commits into from
May 21, 2019

Conversation

bcarroll22
Copy link
Collaborator

@bcarroll22 bcarroll22 commented May 20, 2019

What:

Add a cleanup helper that can be run after each tests

Why:

I want to be able to unmount components after tests. We don't need to clean up the DOM, but it should allow for things like clearing timeouts and intervals on unmount. Also I can't explain why, but this made the tests run about 1 second faster on my MacBook.

How:

Cleanup exported on the main API, also via a helper that can be used in a setup file if wanted.

Checklist:

  • Documentation added to the docs site
  • Typescript definitions updated
  • Tests
  • Ready to be merged

@codecov-io
Copy link

codecov-io commented May 20, 2019

Codecov Report

Merging #19 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #19   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          20     20           
  Lines         262    262           
  Branches       65     65           
=====================================
  Hits          262    262

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f74c27...de14e8d. Read the comment docs.

@bcarroll22
Copy link
Collaborator Author

This also renames the asFragment property returned from render() to asJSON which is a more honest name for what it does. We don't return a DocumentFragment, we return a JSON representation of the tree which can be used for snapshots.

This won't be a breaking change because asFragment was undocumented. Docs are now added to the 3.0.0 site for asJSON.

Copy link
Collaborator

@TAGraves TAGraves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good - just one question. Don't we need to make a change to the typedefs for the asFragment -> asJSON change?

@bcarroll22 bcarroll22 merged commit b8e3ca8 into master May 21, 2019
@bcarroll22 bcarroll22 deleted the pr/add-cleanup-helper branch May 21, 2019 02:03
@bcarroll22
Copy link
Collaborator Author

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants