- Install dependencies
$ yarn add --dev @craco/craco @jest/test-sequencer
-
Create
jest-sequencer.js
andjest.config.js
. -
Alter
package.json
to use the new config file.
"test": "react-scripts test",
"test": "yarn jest --config=jest.config.js",
- Add the envs
JEST_TOTAL_PARTITIONS
,JEST_PARTITION
to the CI config file
test:
needs: install
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jest-total-partitions: [4]
jest-partition: [1, 2, 3, 4]
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 14.17.4
- name: test
run: yarn test
env:
JEST_TOTAL_PARTITIONS: ${{ matrix.jest-total-partitions }}
JEST_PARTITION: ${{ matrix.jest-partition }}