vendredi 31 janvier 2020

Karma with Angular Project return empty code coverage report when relocate tests

Because I don't need to test the used Angular base template and only need to test the base components and services, I relocated to the src/tests folder with the same inner structure of the app folder. Then I changed my test.ts file in order to reference the new path.

const context = require.context('./tests', true, /\.spec\.ts$/);

If I run the next command:

ng test

I can get all tests passing, but if I run the next command:

ng test --code-coverage=true

It generates the report and I can see that, but with empty results.

How can I do to reference the new tests path?

Aucun commentaire:

Enregistrer un commentaire