Pregunta

I am trying to generate code coverage for the project I am currently working on. The project is several years old and we just recently started writing unit tests, meaning that I only want to generate coverage for the files we have actual unit tests for. The tests are written in jasmine and we use karma to create the code coverage.

Currently the preprocessor part of the karma config looks something like this:

preprocessors : {
    '**/WebContent/common/filename1.js' :'coverage',
    '**/WebContent/boot/filename2.js' :'coverage',
    '**/WebContent/boot/filename3.js' :'coverage'
},

It does however seem that code coverage is only generated for the first file listed this way. All examples that I have seen lists all files using a regex, but as we have tests for several files in different folders with wildly different names and where some folders mostly contain code that does not have any unit tests I am not sure how to create a regex that is able to match the different files we have.

Is there a way to list several files without using a regex, and if it is there an easy way to create a regex that matches only the files we have unit tests for?

¿Fue útil?

Solución

There seemed to be a problem with case sensitivity or something. Earlier in the config file, I had referenced some files using a capital W and some with a lower case w when writing WebContent. Changing all the earlier references to capital Ws seemed to do the trick.

Otros consejos

maybe you can use

preprocessors : {
    '**/WebContent/**/*.js' :'coverage'
},
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top