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

917
Visualizações
Istanbul coverage unknown% after running mounted tests in container

I am trying to set up coverage for unit tests that run in a docker container. However, the coverage reports fail generating as expected inside the container. But, they succeed generating when the command is run outside the container (on Mac OSX and CentOS).

I mount my codebase to a pre-existing path in the image.

The image is based on node:8.11.4
karma v3.1.4
karma-coverage v1.1.2
karma-coverage-istanbul-reporter v2.0.4
karma-webpack v4.0.0-rc.5
istanbul-instrumenter-loader v.3.0.1 .

Attempts to tease out the issue:

  • Setting basePath to __dirname in karma.conf.js
  • Normalizing all paths with path.join in karma.conf.js and entry points used by webpack.
  • Validate that the source is being bundled.
  • Ran outside container on Mac OSX and CentOS (reports succeed)
  • Set debug to true for the instrumenter (no errors)
  • Reinstall mounted node_modules from inside container
  • Use coverage and istanbul-coverage reporters.
  • Turn off sandbox for Chrome v72.0.3626.81 (headless)
  • Ran locally and in Jenkins (same results)
  • removing -u $(id -u):$(id -g) doesn't make a difference

What code would you like to see?

docker run --privileged \
-u $(id -u):$(id -g) \
--mount type=bind,source=$(pwd),dst=/home/node/test/ \
-it $DOCKER_IMAGE \
/bin/bash -c "npm test"

Expected:

=============================== Coverage summary ===============================
Statements   : 22.71% ( 7684/33837 )
Branches     : 15.17% ( 2887/19027 )
Functions    : 21.85% ( 1384/6334 )
Lines        : 21.45% ( 6719/31327 )
================================================================================

Actual:

17:40:18 =============================== Coverage summary ===============================
17:40:18 Statements   : Unknown% ( 0/0 )
17:40:18 Branches     : Unknown% ( 0/0 )
17:40:18 Functions    : Unknown% ( 0/0 )
17:40:18 Lines        : Unknown% ( 0/0 )
17:40:18 ================================================================================
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

what worked for me in Angular app - you run in your CLI ng test --code-coverage it magically shows the coverage

over 4 years ago · Santiago Trujillo 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