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

242
Views
ExpressJs: informe de cobertura de Estambul con mocha

Traté de obtener un informe de cobertura para mis casos de prueba e instalé Estambul. Mi informe de cobertura funciona bien para un solo archivo de prueba que está en la carpeta raíz; de lo contrario, aparece “No coverage information was collected, exit without writing coverage information”

Mi estructura de carpetas es

 app/ — node_modules/ — coverage/ — server/ — — app.js — test/ — — index.test.js — test.js

cuando corro

 istanbul cover _mocha test.js

Sin embargo, obtengo un informe de cobertura si trato de sintonizar

 istanbul cover _mocha test/*.js

o

 istanbul cover _mocha test/index.test.js

No recibo ningún informe de cobertura. Intenté todo el golpe y la prueba. ¿No funciona para nada?

¿Cómo puedo ejecutar Estambul para cubrir el informe de todos los casos de prueba de forma recursiva?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Así que en realidad no entendí bien cómo funciona Estambul,

Estaba ejecutando el servidor como una instancia separada para ejecutar el caso de prueba y luego ejecutar el estambul.

Así que detuve la instancia en ejecución del servidor y luego incluí la configuración para ejecutar el servidor para Estambul.

Eso ayuda independientemente de la estructura de carpetas que mantenga para sus casos de prueba.

Hacer la instalación global de mocha y estambul.

 npm install -g mocha istanbul

PARA LINUX/MAC

 NODE_ENV=testing_coverage istanbul cover _mocha ./server/tests/*/.js --recursive ./bin/www ; open coverage/lcov-report/*.html

Para ventanas

 SET NODE_ENV=testing_coverage&istanbul cover ./node_modules/mocha/bin/_mocha ./server/tests/*/.js --recursive ./bin/www&open coverage/lcov-report/*.html

DÓNDE

 SET This is to be include in the windows to set the enviorment &this is to be included in windows to seperate the commands NODE_ENV=testing_coverage enviorment set for coverage and add this config in config.env file cover to cover istanbul code coverage, check istanbul help ---recursive for running recursive test case _mocha For mac: mocha file in node_modules/.bin/_mocha ./node_modules/mocha/bin/_mocha For windows set this path ./bin/www Main file to start the application ./server/tests/*/.js test cases folder path from root open coverage/lcov-report/*.html To open the coverage report in browser after all the test case gets completed
about 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!