chore: check source-code coverage statistics for published packages - #3456
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens coverage reporting for published workspaces by generating LCOV reports that are source-mapped back to original source files and then ingesting those reports into SonarQube during CI.
Changes:
- Adds source-mapped coverage generation for Karma- and Jest-tested workspaces and enforces workspace-specific coverage thresholds.
- Configures SonarQube to ingest per-workspace LCOV output and refines analysis scope/exclusions.
- Updates the SonarQube GitHub Actions workflow to build, run coverage, and then execute Sonar analysis.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds karma-sourcemap-loader to the lockfile for sourcemap-based coverage remapping. |
| sonar-project.properties | Adds clearer Sonar configuration, LCOV ingestion path, and coverage exclusions for non-reporting packages. |
| packages/joint-react/package.json | Adds coverage scripts to produce LCOV for Sonar. |
| packages/joint-react/jest.config.js | Enforces Jest coverage thresholds and conditionally emits LCOV with repo-root-relative paths. |
| packages/joint-react/coverage.json | Introduces baseline coverage thresholds for the React workspace. |
| packages/joint-layout-msagl/rollup.config.mjs | Adds a source-mapped test bundle build for Karma coverage remapping. |
| packages/joint-layout-msagl/package.json | Adds coverage scripts and karma-sourcemap-loader dependency. |
| packages/joint-layout-msagl/karma.conf.js | Switches coverage input to the new source-mapped test bundle; adds thresholds and LCOV output. |
| packages/joint-layout-msagl/coverage.json | Introduces baseline coverage thresholds for the MSAGL workspace. |
| packages/joint-layout-msagl/.gitignore | Ignores new build/ outputs created for test bundling. |
| packages/joint-layout-directed-graph/rollup.config.mjs | Adds a source-mapped test bundle output for Karma coverage remapping. |
| packages/joint-layout-directed-graph/package.json | Adds coverage scripts and karma-sourcemap-loader dependency. |
| packages/joint-layout-directed-graph/karma.conf.js | Switches coverage input to the new source-mapped test bundle; adds thresholds and LCOV output. |
| packages/joint-layout-directed-graph/coverage.json | Introduces baseline coverage thresholds for the directed-graph workspace. |
| packages/joint-core/rollup.resources.mjs | Adds source-mapped test bundle variants for Karma to map coverage back to src/. |
| packages/joint-core/rollup.config.mjs | Updates the test-bundle rollup target list to the new source-mapped test bundles. |
| packages/joint-core/package.json | Adds karma-sourcemap-loader and aligns coverage script env-var interface. |
| packages/joint-core/grunt/resources/esm.js | Adds build/test/* output paths for source-mapped test bundles. |
| packages/joint-core/grunt/config/karma.js | Enables sourcemap preprocessing for coverage remapping and LCOV output normalization. |
| packages/joint-core/grunt/config/copy.js | Ensures test bundles aren’t included in distribution copy output. |
| packages/joint-core/coverage.json | Updates coverage baselines to reflect new mapping behavior. |
| .github/workflows/sonar.yml | Builds, runs coverage, and then runs SonarQube analysis and quality gate checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 22 changed files in this pull request and generated no new comments.
Suppressed comments (3)
packages/joint-layout-msagl/package.json:44
test-coverageruns Karma without building the test bundle first, butkarma.conf.jsnow requires./build/test/index.js. On a clean checkout (or afteryarn clean),yarn test-coveragewill fail unless the user remembers to runyarn buildbeforehand. Consider makingtest-coveragemirrortestby building first.
"test-coverage": "karma start karma.conf.js",
packages/joint-core/rollup.resources.mjs:111
bundleWithSourceMapnotes it only supports single-output configs, but it still maps all outputs to the samefile. If someone accidentally passes a multi-output config (likejoint, which has two outputs), Rollup would overwrite bundles and silently keep only the last one. Adding an explicit guard makes this failure mode obvious.
const bundleWithSourceMap = (config, file) => ({
...config,
output: config.output.map((output) => ({ ...output, file, sourcemap: true }))
});
packages/joint-layout-directed-graph/package.json:40
- The Karma configuration now loads
./build/test/DirectedGraph.js, which is generated by Rollup and is gitignored. However, thetestandtest-coveragescripts don't runyarn buildfirst, soyarn test/yarn test-coveragewill fail on a fresh checkout unless the package was built earlier (e.g., viayarn dist).
"test": "mocha test/nodejs/nodejs.js && karma start karma.conf.js",
"test-coverage": "karma start karma.conf.js",
kumilingus
approved these changes
Aug 17, 2026
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.
Description
Enforces checking coverage statistics for published packages, source-mapped to source code.
Makes these statistics available to sonarqube.