SOLUTION: ideally you should figure out what causes the issue (e.g. an open resource connection), but a quick fix can be to add the --forceExit flag to the npm or yarn command (e.g. npm test --forceExit / yarn test --forceExit).
Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot be adequately cleaned up. Note: This feature is an escape-hatch. If Jest doesn’t exit at the end of a test run, it means external resources are still being held on to or timers are still pending in your code. It is advised to tear down external resources after each test to make sure Jest can shut down cleanly.