agent-js-jest
agent-js-jest copied to clipboard
Re-use the same launches when using `jest --shard`
Jest recently introduced--shard option to fasten up tests on CLI.
This option breaks a single run into multiple runs as shown in the image below:

All of these 4 runs are actually part of a single test run on CI and hence same launch ID should be used for all of the individual shard runs.
However, the current behavior is that the package creates 4 different launches and hence 4 different reports on the report portal. Which disturbs the final graph on the report portal.
There isn't an easy way to do this but here's what my team has been doing:
- Create a launch id using
@reportportal/client-javascript
- Write the launch id to a file and upload it to S3 (or any object storage) with the commit id (or head commit id in case of PR) as the filename
- In each shard, download the file from S3 and read it to get the launch id
- After all the shards are done running, in another job you can download the launch id and then close the launch
I believe this issue is also related https://github.com/reportportal/agent-js-jest/issues/58
alternatively, upload-artifact
action could be used in place of S3
as for #58, this functionality does exist but its not documented. You can pass launchId: string
in the @reportportal/agent-js-jest
config in the jest.config.js
file