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

100% test coverage #1

Merged
merged 1 commit into from
Apr 1, 2017
Merged

100% test coverage #1

merged 1 commit into from
Apr 1, 2017

Conversation

novemberborn
Copy link
Contributor

After maxSize is reached, oldCache is reassigned. Try reading values that are in neither cache so the else-branch is hit, achieving 100% test coverage.


The Coveralls output is confusing, but it's clearer when you look at nyc's HTML report ("$(npm bin)"/nyc report --reporter=html).

After maxSize is reached, oldCache is reassigned. Try reading values that are in neither cache so the else-branch is hit, achieving 100% test coverage.
@sindresorhus
Copy link
Owner

Yay. Thanks for the help ;)

I thought Istanbul was smart enough to see that there's no more code after those branches. I assume it's not a bug, but is it really expected behavior?

@sindresorhus sindresorhus merged commit 1458591 into sindresorhus:master Apr 1, 2017
@novemberborn novemberborn deleted the patch-1 branch April 1, 2017 13:26
@novemberborn
Copy link
Contributor Author

I thought Istanbul was smart enough to see that there's no more code after those branches. I assume it's not a bug, but is it really expected behavior?

It's flagging that there is no test for the code path where the if condition does not match. It's the same as if the function ended with return undefined: you'd want to make sure that statement was reached.

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.

2 participants