Jest afterThis Hook
JSON →jest-after-this is a Jest extension providing a new lifecycle hook, `afterThis`, which schedules code to run dynamically after the current test completes. Unlike `afterEach`, `afterThis` can be called multiple times within a single test to manage specific, unique side effects, ensuring cleanup even if the test fails. It is currently at version 1.0.4, with a recent release (v1.0.2) focused on release tooling, suggesting a maintenance or active, but not rapid, release cadence. Its key differentiator is the ability to tie cleanup directly to the test that created the side effect, promoting self-cleaning test helpers and reducing the complexity of shared `afterEach` hooks for diverse test scenarios. Handlers are executed in reverse order of registration and support asynchronous operations.
Traffic · last 30 days ↑100% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany · 🇪🇸 Spain