As with all the toughest problems, this was caused by something stupid and unrelated.
I was running istanbul through grunt and was using the env
workaround so the correct directory is used when checking coverage. As in something like this:
env: {
coverage: {
APP_DIR_FOR_CODE_COVERAGE: '../test/coverage/instrument/app/'
}
},
As shown in the grunt-istanbul documentation
The problem was that I forgot to include env:coverage
in the task I created for running the coverage tests.
Anyway, if you have this same problem you probably did something really stupid too.