Socket
Socket
Sign inDemoInstall

jest-sonar-reporter

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-sonar-reporter

A Sonar test reporter for Jest.


Version published
Maintainers
1
Install size
42.2 kB
Created

Readme

Source

jest-sonar-reporter

Build Status Quality Gate

jest-sonar-reporter is a custom results processor for Jest. The processor converts Jest's output into Sonar's generic test data format.

This project is inspired by Michael Allen's jest-junit-reporter project.

Installation

Using npm:

$ npm i -D jest-sonar-reporter

Using yarn:

$ yarn add -D jest-sonar-reporter

Configuration

Configure Jest in your package.json to use jest-sonar-reporter as a custom results processor.

{
  "jest": {
    "testResultsProcessor": "jest-sonar-reporter"
  }
}

Configure Sonar to import the test results. Add the sonar.testExecutionReportPaths property to your sonar-project.properties file.

sonar.testExecutionReportPaths=test-report.xml

Customization

To customize the reporter you can use package.json to store the configuration.

Important: The TEST_REPORT_PATH environment variable is deprecated!

Create a jestSonar entry like this:

{
  "jestSonar": {}
}

You can customize the following options:

  • reportPath This will specify the path to put the report in.
  • reportFile This will specify the file name of the report.
  • indent This will specify the indentation to format the report.
{
  "jestSonar": {
    "reportPath": "reports",
    "reportFile": "test-reporter.xml",
    "indent": 4
  }
}

Important: Don't forget to update sonar.testExecutionReportPaths when you use a custom path and file name.

Usage

  1. Run Jest to execute your tests.

Using npm:

$ npm run test

Using yarn:

$ yarn run test
  1. Run sonar-scanner to import the test results.
$ sonar-scanner

Licence

This project uses the MIT licence.

FAQs

Last updated on 01 Jul 2017

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc