-
Notifications
You must be signed in to change notification settings - Fork 45
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
Include Worker ID in env similar to Jest #270
Comments
+1, so I can run 1 database per worker |
FWIW, I've migrated all of my projects to Jest and have been very happy. |
@PaulMest How long did it took for you to migrate? This feature is just essential for parallel tests... |
@CoderSpinoza For the most complicated project that involved dozens of tests and hundreds of assertions, it took a couple of days. Bulk of the work was done in ~4 hours. Once we switched to Jest and larger test suites were running in under 30s, people started writing more tests because it wasn't seen as a pain. |
That's cool, I didn't think about using Jest on the back-end. We actually wrote our own process management using This actually had some neat advantages because the test suites were always running a fresh DB migration and completely separate, something we've had to be really careful about in teardown hooks in the past. On the DB part itself I wrote a script that creates N databases in parallel ( Finally some batch code using Really happy with the result but obviously highly custom. Our test times went down by 90% locally and like 99% on Codeship because you get a 128-core machine to run things on. Same as Paul, our number of tests written has exploded since building this in March - the fast feedback loop is really critical for adoption IMO. We are also finally doing TDD because booting up the tests is finally fast. |
@nabilfreeman The result sounds great. Did you also have a chance to get aggregated coverage report from parallel tests? |
Great question @CoderSpinoza. I don't know how to do coverage in terms of nyc yet but we built our own coverage checker which counts: And returns an aggregate. Currently our coverage is still very bad and we're just focusing on getting API routes to 90%. 3 months work has taken us from <40% to 61%. |
Is there any way to get the worker ID within the test or a test helper? The goal would be to use this to automatically set up a different port or database.
Jest offers this as
process.env.JEST_WORKER_ID
(jestjs/jest#2284, jestjs/jest#5494).The text was updated successfully, but these errors were encountered: