fix: only warn about incomplete coverage when tests were rerun (#85)#87
Merged
Conversation
store.reruns is an array initialised to [], so the truthiness guard in getCoverage was always true and the 'coverage report may not be complete' warning fired on every run with coverage enabled. Check store.reruns.length instead so the warning only appears when tests were actually rerun or the run spanned multiple run ids.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #85. The "coverage report may not be complete" warning fired on every run with coverage enabled, even clean single runs with no reruns.
getCoverageguarded the warning with:store.rerunsis aTestRerun[]initialised to[], so|| store.rerunswas always truthy. The warning is now gated onstore.reruns.length > 0, so it only appears when tests were actually rerun (or the run spanned multiple run ids).Changes
src/command/Testall.ts— checkstore.reruns.length > 0instead of the always-truthy array reference.test/command/Testall.spec.ts— regression tests: no warning on a clean run with coverage enabled and no reruns; warning still emitted when tests were rerun.CHANGELOG.md— bullet under the unreleased3.4.0section.Testing
pnpm build— cleanpnpm lint— cleanpnpm test— 101 passed (17 suites), including the 2 new regression tests