Unable to exclude .spec files from the analysis

Hello!

I’ve been struggling with setting up the proper analysis of my project. The problem is that the analysis catches all the bugs, smells. etc from the spec.js test files. I want to exclude those files.

For example, I have a file “src/…/test/extractLinkParts.spec.js”, I get multiple errors, such as 4 duplicated blocks of code must be removed. I don’t care about duplications in the test files.

I went to Project Settings > General Settings > Analysis Scope, scrolled down to the Files section and added the following exception to the Source File Exclusions: “**/*.spec.js”. Once I saved the results, I went back to the issues to discover that the “extractLinkParts.spec.js” file is still listed among other issues.

I use Community Edition - Version 8.3 (build 34182).

Am I doing something wrong here?
Please help!

Hi Pavel,

Welcome to the SonarSource Community!

As this is a test file, you should add this pattern to the " Test File Exclusions". Also note that changes to exclusion patterns are only applied upon the next analysis.

Cheers.

Brian