Merges multiple JUnit XML reports into one.
JUnit XML reports are generated by reporters for popular testing frameworks, such as mocha-junit-reporter
and karma-junit-reporter
. Other packages also may store test results in JUnit XML format.
junit-report-merger
creates a new test results report in JUnit XML format by collecting all <testsuite>
elements from all XML reports and putting them together.
This can be useful when you have multiple test runners in your test pipeline but you need a single output file which includes results from all test runners.
Package exports a single object with the following methods.
- mergeFiles(destFilePath, srcFilePaths, [options], cb)
Reads multiple files, merges their contents and write into the given file.
- mergeStreams(destStream, srcStreams, [options], cb)
Reads multiple streams, merges their contents and write into the given stream.
- mergeToString(srcStrings, [options]) ⇒
String
Merges contents of given XML strings and returns resulting XML string.
Reads multiple files, merges their contents and write into the given file.
Param | Type | Description |
---|---|---|
destFilePath | String |
Where the output should be stored. Denotes a path to file. If file already exists, it will be overwritten. |
srcFilePaths | Array.<String> |
Paths to the files which should be merged. |
[options] | Object |
Merge options. Currently unused. |
cb | function |
Callback function which will be called at completion. Will receive error as first argument if any. |
Reads multiple streams, merges their contents and write into the given stream.
Param | Type | Description |
---|---|---|
destStream | WriteStream |
A stream which will be used to write the merge result. |
srcStreams | Array.<ReadStream> |
Streams which will be used to read data from. |
[options] | Object |
Merge options. Currently unused. |
cb | function |
Callback function which will be called at completion. Will receive error as first argument if any. |
Merges contents of given XML strings and returns resulting XML string.
Param | Type | Description |
---|---|---|
srcStrings | Array.<String> |
Array of strings to merge together. |
[options] | Object |
Merge options. Currently unused. |