You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks to the Nexus team for a wonderful tool. 🙇🏻
Summary of questions
Are there any tools or useful tutorials on how to profile the memory and CPU of a Jest test run on an in-memory Nx server?
Are there any strategies people have found to speed up test execution when dealing with a large number of test suites, each of which need to spin up their own test server?
Background
I love tests and I really appreciate the approach recommended by Nexus in the docs to test the API at an integration level. It makes each test meaningful and has served us really well in terms of API stability.
However, we are at a point where our tests are taking quite a long time. In a best case scenario, they take about 3 minutes to complete on a local machine. Unfortunately, it takes much longer in a CI environment; my leading hypothesis is memory limitations (we are running in GitHub Actions which, if I recall, has a memory limit of 2GB).
We now have close to 100 test suites, and most of them create their own test server instance. I experimented with memoizing the server, but ran into issues around mocking (if the same server is used between suites, the mocks can't be shared I don't think) and some challenges around startup (I ran into performance issues starting the server in the Jest globalSetup file)
I'm really struggling to think of new ways to speed up test execution. As with any company, our API is constantly growing, so I don't see this problem going away.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First of all, thanks to the Nexus team for a wonderful tool. 🙇🏻
Summary of questions
Background
I love tests and I really appreciate the approach recommended by Nexus in the docs to test the API at an integration level. It makes each test meaningful and has served us really well in terms of API stability.
However, we are at a point where our tests are taking quite a long time. In a best case scenario, they take about 3 minutes to complete on a local machine. Unfortunately, it takes much longer in a CI environment; my leading hypothesis is memory limitations (we are running in GitHub Actions which, if I recall, has a memory limit of 2GB).
We now have close to 100 test suites, and most of them create their own test server instance. I experimented with memoizing the server, but ran into issues around mocking (if the same server is used between suites, the mocks can't be shared I don't think) and some challenges around startup (I ran into performance issues starting the server in the Jest
globalSetup
file)I'm really struggling to think of new ways to speed up test execution. As with any company, our API is constantly growing, so I don't see this problem going away.
Beta Was this translation helpful? Give feedback.
All reactions