All Projects → 3dmind → Jest Sonar Reporter

3dmind / Jest Sonar Reporter

Licence: mit
A Sonar test reporter for Jest.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Jest Sonar Reporter

Nxplorerjs Microservice Starter
Node JS , Typescript , Express based reactive microservice starter project for REST and GraphQL APIs
Stars: ✭ 193 (+238.6%)
Mutual labels:  sonarqube, jest
Codecharta
CodeCharta visualizes multiple code metrics using 3D tree maps.
Stars: ✭ 85 (+49.12%)
Mutual labels:  sonarqube, jest
K2
Koa2 API template with passport, GraphQL, flowtype, knex and more.
Stars: ✭ 44 (-22.81%)
Mutual labels:  jest
React Boilerplate
Production-ready boilerplate for building universal web apps with React and Redux
Stars: ✭ 53 (-7.02%)
Mutual labels:  jest
Lode
A universal GUI for unit testing
Stars: ✭ 51 (-10.53%)
Mutual labels:  jest
Express Bookshelf Realworld Example App
🐳 An Express and Bookshelf based backend implementation of the RealWorld API Spec.
Stars: ✭ 45 (-21.05%)
Mutual labels:  jest
Learn Nuxt Ts
Testing TypeScript for Nuxt
Stars: ✭ 52 (-8.77%)
Mutual labels:  jest
Tsdx
Zero-config CLI for TypeScript package development
Stars: ✭ 9,010 (+15707.02%)
Mutual labels:  jest
Craco Alias
A craco plugin for automatic aliases generation for Webpack and Jest
Stars: ✭ 56 (-1.75%)
Mutual labels:  jest
Portal Ui
GDC Data Portal UI
Stars: ✭ 50 (-12.28%)
Mutual labels:  jest
Js Toolbox
CLI tool to simplify the development of JavaScript apps/libraries with little to no configuration. (WORK IN PROGRESS/PACKAGE NOT PUBLISHED).
Stars: ✭ 53 (-7.02%)
Mutual labels:  jest
Typescript Node Rest Starter
Simple starter template for building NODE REST API's using TypeScript
Stars: ✭ 50 (-12.28%)
Mutual labels:  jest
Todoist Js
!! OBSOLETE !! The (un)official Todoist javascript API library
Stars: ✭ 46 (-19.3%)
Mutual labels:  jest
Aws Testing Library
Chai (https://chaijs.com) and Jest (https://jestjs.io/) assertions for testing services built with aws
Stars: ✭ 52 (-8.77%)
Mutual labels:  jest
Minfront
Stars: ✭ 45 (-21.05%)
Mutual labels:  jest
Marvelheroes
Marvel Heroes
Stars: ✭ 54 (-5.26%)
Mutual labels:  jest
Push Starter
React Redux Starter with SSR 🤖
Stars: ✭ 43 (-24.56%)
Mutual labels:  jest
Parcel Vue Ts
📦 Boilerplate for Vue.js & Typescript, base on Parcel bundler.
Stars: ✭ 49 (-14.04%)
Mutual labels:  jest
Vue Pomo
A progressive web app for the Pomodoro Technique, built with Vue 2.0, Vuex and Firebase.
Stars: ✭ 51 (-10.53%)
Mutual labels:  jest
Nuxt Jest Puppeteer
🚀 Nuxt.js zero configuration tests, run with Jest and Puppetter
Stars: ✭ 57 (+0%)
Mutual labels:  jest

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.

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.

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.

Support for Sonarqube 5.6.x

Sonarqube 5.6.x does not support Generic Test Data however it has a Generic Test Coverage plugin which offers similar functionality.

If you have the plugin installed on Sonarqube, you can configure this reporter to produce files in supported format.

{
  "jestSonar": {
    "sonar56x": true
  }
}

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

sonar.genericcoverage.unitTestReportPaths=test-report.xml

Support for different configuration environments

To support different environments add the env property to the configuration and overwrite the value of the option you want to modify for the specific environment. You can overwrite the following configuration options: reportPath, reportFile, indent, sonar56x

For example: Overwrite the path were the report will be stored.

{
  "jestSonar": {
    "reportPath": "reports",
    "reportFile": "test-reporter.xml",
    "indent": 4,
    "env": {
      "test": {
        "reportPath": "reports-test"
      }
    }
  }
}

Use the NODE_ENV variable to activate the environment specific configuration.

NODE_ENV=test npm run test

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].