Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RND-513] Jest is taking too long #222

Merged
merged 19 commits into from Mar 17, 2023
Merged

[RND-513] Jest is taking too long #222

merged 19 commits into from Mar 17, 2023

Conversation

andonyns
Copy link
Contributor

This is an initial research about improving Jest performance.

Results:

  1. Fix error messages logged when running tests. See this run as an example.
  • This meant that some tests were trying to connect to a real database which lead to a timeout. This did not affect the actual test but the setup.
  • Some mocks that were not returning a value were causing the tests to call the real implementation.
  1. Add missing mocked environment variables.
  • This made a test fail because it was also attempting to do a DB connection.
  1. Add tsconfig file for tests to attempt to simplify compilation.

ℹ Note
The unit tests are still very slow, so it is important to continue to review tests individually (seeing the logged execution time) since it can be a signal that the tests are doing things that should be mocked.
ts-jest compilation tends to be slow but there are indications that some tests are taking too long to be this the issue. The attached thread suggests using swc but there are still some issues with jest mocks in this library, although it might be interesting to come back to this in the future to explore more about the tool.

@andonyns andonyns marked this pull request as ready for review March 16, 2023 22:41
@stephenfuqua stephenfuqua merged commit 9db1d62 into main Mar 17, 2023
@stephenfuqua stephenfuqua deleted the RND-513 branch March 17, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants