ts-jest: Istanbul ignore statements not being respected

  • Issue

/* istanbul ignore next */ statements are not being respected in files, even with removeComments: false set in tsconfig.json

  • Expected behavior
function* infiniteCounter() {
  let i = 0;
  /* istanbul ignore next */
  while(true) { // <-- coverage should be ignored here
    yield i;
    i++;
  }
} 

Related:

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 26 (2 by maintainers)

Most upvoted comments

@shivam-rallyhealth Use coverageProvider : ‘babel’ instead of ‘v8’ in jest.config. https://jestjs.io/docs/cli#–coverageproviderprovider

Solution is // istanbul ignore next

Can we reopen it?

@tjenkinson Changing my code for a code-coverage tool is too much. Comments are already enough mess IMO.

Same problem here. Flipping my removeComments did not change anything with versions:

jest: 22.4.3
ts-jest: 22.4.2

"jest": "^24.7.1", "ts-jest": "^24.0.2",

Any solution to this now?

No it isn’t @dfa1234

This also happens to me. ts-jest: 22.4.2 jest: 22.4.2

@kulshekhar Let’s put this on hold… Just made a minimal duplicate of my issue and for whatever reason I can’t get it to error. So something fishy must be happening on my end.

I’ll reopen if necessary once I figure out what the heck is going on.

@kulshekhar Sure thing. I’ll see if I can get to that sometime tomorrow afternoon (USA EST)