Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

912
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!