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

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

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 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