Skip to content

test: don't count hard-to-test lines for coverage#672

Merged
freitagbr merged 1 commit intomasterfrom
test-ignore-difficult-lines
Mar 5, 2017
Merged

test: don't count hard-to-test lines for coverage#672
freitagbr merged 1 commit intomasterfrom
test-ignore-difficult-lines

Conversation

@nfischer
Copy link
Copy Markdown
Member

No change in logic.

Add /* istanbul ignore next */ lines for hard-to-test lines so that
they don't count against us during code coverage.

I've also adjusted comments that I found confusing, and changed some
formatting.

Partial fix for #671

@nfischer nfischer added the test label Feb 26, 2017
@nfischer nfischer requested a review from freitagbr February 26, 2017 22:08
src/common.js Outdated
if (e.msg === 'earlyExit') {
retValue = e.retValue;
} else {
/* istanbul ignore next */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think /* istanbul ignore else */ above the if statement also works.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, either way. I just usually stick with ignore next. Do you think I should change it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With ignore next, I think istanbul will mark the else route as not taken. ignore else should improve test coverage slightly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try it tonight and see if I see a difference in either line or branch coverage

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freitagbr done. Same line coverage, but ignore else slightly improves branch coverage.

@nfischer nfischer force-pushed the test-ignore-difficult-lines branch from e4f57e7 to e7fc8b7 Compare March 4, 2017 22:47
No change in logic.

Add `/* istanbul ignore next */` lines for hard-to-test lines so that
they don't count against us during code coverage.

I've also adjusted comments that I found confusing, and changed some
formatting.

Partial fix for #671
@nfischer nfischer force-pushed the test-ignore-difficult-lines branch from e7fc8b7 to 4900568 Compare March 4, 2017 22:51
@nfischer
Copy link
Copy Markdown
Member Author

nfischer commented Mar 4, 2017

@freitagbr PTAL. I also moved one ignore next above the if so we get slightly better branch coverage. Branch coverage isn't a priority right now though, so let's just focus on line coverage.

@freitagbr
Copy link
Copy Markdown
Contributor

LGTM

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants