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

fix: Always call coverage initialization function #524

Merged
merged 1 commit into from Feb 3, 2020
Merged

fix: Always call coverage initialization function #524

merged 1 commit into from Feb 3, 2020

Conversation

coreyfarrell
Copy link
Member

Ensure that sources initialize coverage data even if no code is run.


The primary use case for this is ES modules that are not transpiled to CJS. For example create fn1.js:

export function fn1() {
  console.log('test');
}

And index.js:

import {fn1} from './fn1.js';

if (false) {
  fn1();
}

The expected result is for fn1.js to be reported as zero coverage but since the file has code but does not execute any top-level code it never gets in this test case.

Ensure that sources initialize coverage data even if no code is run.
@coreyfarrell coreyfarrell merged commit c6536c1 into istanbuljs:master Feb 3, 2020
@coreyfarrell coreyfarrell deleted the always-initialize-coverage branch February 3, 2020 06:56
vivek-freshworks pushed a commit to freshworks/istanbuljs that referenced this pull request Oct 16, 2023
Ensure that sources initialize coverage data even if no code is run.
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

Successfully merging this pull request may close these issues.

None yet

1 participant