Run jest test parallelized with coverage

Hello, today I change my confg.yml in order to run the test in parallel, it was really easy but the problem is that all the tests run ok, but I get an error with the coverage. Basically, because half of the test runs in one node and the other half on the other, so the resulting coverage fails on each node (but the sum of both should be ok)
There is a way to check the summarize both coverages and check that once all the nodes finish tests?

Did you ever find a way to make this work?

I thiiiiiink this is usually where you’ll need to create a “collection” job. Basically, you move all of the artifacts from the individual parallel jobs into a single job where you can run your reports. You can do it with a workspace.

workflows:
  my-workflow:
    jobs:
      - parallel-job
      - collection-job:
          requires:
            - parallel-job

Sharing the example above to explain a bit further. It’s just the workflow section from the workspace docs with the job names modified to make it clearer. The parallel-job will run, and each parallel run will save the artifacts into the workspace. Once every parallel run completes the collection-job will spin up and it will have access to all of the artifcats at once by connecting to the workspace as well. Then do your coverage reporting in the collection job where all of the artifacts are available.

1 Like

I am having the same issue at the moment.

@fernfernfern How would you combine the different coverage reports, after which you can check them?

It depends on your tooling. Like coverage.py has some built-in commands to do it. For javascript, it seems like nyc command line tool has some features that support this.

I think there were some other open-source projects related to combining reporting, but I’m having trouble finding them now. been a while since I looked into this stuff.

1 Like

It appears Codecov also has a similar feature to merge reports.