Possible bug fix for reporting coverage with grunt-karma, karma-jasmine and karma-coverage
mattxo opened this issue · 1 comments
mattxo commented
Hi,
I've found that in ibrik/instrumenter.js, the code that is passed into Istanbul is compiled without the bare : true option.
Instrumenter.prototype.instrumentSync = function(code, filename) {
var e, program;
filename = filename || ("" + (Date.now()) + ".js");
if (typeof code !== 'string') {
throw new Error('Code must be string');
}
try {
code = coffee.compile(code, {
sourceMap: true,
*** bare : true ***
});
program = esprima.parse(code.js, {
loc: true
});
this.fixupLoc(program, code.sourceMap);
return this.instrumentASTSync(program, filename, code);
} catch (_error) {
e = _error;
e.message = "Error compiling " + filename + ": " + e.message;
throw e;
}
};
Karma kept reporting that my classes in CoffeeScript were undefined until I added that compiler flag in the ibrik source!
ardelio commented
The exact same problem, and this also fixed it for me.