Open akankshagaur opened 7 years ago
I am having this same issue too.
I'm using fountainjs to generate webapp, using Angular 1 with bower dependencies and injection, configured it to do coverage, ran the test and it passed the test and when generating the report, it failed with this error. However, the output gets generated.
maybe this answer will help you ,istanbul-instrumenter-loader / html reports fail w/ v1 #32
no updates?
I've been trying to figure out this problem for a couple of days myself. Please let me know if you figure anything out
Ive been doing some debugging and I suspect the root cause is config.files
is being passed to istanbul despite config.preProcessors
patterns being set to instrument only some files.
This is the config for the project Im working on:
config.set({
frameworks: ["browserify", "jasmine"],
files: [
"helpers.js",
"helpers.test.js",
],
preprocessors: {
'helpers.js': ['coverage', 'browserify'],
'helpers.test.js': ['browserify']
},
reporters: ["progress", 'coverage'],
browsers: ["Chrome"],
client: {
captureConsole: true,
},
logLevel: config.LOG_DEBUG,
browserify: {
debug: true,
transform: ['browserify-istanbul']
}
});
};
Despite the preProcessor
being set to only instrument helpers.js
both helpers.js
and helpers.test.js
are being reported on.
The failure results from coverage report for helpers.test.js
not containing the .code
property, causing istanbul to check its file store for the contents of helpers.test.js
via karma
's MemoryStore
here. Apparently MemoryStore
does not contain the source code thus causing the value of code
to be undefined here.
I am not well versed in the internals of karma
or karma-coverage
but I will keep looking later today.
I think you're on the right track. I really wish someone could solve this. I haven't had any luck.
I haven't made much progress. Ive tracked the bug to here the result parameter contains the invalid coverage property. However I cannot find the source of it. The only place I can find Karma.complete()
being called is here however this only occurs on an error and no arguments are passed.
If someone knows where this event is being emitted from let me know.
I believe there's a PR for this here: https://github.com/gotwarlost/istanbul/pull/816
Looks like Istanbul is not being maintained. I saw a sad comment on one of the PRs related to this issue, according to last comment on this https://github.com/gotwarlost/istanbul/pull/816#ref-commit-4a5e92c @gotwarlost is not active.
@jileeshs https://github.com/istanbuljs/istanbuljs
Thank you @michaelBenin
Hi,
version: 1.1.1
I am using Karma-coverage to generate lcov report with in-memory report like this:
I am getting the error:
I tried modifying the html.js to see the result. coverage is sending undefined value to istanbul in the end. My reports are generating properly, but this error fails my build. Is there a fix to it?