How To Fix Issue Of Code Coverage Not Finding Functions When Run Tests Do?
When running my tests they all pass. When running code coverage 4 fail due to functions being 'not defined'. They are defined (as the tests clearly show when they pass). I cannot g
Solution 1:
Code coverage in JSTestDriver does not like let
and const
. It will not run code coverage on any files that contain it and will not allow functions from a file that contains it.
For my particular case I had a function that used const
. The function that used it was not called in the functions I was testing and thus was never tested at all. This meant the tests passed. However, being in the same file was enough to make code coverage break.
My solution? Change both let
and const
to var
. Semantically it may not be the best idea but in my case it made no noticeable difference to my code or the behaviour.
Post a Comment for "How To Fix Issue Of Code Coverage Not Finding Functions When Run Tests Do?"