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

132
Visualizações
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 à 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