Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Exclude the test files for React components in sonarcloud

I have a React application with the following folder structure

src
    components
        Component1
            Component1.tsx
            Component2.test.tsx
        Component2
            Component2.tsx
            Component2.test.tsx
    utils
    reducers
    pages

I would like to exclude the *.test.tsx files in the src folder from the sonar cloud coverage. I could move it to a test folder and then exclude the test folder from the coverage but that would be a very big change for the entire codebase.

I have a sonar-project.properties file that has a sonar.coverage.exclusions but I am not sure how to add it for this particular use-case.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I think, to exclude the *.test.tsx files in the src folder from the SonarCloud coverage, you can add the following line to your sonar-project.properties file:

sonar.coverage.exclusions = src/**/*.test.tsx
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading