-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run cleanup() when test runner supports teardown() #676
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f461860:
|
Now the tests fail because code coverage is below the threshold. Wich leads to my second point
|
I think you can tell coverage to ignore certain branches. Something like |
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #676 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 99 100 +1
Branches 15 16 +1
=========================================
+ Hits 99 100 +1
Continue to review full report at Codecov.
|
@eps1lon I ignored the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thank you!
I wonder whether we should consider this a breaking change 😬
Good question. I guess not? I mean, nothing will break. It's "just" a new feature for (for example) |
* Run cleanup() when test runner supports teardown() * Disable ESLint for teardown() function Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com> * Ignore teardown() in code coverage because Jest does not support it Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
@all-contributors please add @screendriver for code |
I've put up a pull request to add @screendriver! 🎉 |
What:
cleanup()
now runs not only whenafterEach()
exists. It also runs whenteardown()
exists.Why:
There are test runners that either don't have a
afterEach()
function or supports different UI's, like Mocha's TDD UI for example. It would be great ifreact-testing-library
would also supportteardown()
for cleaning up things.How:
I just added an additional check that checks and calls
teardown()
instead ofbeforeEach()
.Checklist:
docs site
The main problem that I have with this pull request is:
teardown
is not defined. Is this somewhere deep ineslint-config-kentcdodds
?Jest
which does not haveteardown()