Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

471
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda