0.2.16 • Published 1 year ago

jest-sonar v0.2.16

Weekly downloads
26,381
License
MIT
Repository
github
Last release
1 year ago

jest-sonar

jest-sonar is a custom test reporter for Jest. It converts the generated report into Sonar's Generic Execution format.

CodeQL Maintainability Test Coverage

Installation

Using yarn:

$ yarn add -D jest-sonar

Using npm:

$ npm i -D jest-sonar

Configuration

Configure Jest in your jest.config file and add jest-sonar to the list of reporters.

module.exports = {
    ...
    reporters: ['default',  'jest-sonar'],
    ...
}

Customize the reporter

The following options can be set to customize the reporter:

OptionEnvironment overrideDescriptionDefaultAccepted values
outputDirectoryJEST_SONAR_OUTPUT_DIRThe directory to which the report should be writtenThe projects root dirstring
outputNameJEST_SONAR_OUTPUT_NAMEThe name of the reportsonar-report.xmlstring
reportedFilePathJEST_SONAR_REPORTED_FILE_PATHShould the path be relative or absolute'relative''relative' or 'absolute'
relativeRootDirJEST_SONAR_RELATIVE_ROOT_DIRThe root directory for the relative pathjest rootDirstring

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

Contribution guidelines for this project

Contributions to this project are welcome, either by submitting bug reports, submitting feature requests or submitting pull requests.

Creating a pull request

  1. Fork the repo on GitHub
  2. Clone and make changes on your machine
  3. Commit and Push the changes to your fork
  4. Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest change from "upstream" before making a pull request!

Licence

This project uses the MIT license.

0.2.16

1 year ago

0.2.15

1 year ago

0.2.14

1 year ago

0.2.13

1 year ago

0.2.12

3 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago