feat: add warnings when globals are missing#1244
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 39fdc6c:
|
Codecov Report
@@ Coverage Diff @@
## main #1244 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 192 192
Branches 38 40 +2
=========================================
Hits 192 192
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
timdeschryver
left a comment
There was a problem hiding this comment.
I like the idea!
I'm probably "stealing" this for Angular Testing Library :)
Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com>
|
@MatanBobi (and @timdeschryver, if you're still interested in Angular's implementation), it seems like this change could potentially run the risk of cluttering the logs for developers who intentionally aren't using the automatic cleanup functions. (For example, I'm using Is it possible to only display this warning once per call to |
|
Thanks @ITenthusiasm that's a valid point, we'll look into this. |
| }) | ||
| } else { | ||
| console.warn( | ||
| `The current test runner does not support afterEach/teardown hooks. This means we won't be able to run automatic cleanup and you should be calling cleanup() manually.`, |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
What: Adds a warning when we weren't able to setup logic through test runner globals (
afterEach,beforeAll,afterAll).Why: This was raised in #1240 and I believe it's worth adding because some stuff won't work for users so they should have a warning stating why.
How:
Adding
elseblocks in the relevant places.Checklist:
[ ] Documentation added to thedocs site
TestsTypeScript definitions updated