CircleCI Test Splitting Errors - Fix parallelism & globbing
Test splitting across parallel containers is misconfigured - the glob matches nothing on some containers, the runner ignores the split list, or every container runs the full suite. The job fails or wastes minutes.
What this error means
Some parallel containers report "no tests found" while others run everything, or the same tests run on every container. Results are inconsistent across the parallel runs even though the code is unchanged.
Running tests in parallel across 4 containers
circleci tests glob "test/**/*.spec.js"
No files match the glob, or split produced an empty list for this container.Common causes
Glob matches nothing on a container
With more containers than test files, some containers get an empty split and report no tests. The glob pattern may also be wrong relative to the working directory.
Split output not passed to the runner
circleci tests split only prints a file list; if the test command does not consume that list, each container runs the entire suite.
parallelism not set or set to 1
Splitting only helps when parallelism is greater than 1 and the splitter knows the count. With parallelism: 1 there is nothing to split.
How to fix it
Wire splitting into the test command
jobs:
test:
docker: [{ image: cimg/node:20.11 }]
parallelism: 4
steps:
- checkout
- run: npm ci
- run:
name: Run tests (split by timing)
command: |
TESTS=$(circleci tests glob "test/**/*.spec.js" | circleci tests split --split-by=timings)
npx jest $TESTSRight-size parallelism to the suite
- Keep
parallelismat or below the number of test files/groups. - Verify the glob matches files from the job’s working directory.
- Store timing data (
store_test_results) so--split-by=timingsbalances evenly.
How to prevent it
- Always feed the split list into the actual test runner.
- Use
--split-by=timingswithstore_test_resultsfor even splits. - Keep parallelism proportional to the number of test files.