Jest clean up after all tests have run
<p>Is it possible in Jest to run cleanup or teardown tasks that run after all other tests have completed? Similar to how setupFiles allows one to set up tasks after before any test has run. Bonus points if this can also run regardless if the test had any errors.</p>

<p>Putting <code>afterAll(() =&gt; {})</code> at the top level of a file (outside any describe function) appears only to run after tests from that particular file have finished.</p>

<p>The use case is I have many test files that will create users in a a development database, and I don't want to make each test file responsible for cleaning up and removing the user afterwards. Errors can also happen while writing tests, so if the cleanup happens regardless of errors that would be preferable.</p>