Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

479
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda