Oliver Kocsis
Oliver Kocsis

Reputation: 613

Jest did not exit one second after the test run has completed when using GitHub Actions and Firebase

While running my unit tests with GitHub Actions for my app cerate by Create React App using the Firebase Emulator I get an error

Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

Upvotes: 1

Views: 1162

Answers (1)

Oliver Kocsis
Oliver Kocsis

Reputation: 613

Based on https://github.com/facebook/jest/issues/1456#issuecomment-587529051

You need to delete the initialized Firebase app which "renders this app unusable and frees the resources of all associated services".

afterAll(() => {
  firebase.app().delete();
});

Or use the --forceExit option when calling react-scripts test

...
"test": "react-scripts test",
"test-ci": "react-scripts test --forceExit",
...

Upvotes: 3

Related Questions