-
-
Notifications
You must be signed in to change notification settings - Fork 599
Make the tests faster #408
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
Conversation
It looks like tests on CI went from 30s to 10s. |
Nice. Looks like we can't use snapshot tests when we're expecting errors though:
|
} | ||
// Await the result. | ||
await testResults[index] | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
Snapshot tests are still fine. That one snapshot test failed because it looks like the error message is different in Node.js 4 then in Node.js 6, however seeing that helped me catch a bug I forgot to fix 😊 The second error causing the tests to crash is because Koa ships some ES2015 syntax in its source code that Node.js 4 doesn’t like. So the fix was to not test Koa if the Node.js major version is less than or equal to 4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
* run all of the integration tests in parallel * move test utilities * only introspect catalog once * speed up some tests * set a max workers count * add a thing * remove a thing to trigger build * fix lint errors * fix integration queries with different configurations * only test Koa in versions of Node.js greater than 4
Some of the test suites are pretty slow, so this PR aims to speed up our tests. With this PR tests go from 42 seconds to 12 seconds on my machine 🎉
The secret to pretty much all of the perf wins is parallelization. Jest does not automatically parallelize tests which is fine when testing synchronous code, but is not ok for some of the heavy asynchronous tests we end up running.
We were also repeating a lot of introspection work so I tried to get clients and introspections to be shared as much as possible.