Report coverage for package source, with repo-relative LCOV paths - #9
Merged
Conversation
Two things made the LCOV `juliati --coverage-lcov` writes unusable to a coverage service. Coverage roots were the package root folders, so the test process kept every instrumented file under the package — `test/`, `docs/`, loose scripts — where `julia-processcoverage` reports `src` and nothing else. Counting a package's own test files as covered source moves the reported percentage for no good reason. The roots now name `src` and `ext` explicitly. And the `SF:` paths were absolute, because `write_lcov` was called without a root while the JUnit writer three lines above already passed one. Codecov, Coveralls and `genhtml` match `SF:` paths against paths in the repository, and the absolute paths of a CI runner match nothing at all — which is how a fully covered package ends up reported as 0%. Only the app is narrowed: TestItemRuns keeps whole-package coverage, since a consumer asking how well a test file is exercised is asking something legitimate. Requires TestItemControllers with `write_lcov(...; root=)`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`cli.jl` calls `write_lcov(...; root=)`, which 1.8.0 is the first release to have. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
davidanthoff
marked this pull request as ready for review
August 20, 2026 19:28
Member
Author
|
Unblocked: TestItemControllers 1.8.0 is registered and carries |
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.
Part of julia-testitems/testitem-workflow#11 (Codecov reporting 0%). Companion to julia-testitems/TestItemControllers.jl#73; workflow-side fix is julia-testitems/testitem-workflow#13.
Warning
Blocked:
cli.jlcallswrite_lcov(...; root=), which lands in TestItemControllers.jl#73. Merge that and release it before merging this, ormainbreaks against the registered TestItemControllers 1.7.0.[compat] TestItemControllers = "1.7"is deliberately left alone here — it needs bumping in the same commit that follows the TestItemControllers release.Coverage covered the whole package, not its source
coverage_root_uriswas built frompackage_uri, which is the folder holdingProject.toml— notsrc. The test process filter keeps everything under a root, sotest/,docs/and any loose script landed in the report, wherejulia-processcoveragereportssrcand nothing else. Counting a package's own test files as covered source moves the reported percentage for no good reason.The roots now name
srcandextexplicitly (extis package code too). Plain string concatenation, notjoinpath— these are URIs, and neither name needs escaping.Only the app is narrowed. The identical computation in TestItemRuns keeps whole-package coverage: that is the library path behind VS Code and JuliaMCP, where "how well is my test file exercised" is a legitimate question.
SF:paths were absolutewrite_lcovwas called without a root, while the JUnit writer three lines above already passedroot=abspath(opts.path). Codecov, Coveralls andgenhtmlmatchSF:paths against paths in the repository, and the absolute paths of a CI runner match nothing at all.The action invokes
juliatiwithtest-pathdefaulting to.and cwd =GITHUB_WORKSPACE, soabspath(opts.path)is the repo root in the CI configuration. As with--junit-xml, pointingjuliatiat a subfolder makes paths relative to that subfolder.The precompile workload passes
roottoo, so the path that actually runs is the one that gets precompiled.Tests
Full suite green, 31/31 on Windows against a locally dev'd TestItemControllers.jl#73.
run_tests collects coveragenow asserts no/test/file appears inresult.coverage, and thatwrite_lcov(...; root=fixture)emitsSF:src/AppTestPkg.jlwith no unix absolute path and no drive letter.--coverage-lcov writes repo-relative source paths, a CLI-level run throughreal_mainasserting everySF:line starts withsrc/and the file contains no backslash — the end-to-end shape a coverage service can match against a repository.🤖 Generated with Claude Code