Convert your SARIF output into a JUnit XML file
npm install sarif-junit
This project aims to convert a SARIF output file from a linter to a JUnit XML output file.
It could be used inside GitLab to show which tests are failing in the CI/CD pipeline.
It was created to be used in the mega_linter job hosted on r2devops.io.
``bashnpm
npm install -g sarif-junit@latest
You can update latest tag by a specific version tag
Usage
You can use this tool in two ways:
$3
`bash
sarif-junit --input --output
[--test-suite ]
`👉 You can also use the short version of the arguments
-i and -o.$3
Here is an example of how to read a SARIF file and convert it to a CodeClimate file:
`javascript
const saver = require('sarif-junit/lib/saver');
const fs = require('fs');//Read the input file
let input_sarif_file = null
try {
input_sarif_file = fs.readFileSync("result.sarif", 'utf8');
} catch (e) {
console.log(e.message);
}
saver(input_sarif_file, "result.xml", "testSuite");
``Are you missing something or want to contribute? Feel free to open an issue or create a pull request