apex-code-coverage-transformer 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@
5
5
 
6
6
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
7
7
 
8
+ ## [3.1.3](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.1.2...v3.1.3) (2026-08-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **action:** remove @salesforce/core Logger call breaking the bundled Action ([#386](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/386)) ([ae14d34](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/ae14d349058fe9a3ef3e3cff59ec2cfad06a8338))
14
+
8
15
  ## [3.1.2](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.1.1...v3.1.2) (2026-08-21)
9
16
 
10
17
 
package/README.md CHANGED
@@ -2,18 +2,20 @@
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/apex-code-coverage-transformer.svg?label=apex-code-coverage-transformer)](https://www.npmjs.com/package/apex-code-coverage-transformer)
4
4
  [![Downloads/week](https://img.shields.io/npm/dw/apex-code-coverage-transformer.svg)](https://npmjs.org/package/apex-code-coverage-transformer)
5
+ [![GitHub Marketplace](https://img.shields.io/badge/marketplace-apex--code--coverage--transformer-blue?logo=github)](https://github.com/marketplace/actions/apex-code-coverage-transformer)
5
6
  [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/LICENSE.md)
6
7
  [![Maintainability](https://qlty.sh/badges/11057a07-84da-41af-91fb-b3476e404242/maintainability.svg)](https://qlty.sh/gh/mcarvin8/projects/apex-code-coverage-transformer)
7
8
  [![codecov](https://codecov.io/gh/mcarvin8/apex-code-coverage-transformer/graph/badge.svg?token=4IQ4NWTPQZ)](https://codecov.io/gh/mcarvin8/apex-code-coverage-transformer)
8
9
  [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fmcarvin8%2Fapex-code-coverage-transformer%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/mcarvin8/apex-code-coverage-transformer/main)
9
10
 
10
- A Salesforce CLI plugin that transforms (and optionally merges) Apex code coverage JSON from deployments or test runs into formats used by SonarQube, Codecov, GitHub, GitLab, Azure DevOps, Bitbucket, and other tools, keeping coverage visible across pull requests, CI/CD pipelines, and code quality platforms.
11
+ Transforms (and optionally merges) Apex code coverage JSON from Salesforce deployments or test runs into formats used by SonarQube, Codecov, GitHub, GitLab, Azure DevOps, Bitbucket, and other tools, keeping coverage visible across pull requests, CI/CD pipelines, and code quality platforms. Available as a **Salesforce CLI plugin** for any provider, and as a **native GitHub Action** for GitHub Actions users who want to skip installing the CLI.
11
12
 
12
13
  <details>
13
14
  <summary>Table of Contents</summary>
14
15
 
15
16
  - [Prerequisites](#prerequisites)
16
17
  - [Install](#install)
18
+ - [GitHub Action](#github-action)
17
19
  - [Quick Start](#quick-start)
18
20
  - [Usage](#usage)
19
21
  - [Command Reference](#command-reference)
@@ -39,6 +41,21 @@ A Salesforce CLI plugin that transforms (and optionally merges) Apex code covera
39
41
  sf plugins install apex-code-coverage-transformer@latest
40
42
  ```
41
43
 
44
+ ## GitHub Action
45
+
46
+ For GitHub Actions, this is also available as a [native Action](https://github.com/marketplace/actions/apex-code-coverage-transformer) - no `sf` CLI or plugin install required:
47
+
48
+ ```yaml
49
+ - name: Transform Coverage
50
+ uses: mcarvin8/apex-code-coverage-transformer@v3
51
+ with:
52
+ coverage-json: coverage/test-result-codecoverage.json
53
+ output-report: coverage.xml
54
+ format: sonar
55
+ ```
56
+
57
+ It still needs the checkout to contain `sfdx-project.json` (same as the CLI's [Prerequisites](#prerequisites) above) - use `actions/checkout` first. See [GitHub Actions](#github-actions) under CI/CD Integration for the full input/output reference and more examples.
58
+
42
59
  ## Quick Start
43
60
 
44
61
  1. **Generate Apex code coverage (JSON)**
@@ -176,7 +193,7 @@ EXAMPLES
176
193
  `sf acc-transformer transform -j "coverage1.json" -j "coverage2.json" -r "coverage.xml" -f "sonar"`
177
194
  ```
178
195
 
179
- _See code: [src/commands/acc-transformer/transform.ts](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/v3.1.2/src/commands/acc-transformer/transform.ts)_
196
+ _See code: [src/commands/acc-transformer/transform.ts](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/v3.1.3/src/commands/acc-transformer/transform.ts)_
180
197
  <!-- commandsstop -->
181
198
 
182
199
  ## Coverage Report Formats
@@ -573,24 +590,12 @@ Error (1): ENOENT: no such file or directory: {packageDir}
573
590
 
574
591
  **Deploy coverage line numbers** — The Salesforce CLI deploy coverage JSON contains known out-of-range line numbers. This plugin corrects them automatically by re-numbering covered lines; uncovered lines are unaffected. Test-command coverage is unaffected. See [forcedotcom/salesforcedx-vscode#5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511) and [forcedotcom/cli#1568](https://github.com/forcedotcom/cli/issues/1568).
575
592
 
576
- To see each remapping, set `SF_LOG_LEVEL=debug` before running the command:
577
-
578
- ```bash
579
- SF_LOG_LEVEL=debug sf acc-transformer transform -j "coverage/coverage/coverage.json" -r "coverage.xml" -f "sonar"
580
- ```
581
-
582
- Each remapped line emits a log entry like:
583
-
584
- ```
585
- Remapping out-of-range covered line 512 to line 47 in force-app/main/default/classes/AccountHandler.cls (file has 98 lines)
586
- ```
587
-
588
- Logs are written to `~/.sf/sf-YYYY-MM-DD.log` by default. To print them to the terminal as well, set `DEBUG=sf:setCoveredLines`.
593
+ To see each remapping, set `SF_LOG_LEVEL=debug` before running the command - each remapped line prints directly to the terminal:
589
594
 
590
595
  ```bash
591
- $ SF_LOG_LEVEL=debug DEBUG=sf:setCoveredLines sf acc-transformer transform -j "coverage/coverage/coverage.json" -r "coverage.xml" -f "sonar"
596
+ $ SF_LOG_LEVEL=debug sf acc-transformer transform -j "coverage/coverage/coverage.json" -r "coverage.xml" -f "sonar"
597
+ [DEBUG] setCoveredLines: Remapping out-of-range covered line 512 to line 47 in force-app/main/default/classes/AccountHandler.cls (file has 98 lines)
592
598
  The coverage report has been written to: coverage.xml
593
- [16:10:20.826] DEBUG (sf:setCoveredLines): Remapping out-of-range covered line 190 to line 1 in force-app/main/default/triggers/AccountTrigger.trigger (file has 105 lines)
594
599
  ```
595
600
 
596
601
  ## Questions or Issues?
@@ -1,9 +1,13 @@
1
1
  'use strict';
2
2
  import { join } from 'node:path';
3
- import { Logger } from '@salesforce/core';
4
3
  import { getTotalLines } from './getTotalLines.js';
4
+ function debugLog(message) {
5
+ if (process.env.SF_LOG_LEVEL === 'debug') {
6
+ // eslint-disable-next-line no-console
7
+ console.debug(`[DEBUG] setCoveredLines: ${message}`);
8
+ }
9
+ }
5
10
  export async function setCoveredLines(filePath, repoRoot, lines, returnSourceContent = false) {
6
- const logger = await Logger.child('setCoveredLines');
7
11
  const result = await getTotalLines(join(repoRoot, filePath), returnSourceContent);
8
12
  const totalLines = typeof result === 'number' ? result : result.totalLines;
9
13
  const updatedLines = {};
@@ -14,7 +18,7 @@ export async function setCoveredLines(filePath, repoRoot, lines, returnSourceCon
14
18
  if (status === 1 && lineNumber > totalLines) {
15
19
  for (let randomLine = 1; randomLine <= totalLines; randomLine++) {
16
20
  if (!usedLines.has(randomLine)) {
17
- logger.debug(`Remapping out-of-range covered line ${lineNumber} to line ${randomLine} in ${filePath} (file has ${totalLines} lines)`);
21
+ debugLog(`Remapping out-of-range covered line ${lineNumber} to line ${randomLine} in ${filePath} (file has ${totalLines} lines)`);
18
22
  updatedLines[randomLine.toString()] = status;
19
23
  usedLines.add(randomLine);
20
24
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"setCoveredLines.js","sourceRoot":"","sources":["../../src/utils/setCoveredLines.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,E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AE,YAAY,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -131,5 +131,5 @@
131
131
  ]
132
132
  }
133
133
  },
134
- "version": "3.1.2"
134
+ "version": "3.1.3"
135
135
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "apex-code-coverage-transformer",
3
3
  "description": "Transform Salesforce Apex code coverage JSON for SonarQube, SonarCloud, GitHub, GitLab, Azure, and Bitbucket",
4
- "version": "3.1.2",
4
+ "version": "3.1.3",
5
5
  "dependencies": {
6
6
  "@oclif/core": "4.13.3",
7
7
  "@salesforce/core": "9.1.2",