Checking Code Coverage of Add-on SDK Extensions

Code coverage statistics are very useful. They tell you how much of your code never gets executed during the unit tests. So you always know what to write unit tests for, because 100% coverage doesn’t exist. And sometimes you can’t cover all code. That’s why normally you are happy, if the coverage is above a certain thresh hold, but having a higher coverage is always ok

One of the typical coverage tools for CommonJS based code is istanbul. Sadly it doesn’t work just out of the box, because the coverage calculations and tests aren’t run in the same JS engine. The tests run in Firefox and the calculations happen outside in NodeJS. Checking Code Coverage of Add-on SDK Extensions weiterlesen