Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

483
Views
Sonarqube: grab tests from multiple directories AND avoid an 'file can't be indexed twice'

Answers to questions like 'how to grab tests from multile folders' and to questions 'how to avoid file can't be indexed twice' are just opposite each other. So this question is not a duplicate of one of them.

I have a structure like that:

src
  |_component1
  |          |__tests__
  |                    |_units.tsx
  |
  |_component2
             |__tests__
                       |_units.tsx

If I try customize sonar like this:

'sonar.sources': 'src',
'sonar.tests': 'src',
'sonar.exclusions': 'src/**/__tests__/**/*',
'sonar.tests.inclusions': 'src/**/__tests__/**/*.{js,jsx,ts,tsx}',

It fails with error file can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files.

If I provide sonar.sources and sonar.tests with different paths, it can't see my multiple __tests__ directories.

How could I combine both grab multiple test directories and avoid this error?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Okey, I've got an answer!

Proper settings are:

'sonar.sources': 'src',
'sonar.tests': 'src',
'sonar.exclusions': '**/__tests__/**',
'sonar.test.inclusions': '**/__tests__/**',

It's not sonar.TESTS.inclusions, it's sonar.TEST.inclusions, 1 letter difference.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!