Repository navigation
feat: run tests with coverage and show it in the editor - #19
Merged
Merged
Conversation
Sam Gammon (sgammon)
requested a review
from Dario Valdespino (darvld)
as a code owner
October 12, 2026 23:28
Sam Gammon (sgammon)
force-pushed
the
feat/test-coverage
branch
2 times, most recently
from
October 12, 2026 23:50
31fbb16 to
bb4ff24
Compare
Adds a Run with Coverage test profile. It runs elide test --coverage and publishes the guest LCOV and JVM JaCoCo XML reports the run writes under .dev to VS Code's coverage gutter and Test Coverage view, with per-line branch counts. JaCoCo execution data alone cannot be read, so it earns a hint to ask for the XML report in the manifest. Signed-off-by: Sam Gammon <sam@elide.dev>
Sam Gammon (sgammon)
force-pushed
the
feat/test-coverage
branch
from
October 13, 2026 00:16
bb4ff24 to
3d549bf
Compare
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.
What
A Run with Coverage test profile, next to Run and Debug. It runs
elide test --coverage(plus the usual--reporter=tapand-tpattern) and, once the run exits, publishes the coverage reports Elide wrote to VS Code's coverage gutter, inline view and Test Coverage view. Each line gets a statement count and branch counts (FileCoverage.fromDetails+loadDetailedCoverage).Why
Until now
--coveragecould only be passed throughelide.test.options, and its results were never shown in the editor.Where Elide writes coverage (checked on real binaries,
samples/ktjvmand a TypeScript project)1.6.0+865db8f07d).dev/reports/coverage/js/lcov.info(LCOV, absoluteSF:paths,DAlines only)/./.dev/reports/coverage/jvm/<task>/<task>.exec.dev/artifacts/coverage/jvm/<task>/<task>.exec.exec)coverage { jvm { reports { Coverage.xmlReport() } } }testing { coverage { jvm { reports { Jvm.xmlReport() } } } }JaCoCo
.execdata only means something together with the compiled classes and the JaCoCo analyzer, which the IntelliJ plugin bundles and an extension cannot. JVM coverage is therefore read from the JaCoCo XML report. If a run leaves only.exec, the run output says to ask for the XML report, giving both spellings of the setting. The two spellings cannot both appear in one manifest (each Elide rejects the other's), sosamples/ktjvmis unchanged. The integration test appends the right one for the installed Elide.No run code lens or launch-config path is included. On rc.2
elide run --coveragewrites.dev/reports/coverage/jvm/run/run.{exec,xml}for a JVM main, but nothing for a TypeScript entrypoint. On 1.5.4 it writes no file at all. Run lenses run as tasks, while VS Code's coverage API hangs off a test run. Wiring the two together is a follow-up once that output is settled.How
packages/core/src/coverage.ts: finds reports under both layouts, keeping only files modified since the run started; decodes LCOV (DA,BRDA) and JaCoCo XML (<sourcefile>/<line nr mi ci mb cb>, resolved against the project's source roots by package and file name); merges by path; restates LCOV paths for a project opened through a symlink.packages/vscode/src/testing.ts: the profile,--coverageon the invocation, publishing per covered project (a whole workspace run covers its members), and the.exec-only hint.ElideTestApi.runAll({ coverage: true })returns per-file statement counts for the integration test, which gains a coverage step.Verification
bun run build,bun run --filter elide typecheck,bun run test(138 pass, 11 new incoverage.test.ts),bun run --filter elide package.lcov.infofromelide test --coverageon a TypeScript project, andjacoco.xmlfromsamples/ktjvmwith a branchingclassifyfunction. The project root is replaced with/projectand the session id with a placeholder.import("elide:Coverage.pkl").xmlReport()/import("elide:Jvm.pkl").xmlReport()) was checked withelide test --coverageon rc.2 and 1.5.4: each writesjvm-test.xml.@vscode/test-electron, under Xvfb) on a copy ofsamples/ktjvmplus aClassify.kt, driven throughrunAll({ coverage: true }):Main.kt1/4 statements,Classify.kt0/3,MainTest.kt3/3.Main.ktred,greetinggreen with a1xhit badge, and the Test Coverage view atsrc28.57%,Main.kt25%,MainTest.kt100%..execpresent), so the hint path runs.bun run test:integration) was not run. It needs the 1.2 GBJetBrains.kotlin-serverextension, which is not installed here; the runs above used a stub of it.