
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
jest-sonar
Advanced tools
jest-sonar is a custom test reporter for Jest. It converts the generated report into Sonar's Generic Execution format.
Using yarn:
$ yarn add -D jest-sonar
Using npm:
$ npm i -D jest-sonar
Configure Jest in your jest.config
file and add jest-sonar
to the list of reporters.
module.exports = {
...
reporters: ['default', 'jest-sonar'],
...
}
The following options can be set to customize the reporter:
Option | Environment override | Description | Default | Accepted values |
---|---|---|---|---|
outputDirectory | JEST_SONAR_OUTPUT_DIR | The directory to which the report should be written | The projects root dir | string |
outputName | JEST_SONAR_OUTPUT_NAME | The name of the report | sonar-report.xml | string |
reportedFilePath | JEST_SONAR_REPORTED_FILE_PATH | Should the path be relative or absolute | 'relative' | 'relative' or 'absolute' |
relativeRootDir | JEST_SONAR_RELATIVE_ROOT_DIR | The root directory for the relative path | jest rootDir | string |
You can set these options when defining the reporter in jest.config
:
module.exports = {
...
reporters: ['default', ['jest-sonar', {
outputDirectory: 'my/custom/directory',
outputName: 'my-new-report-name.xml',
reportedFilePath: 'absolute'
}]],
...
}
Or you can override these options via environment variables. Environment variables will always take precedence over options set via jest.config
$ JEST_SONAR_OUTPUT_DIR=./specialDir/ npm run jest
Contribution guidelines for this project
Contributions to this project are welcome, either by submitting bug reports, submitting feature requests or submitting pull requests.
NOTE: Be sure to merge the latest change from "upstream" before making a pull request!
This project uses the MIT license.
FAQs
A sonar reporter for jest
The npm package jest-sonar receives a total of 166,976 weekly downloads. As such, jest-sonar popularity was classified as popular.
We found that jest-sonar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.