sh33dafi / jest-sonar

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

Ability to specify root path for relative reported file path #28

Closed elyzov closed 4 years ago

elyzov commented 4 years ago

Is your feature request related to a problem? Please describe. I have mono-repository with backend and frontend parts placed in different folders (e.g. src/ui). I install and configure jest-sonar reporter in the following way

    ...
    "reporters": [
      "default",
      [
        "jest-sonar",
        {
          "outputDirectory": ".jest",
          "reportedFilePath": "relative"
        }
      ]
    ],
    ...

And then I run tests from the root of the project like this

yarn --cwd src/ui/ test

But relative path generates based on the rootDir specified in the config, so sonar-scanner cannot find those files and skip its.

Describe the solution you'd like I want to add additional option like relativeRootPath, which will be used instead of rootDir if specified.

Thus, I could change my config like this

    ...
    "reporters": [
      "default",
      [
        "jest-sonar",
        {
          "outputDirectory": ".jest",
          "reportedFilePath": "relative",
          "relativeRootPath": "../../"
        }
      ]
    ],
    ...

and all would be worked as it should.

sh33dafi commented 4 years ago

Fixed in https://github.com/sh33dafi/jest-sonar/pull/29

elyzov commented 3 years ago

Could you release new version with this feature, that I could use it in my project?

sh33dafi commented 3 years ago

Could you release new version with this feature, that I could use it in my project? https://www.npmjs.com/package/jest-sonar/v/0.2.11

github-actions[bot] commented 3 years ago

Locked due to an inactive of 90 days