Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect "if path not taken" #123

Closed
helmus opened this issue Dec 3, 2013 · 6 comments
Closed

incorrect "if path not taken" #123

helmus opened this issue Dec 3, 2013 · 6 comments

Comments

@helmus
Copy link

helmus commented Dec 3, 2013

Istanbul is reporting "If path not taken", since there are no `if`` statements in this snippet i'm not sure how i can improve coverage

Is this a bug or is there someway i can change my code to improve coverage ?

image

@gotwarlost
Copy link
Owner

That looks completely bogus. It looks like istanbul is getting confused and applying the metrics for one file against a different one in the HTML report.

@helmus
Copy link
Author

helmus commented Dec 3, 2013

I see, is there any additional information that i can provide ? Its
v0.1.2, im using this with karma and mocha / chai.
On Dec 3, 2013 9:15 AM, "Krishnan Anantheswaran" notifications@github.com
wrote:

That looks completely bogus. It looks like istanbul is getting confused
and applying the metrics for one file against a different one in the HTML
report.


Reply to this email directly or view it on GitHubhttps://github.com//issues/123#issuecomment-29690671
.

@helmus
Copy link
Author

helmus commented Dec 3, 2013

Also, i'm using this together with WebStorm and WebStorm is reporting the exact same coverage.

image

@fwielstra
Copy link

I have the same issue. Actually I just dived a little deeper; it seems to have to do with the location of app.js and the used Jasmine configuration. My current Jasmine configuration is:

It seems to have to do with the location of app.js; if I move it one level lower (i.e. in a subfolder), the issue no longer occurs.

It may also have to do with Karma: here is my Karma configuration:

require('./karma.base.conf')(config);
config.set({
preprocessors: {
'app/scripts/.js': 'coverage',
'app/scripts/__/
.js': 'coverage'
},

  reporters: ['coverage'],

  coverageReporter: {
    type: 'html'
  }
});

Note the two lines of preprocessors. I have managed to fix it in two ways:

  1. Move app.js to a subfolder
  2. Remove the *.js preprocessor line - app.js will still be covered

tl;dr, it seems that app.js is preprocessed twice with the above karma preprocessor configuration.

@gotwarlost
Copy link
Owner

@fwielstra - would it be possible for you to submit a patch for the karma-istanbul plugin to fix this issue?

@gotwarlost
Copy link
Owner

closing since this is not an istanbul issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants