Skip to content

chore: check source-code coverage statistics for published packages - #3456

Merged
kumilingus merged 9 commits into
clientIO:masterfrom
zbynekstara:sonar-coverage
Aug 17, 2026
Merged

chore: check source-code coverage statistics for published packages#3456
kumilingus merged 9 commits into
clientIO:masterfrom
zbynekstara:sonar-coverage

Conversation

@zbynekstara

@zbynekstara zbynekstara commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

Enforces checking coverage statistics for published packages, source-mapped to source code.

Makes these statistics available to sonarqube.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sonar-project.properties Outdated
Comment thread .github/workflows/sonar.yml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-coverage runs Karma without building the test bundle first, but karma.conf.js now requires ./build/test/index.js. On a clean checkout (or after yarn clean), yarn test-coverage will fail unless the user remembers to run yarn build beforehand. Consider making test-coverage mirror test by building first.
    "test-coverage": "karma start karma.conf.js",

packages/joint-core/rollup.resources.mjs:111

  • bundleWithSourceMap notes it only supports single-output configs, but it still maps all outputs to the same file. If someone accidentally passes a multi-output config (like joint, 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, the test and test-coverage scripts don't run yarn build first, so yarn test / yarn test-coverage will fail on a fresh checkout unless the package was built earlier (e.g., via yarn dist).
    "test": "mocha test/nodejs/nodejs.js && karma start karma.conf.js",
    "test-coverage": "karma start karma.conf.js",

@kumilingus
kumilingus merged commit 0fe69e1 into clientIO:master Aug 17, 2026
3 checks passed
@zbynekstara
zbynekstara deleted the sonar-coverage branch August 17, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants