Skip to content

[TeamCity] Add 'metric' query parameter to TeamCity coverage badge - #12147

Open
Filipot2 wants to merge 2 commits into
badges:masterfrom
Filipot2:feature/teamcity-coverage-metric
Open

[TeamCity] Add 'metric' query parameter to TeamCity coverage badge#12147
Filipot2 wants to merge 2 commits into
badges:masterfrom
Filipot2:feature/teamcity-coverage-metric

Conversation

@Filipot2

@Filipot2 Filipot2 commented Sep 3, 2026

Copy link
Copy Markdown

Added a new metric query parameter to the TeamCity coverage badge to allow users to specify which coverage type to display (e.g., line, block, method, class, branch).

  • Kept backward compatibility by setting the default metric to statement (which maps to S), so existing badge URLs will not break.
  • The metric codes (S, L, M, C, B, R) map directly to TeamCity's internal CodeCoverageAbs* statistical values. Reference: TeamCity Custom Chart Documentation.

Testing & Mocking Details:
I was unable to test against the live JetBrains TeamCity server (https://teamcity.jetbrains.com) because it now requires authentication to view statistics for the FileHelpersStable build (it returns a 401 Unauthorized / inaccessible error for guests).

Because I couldn't hit the actual API, I tested this logic entirely via the local mocked service tests in teamcity-coverage.tester.js. The tests intercept the outbound request and feed it mocked JSON responses to prove that the code correctly extracts the different metric values (like CodeCoverageAbsLCovered) and calculates the percentage accurately without needing a live, public TeamCity server.

Closes #<#3111>

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 ✨ Thanks for your contribution to Shields, @Filipot2!

Generated by 🚫 dangerJS against 963d7ea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant