Allow custom cleanup functions in TestScheduler
See original GitHub issue🚀 Feature Proposal
Allow custom cleanup functions to be run by TestScheduler
. Currently, TestScheduler
only runs cleanup for jest snapshots (code here).
I would like a way to specify a custom cleanup function, or to have an expectation that a custom matcher can export it’s own cleanup function.
Motivation
Custom matchers generate snapshots that can be obsolete once the corresponding test files have been removed. See related jest-image-snapshot
issue here: https://github.com/americanexpress/jest-image-snapshot/issues/59#issuecomment-421222824
When working with a custom matcher e.g. jest-image-snapshot
, there doesn’t seem to be a way to run a cleanup function after all tests have finished running. Custom matchers may also save snapshot files with their own naming format, which may not correspond to jest-snapshot naming conventions,
Example
See motivation above ^
Pitch
A cleanup should run after all tests have been completed, which is known to TestScheduler. As far as I can see, that is the best place that this can happen – happy to hear out and discuss alternative implementations!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:10 (1 by maintainers)
Top GitHub Comments
Hey there any news on this?
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.