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

133
Vistas
Gitlab Coverage Badge Shows "Unknown" - NodeJS with Jest

Im having an issue where my gitlab coverage badge reports back as "unknown" for a NodeJS project Im working. Ive read through dozens of stackoverflow articles about this and tried all the suggested solutions to no avail, so I figured I would put the specifics of my setup in this post to see if anyone can pinpoint what might be causing the issue.

The job I have in my gitlab-ci.yml file is as follows:

 test_coverage:
  image: node:16
  stage: test_coverage
  before_script:
    - echo "This skips any predefined before scripts to ensure clean environments"
  tags:
    - Nexus
  script:
    - npm run test:ci
  coverage: /All\sfiles.*?\s+(\d+.\d+)/
  artifacts:
    when: always
    reports:
        junit:
            - ./junit.xml
        cobertura: coverage/cobertura-coverage.xml
  dependencies:
    - install
  except:
    - tags

The script npm run test:ci in my package.json files is as follows:

"test:ci": "CI=true NODE_ENV=test ENVIRONMENT=CI_CD NODE_OPTIONS=--experimental-vm-modules jest --coverage --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporter=html --reporter=text --reporter=cobertura --reporters=default --reporters=jest-junit --watchAll=false"

I've got the following regex in the test coverage reporting settings section of gitlab

/All\sfiles.*?\s+(\d+.\d+)/

I have the badge link and URL set up as well in gitlab.

When I run my npm run test:ci script locally, I get a lovely coverage report returned. When my job runs in the gitlab pipeline, my coverage report has 0 for every file. It tells me all my tests ran and passed. It tells me that my junit and cobertura artifacts were successfully completed, and that the job succeeded.

I have a strong feeling that if I were seeing actual coverage numbers in the gitlab job logs like I see when I run the script locally, the badge would work. But I have no ideas why I'm getting all 0s reported. Can anyone see what Im doing wrong based on the info provided here?

about 4 years ago · Juan Pablo Isaza
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