mardi 25 août 2020

nyc coverage only covers import statements for integration tests

I'm trying to get a coverage report for my integration tests. I'm using nyc, mocha, TypeScript. For my unit tests everything works fine but the integration tests result in strange coverage. Only the import statements of all files are seen as covered lines. But not the code lines that are actually executed during the tests. That means my total coverage is only 19% because 19% of my code lines are import statements.

package.json:

"coverage:integration": "nyc --reporter=lcov --reporter=text mocha -r ts-node/register 'src/**/test_integration/**/**.ts'",

For testing I first start the environment and then I start the test. How can it be that I do not get coverage for the executed lines but only for the import statements?

I've seen several questions on SO and github on test coverage for integration tests but none had the problem I'm facing and could help me.

Aucun commentaire:

Enregistrer un commentaire