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

Remove bunch of disable istanbul comments for unreachable code #2618

Closed
IvanGoncharov opened this issue Jun 5, 2020 · 2 comments · Fixed by #3398
Closed

Remove bunch of disable istanbul comments for unreachable code #2618

IvanGoncharov opened this issue Jun 5, 2020 · 2 comments · Fixed by #3398

Comments

@IvanGoncharov
Copy link
Member

In a few dozen places we have code like this:

function someFunction(value: boolean) {
  if (value) {
    // ...
  } else {
    // ...
  }

  // istanbul ignore next (Not reachable. All possible values have been considered)
  invariant(false, 'Unexpected value: ' + inspect((value: empty)));
}

And Istanbul happily ignores invariant because we provide comment but at the same reports that we have uncovered branch.
Ideally, we would contribute a fix to Istanbul that makes it ignore uncovered branches if the only code that is reachable in this branch is uncovered.
Alternatively, we can write a script that removes those branches from coverage/tests/coverage_final.json using @babel/parser to parser source files.

@SumodBE
Copy link

SumodBE commented Jul 31, 2020

Hi, I am new to graphQL-js and I am willing to help! let me know how can I help. Do I need to remove some comments here?

@sarathps93
Copy link

@IvanGoncharov Can I take this up?

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

Successfully merging a pull request may close this issue.

3 participants