Open ngrieble opened 9 years ago
Hi @ngrieble,
first of all, no need to feel sorry for anything, I treat PRs often as a place for asking questions. In some way, this often is a real issue -> regarding the documentation; so, right place, good question, nothing to feel sorry for ;)
Although, I´m feeling sorry for not responding faster now.
Regarding the question: I updated the istanbul
dependency last week & bumped the package version to 0.5.0
; that then contains the version of istanbul
needed for that feature.
So, I would ask you to restest this. If not, we need to dig deeper & take a look what we need to do, to make this available.
Hi @asciidisco!
Glad I found the right place for this discussion :) No worries about the response time either.
So i tried using the latest version (0.5.0). Unfortunately the flag still isn't being recognized. I get code coverage, but only for the files I have explicitly included in my qunit tests. I can dig through the code a bit and see if there's a way to propagate this down.
Hello,
Great plugin. Has there been any updates for this? Would be great to have this functionality available.
Thanks
Hi, Is there any update on this? I have fixed this issue by making the below change in qunit.js ( addEmptyCoverageDataIfNeeded is the method i added)): I can send a PR for this.
var addEmptyCoverageDataIfNeeded = function(file) {
if(options.coverage.includeAllSources) {
var fileCoverageData = {};
fileCoverageData[file] = instrumenter.coverState;
collector.add(fileCoverageData);
}
};
grunt.util.async.forEachSeries(options.coverage.include, function (file, cb) {
var filepath = fs.realpathSync(file);
var fileStorage = filepath.replace(/^\/?/g, "/").replace(/\\/g, "/");
var webStorage;
// check if files will be delivered by a webserver
if (options.urls && options.coverage && options.coverage.baseUrl && options.coverage.instrumentedFiles) {
webStorage = (options.coverage.prefixUrl || '') + path.relative(options.coverage.baseUrl, filepath).replace(/\\/g, "/");
instrumentedFiles[webStorage] = instrumenter.instrumentSync(String(fs.readFileSync(filepath)), filepath);
addEmptyCoverageDataIfNeeded(filepath);
}
// instrument the files that should be processed by istanbul
if (options.coverage && options.coverage.instrumentedFiles) {
instrumentedFiles[fileStorage] = instrumenter.instrumentSync(String(fs.readFileSync(filepath)), filepath);
addEmptyCoverageDataIfNeeded(filepath);
}
cb();
},
Sorry this is more of a question than an issue, but I can't seem to figure out how to get this to work. Is there a way to get coverage reported for ALL the files in src? So 0% for files that are not tested?
I saw that istanbul has a flag called 'include-all-sources' but I'm not sure how to pass the flag to istanbul through grunt-qunit-istanbul's config. I've tried the following:
It doesn't seem to work though. Here's the source for the flag I'm referring to: https://github.com/gotwarlost/istanbul/pull/275
Any suggestions?