How to generate XML report using jest-junit with Knapsack Pro Jest in Queue Mode?
To generate XML report using jest-junit with @knapsack-pro/jest
you need to set environment variable JEST_JUNIT_UNIQUE_OUTPUT_NAME=true
. It creates a unique file name for the output junit-${uuid}.xml
and overrides outputName
. See more in jest-junit options.
JEST_JUNIT_UNIQUE_OUTPUT_NAME=true
flag is needed because @knapsack-pro/jest
in Queue Mode runs a batch of tests fetched from Queue API multiple times. For each batch of tests, a new report is generated. By default, report would be overridden for each batch of tests if you keep the default name of the report file. Thanks to JEST_JUNIT_UNIQUE_OUTPUT_NAME=true
each report has a unique name so when you run Jest tests with @knapsack-pro/jest
on one of your parallel CI nodes you will get many XML reports on single CI node.
The jest-junit XML reports can be merged. Some CI providers like GitLab CI can create a correct summary of multiple junit.xml files from parallel CI nodes.