# Parallelizing Jest and Cypress.io Tests on CircleCI

DevFeed: [Parallelizing Jest and Cypress.io Tests on CircleCI](<https://devfeed.tech/articles/parallelizing-jest-and-cypress-io-tests-on-circleci-19162.md>)

Original publisher: [Read original article](<https://artsy.github.io/blog/2022/09/07/quick-tips-to-speed-up-ci/>)

Published: 2022-09-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [Artsy](<https://devfeed.tech/sources/artsy.md>)

Topics: [Jest](<https://devfeed.tech/topics/jest.md>), [Cypress](<https://devfeed.tech/topics/cypress.md>), [ci](<https://devfeed.tech/topics/ci.md>), [Developer experience](<https://devfeed.tech/topics/developer-experience.md>)

Tags: [ci](<https://devfeed.tech/tags/ci.md>), [circleci](<https://devfeed.tech/tags/circleci.md>), [cypress](<https://devfeed.tech/tags/cypress.md>), [developer-experience](<https://devfeed.tech/tags/developer-experience.md>), [jest](<https://devfeed.tech/tags/jest.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

## AI overview

This tutorial explains how to parallelize CI test workloads using Jest sharding and CircleCI's split command for Cypress.io integration tests. It describes dividing Jest tests into buckets so separate processes can run subsets concurrently, reducing overall test execution time and developer wait time.

## Source excerpt

At Artsy, exploring ways to improve the developer experience is part of our makeup. Whether it's implementing hot-swapping for Express.js or integrating the Rust-based SWC compiler into our front-end build pipeline, we're always trying to reduce the amount of time it takes for a code cycle to take place. CI is no exception. When a developer opens a PR, we want to ensure they get timely feedback. Do their unit tests pass? Does the app build correctly? And how about smoke tests? Each of these jobs are complex processes that take time, and the more one can parallelize said tasks the less devs will need to wait. Scaled out to a whole engineering org, minor improvements to CI can be radical. In this regard, two things came across our radar recently that we'd like to share: sharding via Jest, and a (free) way to parallelize Cypress.io integration tests via CircleCI's split command. Sharding in Jest "What is sharding?" Good question! In short, it means "a small part of a whole". The database community has employed sharding techniques for decades, where a large database is split up into smaller, more manageable chunks, usually to improve performance at scale. The same idea can be applied to any process or task involving a lot of data, including tests. Think about it like this. Imagine an app that has thousands of tests. One can open up their terminal and run yarn test and execute all of the tests at once in a single process, or one can open two terminal tabs and run yarn test src/utils and yarn test src/routes, and have both processes allocate a pool of memory to complete each (smaller) subset of tasks. Because each process has its own memory pool the performance characteristics are generally better, and thus the overall time required to run our tests is reduced / decreased. Running each of these commands scoped to a particular folder is easy enough, but in a CI environment this is somewhat cumbersome; we'd need to define two new jobs and then the conditions in which they r