Repository navigation
fix(normalizer): detect the container prefix from clover path= - #8
Merged
Merged
Conversation
Jest's clover reporter writes a basename in name= and the container path in path=, so prefix detection saw no absolute path and left the report untouched. Pick whichever attribute is absolute, name= first.
…hanged file diff-cover matches Clover paths exactly, so a file the report mentions under a longer or shorter path (a second container root, a path relative to a subdirectory) is never measured, yet it passed as "no executable lines changed". Emit a path-mismatch warning for that case; the verdict is unchanged. Paths under the checkout resolve in diff-cover and are exempt, JaCoCo keeps its shorter paths. Document the Jest path= handling and the warning, and ignore the local code graph directory.
🧪 Test-Guard Report✅ PASS — All changed source files have adequate test coverage. Coverage Analysis: ✅ PASSChanged lines: 100.0% covered (threshold: 100%) 📋 2 files: 2 ✅ pass
Result: ✅ PASS |
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.
Problem
Layer 1 passes every changed JS file of a Jest coverage report produced inside a container with
pass — in coverage report, but no executable lines changed, even when the diff changes executable lines. Observed on MateCat PR #4927 (run 39423022273): 4 changed JS files, 18 changed executable lines, all passed.Jest's clover reporter writes the basename in
name=and the absolute path inpath=._extract_clover_paths()readname or path, sodetect_path_prefix()never saw an absolute path, nothing was stripped, diff-cover readpath=(/var/www/...), could not match it, and the file fell intounmeasurable_absent.Changes
_extract_clover_paths()returns, per<file>, whichever ofname=/path=is absolute (name=first, thenpath=, elsename or pathas before). PHPUnit behaviour is unchanged.find_suffix_only_match();is_in_report()reuses it with identical behaviour.::warning::Coverage path mismatchwhen a changed file is in a Clover report only under a longer or shorter path. diff-cover matches Clover paths exactly (violations_reporter.py), so such a file was never measured. The verdict is unchanged; paths under the checkout are exempt; JaCoCo is excluded (its paths are legitimately shorter)..gitignore:.code-review-graph/.Verification
pytest: 466 passed (455 before, 11 new). The new normalizer and Layer 1 tests fail onmain.stripped prefix '/var/www/matecat/'; all 717path=become relative; the 4 changed files are found with their executable lines. The 4-file reduction is committed astests/fixtures/jest_clover_container_paths.xml.ruff checkis clean on the touched files.mainalready has 7ruff checkfindings (all inbenchmarks/) and 16 files thatruff format --checkwould reformat; this PR does not add to them.Release note for consumers
Consumers that run Jest in a container start being measured on JS after this ships. PRs with untested JS lines, which used to pass, will fail Layer 1. That is the intended behaviour; announce it with the release.
Not in this PR
Failing (instead of warning) a file that the report lists with executable lines on changed lines needs the per-file diff in Layer 1, a hunk parser and a per-format executable-line extractor. Deferred until a second mismatch is observed in practice.