sh33dafi / jest-sonar

A jest reporter that generates sonar reports
MIT License
50 stars 11 forks source link

Config option changes #37

Closed ergbouncex closed 1 year ago

ergbouncex commented 3 years ago

I would like to only use this reporter during CI runs only (there is a test:ci npm script that runs). As it is configured now, I only see the option to add this as a runner and configure it to always run. Is it possible to have a config option in package.json that is only triggered with the --runner jest-sonar option?

sh33dafi commented 3 years ago

Since jest-sonar is just a reporter like any other reporter I don't think adding an option is the way to go. It is possible to change which reporters to use by providing --reporters flag to the jest command like jest --reporters="default" this only uses the default reporter even if in te config more reporters are provided Or you can extend your standard config to create a specific ci jest config jest.config.js module.exports = { reporters: ['default'] };

jest-ci.config.js const cfg = require('./jest.config.js'); module.exports = { ...cfg, reporters: ['jest-sonar'] };

and then run your tests with jest --config=jest=ci.config.js

I really think that what you want to achieve can already be achieved with standard jest configurations

ergbouncex commented 3 years ago

without having to have a jest config js file, is there a way to pass options to the report via the command line? For example, just for output directory and filename? There is an older package that does something similar, https://github.com/3dmind/jest-sonar-reporter.

SveLil commented 1 year ago

I created a pull request for passing options via environment: #66

github-actions[bot] commented 1 year ago

Locked due to an inactive of 90 days