Gathering detailed insights and metrics for junit-report-merger
Gathering detailed insights and metrics for junit-report-merger
Gathering detailed insights and metrics for junit-report-merger
Gathering detailed insights and metrics for junit-report-merger
npm install junit-report-merger
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
42 Stars
478 Commits
13 Forks
4 Watching
3 Branches
4 Contributors
Updated on 24 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-22.2%
73,271
Compared to previous day
Last week
-0.6%
442,173
Compared to previous week
Last month
9.8%
1,833,701
Compared to previous month
Last year
40%
16,402,654
Compared to previous year
3
Merges multiple JUnit XML reports into one.
Reporters of many testing frameworks generate JUnit XML reports. mocha-junit-reporter
, karma-junit-reporter
to name a few. Sometimes there is a need to combine multiple reports together in a single file. This is what junit-report-merger
does.
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.
Package provides a jrm
binary, which you can use to merge multiple xml reports into one.
In a nutshell it is a tiny wrapper around mergeFiles api.
1npm install -g junit-report-merger
In this case you'll be able to execute jrm
binary from within your shell.
1npm install junit-report-merger --save-dev
In this case jrm
binary will be available only inside package.json
scripts:
scripts: {
"merge-reports": "jrm combined.xml \"results/*.xml\""
}
Assuming your JUnit test results are in ./results/units/
folder, and you want to get a combined test result file in ./results/combined.xml
:
1jrm ./results/combined.xml "./results/units/*.xml"
You can also specify multiple glob patterns:
1jrm ./results/combined.xml "./results/units/*.xml" "./results/e2e/*.xml"
NOTE
Make sure to wrap each pattern with double quotes ("
), otherwise your shell may try to expand it instead of passing to Node.js.
Package exports a single object with the following methods.
mergeFiles - Merges contents of multiple XML report files into a single XML report file.
mergeStreams - Merges contents of multiple XML report streams into a single XML report stream.
mergeToString - Merges multiple XML report strings into a single XML report string.
1const path = require('path') 2const { mergeFiles } = require('junit-report-merger') 3 4const outputFile = path.join(__dirname, 'results', 'combined.xml') 5 6const inputFiles = ['./results/units/*.xml', './results/e2e/*.xml'] 7 8try { 9 await mergeFiles(outputFile, inputFiles) 10 console.log('Merged, check ./results/combined.xml') 11} catch (err) { 12 console.error(error) 13}
mergeFiles
Signature:
1mergeFiles( 2 destFilePath: string, 3 srcFilePathsOrGlobPatterns: string[], 4 options?: MergeFilesOptions 5) => Promise<void> 6 7mergeFiles( 8 destFilePath: string, 9 srcFilePathsOrGlobPatterns: string[], 10 options: MergeFilesOptions, 11 cb: (err?: Error) => void 12) => void
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. |
srcFilePathsOrGlobPatterns | string[] | Paths to the files which should be merged. You can also specify glob patterns, such as results/**/report-*.xml |
[options] | MergeFilesOptions | Merge options. |
[cb] | (err?: Error) => void | Callback function which will be called at completion. Will receive error as first argument if any. |
Last argument - cb
is a Node.js style callback function. If callback function is not passed, function will return a promise. That is, all the following variants will work:
1// options passed, callback style 2mergeFiles(destFilePath, srcFilePaths, {}, (err) => {}) 3 4// options missing, callback style 5mergeFiles(destFilePath, srcFilePaths, (err) => {}) 6 7// options passed, promise style 8await mergeFiles(destFilePath, srcFilePaths, {}) 9 10// options missing, promise style 11await mergeFiles(destFilePath, srcFilePaths)
MergeFilesOptions
These are the options accepted by mergeFiles
.
Signature:
1type MergeFilesOptions = { 2 onFileMatched? (matchInfo: { 3 filePath: string 4 }) => void 5}
onFileMatched
mergeFiles
calls function specified by the onFileMatched
option once for each file matched by srcFilePaths
, right before file processing begins.
Signature:
1mergeStreams( 2 destStream: WritableStream, 3 srcStreams: ReadableStream[], 4 options?: {} 5) => Promise<void> 6 7mergeStreams( 8 destStream: WritableStream, 9 srcStreams: ReadableStream[], 10 options: {}, 11 cb: (err?: Error) => void 12) => void
Reads multiple streams, merges their contents and write into the given stream.
Param | Type | Description |
---|---|---|
destStream | WritableStream | A stream which will be used to write the merge result. |
srcStreams | ReadableStream[] | Streams which will be used to read data from. |
[options] | object | Merge options. Currently unused. |
[cb] | (err?: Error) => void | Callback function which will be called at completion. Will receive error as first argument if any. |
Last argument - cb
is a Node.js style callback function. If callback function is not passed, function will return a promise. That is, all the following variants will work:
1// options passed, callback style 2mergeStreams(destStream, srcStreams, {}, (err) => {}) 3 4// options missing, callback style 5mergeStreams(destStream, srcStreams, (err) => {}) 6 7// options passed, promise style 8await mergeStreams(destStream, srcStreams, {}) 9 10// options missing, promise style 11await mergeStreams(destStream, srcStreams)
Signature:
1mergeToString( 2 srcStrings: string[], 3 options?: {} 4) => string
Merges given XML strings and returns the result.
Param | Type | Description |
---|---|---|
srcStrings | string[] | Array of strings to merge together. |
[options] | object | Merge options. Currently unused. |
Unfortunately, there is no official specification of JUnit XML file format.
The XML schema for the original JUnit XML format is here.
Over the time, various CI tools and test management software augmented original format with their own properties.
The most comprehensive overview of the format is put together by folks at Testmo here.
jrm
produces output conforming to that format and accepts files conforming to that format.
No vulnerabilities found.
Reason
11 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More