UNPKG

apex-code-coverage-transformer

Version:

Transform Salesforce Apex code coverage JSONs into other formats accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.

50 lines (49 loc) 1.61 kB
import { JsonSummaryCoverageObject } from '../utils/types.js'; import { BaseHandler } from './BaseHandler.js'; /** * Handler for generating JSON Summary coverage reports. * * This format provides a concise summary of coverage statistics, * ideal for badges, PR comments, and quick analysis. * * **Format Origin**: Istanbul/NYC coverage tools * * @see https://istanbul.js.org/ * @see https://github.com/istanbuljs/nyc * * **Apex-Specific Adaptations**: * - Salesforce Apex only provides line-level coverage data * - `statements`, `functions`, and `branches` metrics mirror line coverage * - In native JavaScript environments, these would be distinct metrics * - `skipped` is always 0 (Apex doesn't report skipped lines) * * **Limitations**: * - No branch coverage (if/else paths) - Apex doesn't provide this data * - No function/method coverage separate from lines * - No statement coverage distinct from line coverage * * Compatible with: * - GitHub Actions (for badges and PR comments) * - GitLab CI (for MR comments) * - Custom reporting dashboards * * @example * ```json * { * "total": { * "lines": { "total": 100, "covered": 75, "skipped": 0, "pct": 75 } * }, * "files": { * "path/to/file.cls": { * "lines": { "total": 50, "covered": 40, "skipped": 0, "pct": 80 } * } * } * } * ``` */ export declare class JsonSummaryCoverageHandler extends BaseHandler { private readonly coverageObj; constructor(); processFile(filePath: string, _fileName: string, lines: Record<string, number>): void; finalize(): JsonSummaryCoverageObject; }