apex-code-coverage-transformer 2.2.1 → 2.3.0

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
+ ## [2.3.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.2.1...v2.3.0) (2024-12-17)
9
+
10
+
11
+ ### Features
12
+
13
+ * add support for cobertura format ([41a3b25](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/41a3b2583ce1014ccd04f935c5c8b87831bee2e7))
14
+
8
15
  ## [2.2.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.2.0...v2.2.1) (2024-12-14)
9
16
 
10
17
 
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  - [License](#license)
19
19
  </details>
20
20
 
21
- A Salesforce CLI plugin to transform the Apex code coverage JSON files created during deployments and test runs into the generic test coverage format (XML) accepted by SonarQube.
21
+ A Salesforce CLI plugin to transform the Apex code coverage JSON files created during deployments and test runs into SonarQube format or Cobertura format.
22
22
 
23
23
  ## Install
24
24
 
@@ -28,14 +28,16 @@ sf plugins install apex-code-coverage-transformer@x.y.z
28
28
 
29
29
  ## Who is the Plugin For?
30
30
 
31
- This plugin is intended for users who deploy their Apex codebase (Apex classes and triggers) from any Salesforce DX repository (`sfdx-project.json` file), not just git-based ones. You should be running this plugin somewhere inside your Salesforce DX repository (root folder preferred). This plugin searches for your repository's `sfdx-project.json` file to know which package directories to search into. Since SonarQube relies on file-paths to map code coverage to the files in their explorer interface, the Apex files must be found in one of your package directories.
31
+ This plugin is intended for users who deploy their Apex codebase (Apex classes and triggers) from any Salesforce DX repository (`sfdx-project.json` file), not just git-based ones. You should be running this plugin somewhere inside your Salesforce DX repository (root folder preferred). This plugin searches for your repository's `sfdx-project.json` file to know which package directories to search into. The Apex files must be found in one of your package directories.
32
32
 
33
- This plugin will work if you run local tests or run all tests in an org, including tests that originate from installed managed and unlocked packages. Since files from managed and unlocked packages aren't retrieved into Salesforce DX repositories, these files cannot be included in your SonarQube scans.
33
+ This plugin will work if you run local tests or run all tests in an org, including tests that originate from installed managed and unlocked packages. Since files from managed and unlocked packages aren't retrieved into Salesforce DX repositories, these files cannot be included in your code coverage reports.
34
34
 
35
- When the plugin is unable to find the Apex file from the coverage report in your repository, it will print a warning and not add that file's coverage data to the coverage XML created by this plugin. A warning will be printed for each file not found in a package directory in your repository. See [Errors and Warnings](https://github.com/mcarvin8/apex-code-coverage-transformer?tab=readme-ov-file#errors-and-warnings) for more information.
35
+ When the plugin is unable to find the Apex file from the Salesforce CLI coverage report in your repository, it will print a warning and not add that file's coverage data to the coverage XML created by this plugin. A warning will be printed for each file not found in a package directory in your repository. See [Errors and Warnings](https://github.com/mcarvin8/apex-code-coverage-transformer?tab=readme-ov-file#errors-and-warnings) for more information.
36
36
 
37
37
  ## Creating Code Coverage Files with the Salesforce CLI
38
38
 
39
+ **This tool will only support the JSON coverage format from the Salesforce CLI. Do not use "json-summary" or Salesforce's cobertura output.**
40
+
39
41
  To create the code coverage JSON during a Salesforce CLI deployment/validation, append `--coverage-formatters json --results-dir "coverage"` to the `sf project deploy` command. This will create a coverage JSON in this relative path - `coverage/coverage/coverage.json`.
40
42
 
41
43
  ```
@@ -49,7 +51,7 @@ sf apex run test --code-coverage --result-format json --output-dir "coverage"
49
51
  sf apex get test --test-run-id <test run id> --code-coverage --result-format json --output-dir "coverage"
50
52
  ```
51
53
 
52
- The code coverage JSONs created by the Salesforce CLI aren't accepted by SonarQube automatically for Salesforce DX repositories and needs to be converted using this plugin.
54
+ The code coverage JSONs created by the Salesforce CLI aren't accepted automatically for Salesforce DX repositories and needs to be converted using this plugin.
53
55
 
54
56
  **Disclaimer**: Due to existing bugs with how the Salesforce CLI reports covered lines during deployments (see [5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511) and [1568](https://github.com/forcedotcom/cli/issues/1568)), to add support for covered lines in this plugin for deployment coverage files, I had to add a function to re-number out-of-range covered lines the CLI may report (ex: line 100 in a 98-line Apex Class is reported back as covered by the Salesforce CLI deploy command). Salesforce's coverage result may also include extra lines as covered (ex: 120 lines are included in the coverage report for a 100 line file), so the coverage percentage may vary based on how many lines the API returns in the coverage report. Once Salesforce fixes the API to correctly return covered lines in the deploy command, this function will be removed.
55
57
 
@@ -63,20 +65,26 @@ The `apex-code-coverage-transformer` has 1 command:
63
65
 
64
66
  ```
65
67
  USAGE
66
- $ sf acc-transformer transform -j <value> -x <value> [--json]
68
+ $ sf acc-transformer transform -j <value> -x <value> -f <value> [--json]
67
69
 
68
70
  FLAGS
69
- -j, --coverage-json=<value> Path to the code coverage JSON file created by the Salesforce CLI deployment or test command.
70
- -x, --xml=<value> [default: "coverage.xml"] Path to code coverage XML file that will be created by this plugin.
71
+ -j, --coverage-json=<value> Path to the code coverage JSON file created by the Salesforce CLI deploy or test command.
72
+ -x, --xml=<value> Path to the code coverage XML file that will be created by this plugin.
73
+ [default: "coverage.xml"]
74
+ -f, --format=<value> Output format for the code coverage format.
75
+ Valid options are "sonar" or "cobertura".
76
+ [default: "sonar"]
71
77
 
72
78
  GLOBAL FLAGS
73
79
  --json Format output as json.
74
80
 
75
81
  DESCRIPTION
76
- This plugin will convert the code coverage JSON file created by the Salesforce CLI during Apex deployments and test runs into an XML accepted by tools like SonarQube.
82
+ Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube or Cobertura format.
77
83
 
78
84
  EXAMPLES
79
- $ sf acc-transformer transform -j "coverage.json" -x "coverage.xml"
85
+ $ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "sonar"
86
+
87
+ $ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "cobertura"
80
88
  ```
81
89
 
82
90
  ## Hook
@@ -93,13 +101,15 @@ The `.apexcodecovtransformer.config.json` should look like this:
93
101
  {
94
102
  "deployCoverageJsonPath": "coverage/coverage/coverage.json",
95
103
  "testCoverageJsonPath": "coverage/test-coverage.json",
96
- "coverageXmlPath": "coverage.xml"
104
+ "coverageXmlPath": "coverage.xml",
105
+ "format": "sonar"
97
106
  }
98
107
  ```
99
108
 
100
109
  - `deployCoverageJsonPath` is required to use the hook after deployments and should be the path to the code coverage JSON created by the Salesforce CLI deployment command. Recommend using a relative path.
101
110
  - `testCoverageJsonPath` is required to use the hook after test runs and should be the path to the code coverage JSON created by the Salesforce CLI test command. Recommend using a relative path.
102
111
  - `coverageXmlPath` is optional and should be the path to the code coverage XML created by this plugin. Recommend using a relative path. If this isn't provided, it will default to `coverage.xml` in the working directory.
112
+ - `format` is optional and should be the intended output format for the code coverage XML created by this plugin. Options are "sonar" or "cobertura". If this isn't provided, it will default to "sonar".
103
113
 
104
114
  If the `.apexcodecovtransformer.config.json` file isn't found, the hook will be skipped.
105
115
 
@@ -141,7 +151,7 @@ Error (1): ENOENT: no such file or directory: {packageDirPath}
141
151
 
142
152
  ## Example
143
153
 
144
- This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_no_file_exts.json) created during a Salesforce CLI deployment will be transformed into:
154
+ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_no_file_exts.json) created during a Salesforce CLI deployment will be transformed into this format for SonarQube:
145
155
 
146
156
  ```xml
147
157
  <?xml version="1.0"?>
@@ -215,6 +225,96 @@ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-c
215
225
  </coverage>
216
226
  ```
217
227
 
228
+ and this format for Cobertura:
229
+
230
+ ```xml
231
+ <?xml version="1.0" ?>
232
+ <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
233
+ <coverage lines-valid="62" lines-covered="54" line-rate="0.871" branches-valid="0" branches-covered="0" branch-rate="1" timestamp="1734405832938" complexity="0" version="0.1">
234
+ <sources>
235
+ <source>.</source>
236
+ </sources>
237
+ <packages>
238
+ <package name="main" line-rate="0.871" branch-rate="1">
239
+ <classes>
240
+ <class name="AccountTrigger" filename="test/baselines/triggers/AccountTrigger.trigger" line-rate="0.8710" branch-rate="1">
241
+ <methods/>
242
+ <lines>
243
+ <line number="52" hits="0" branch="false"/>
244
+ <line number="53" hits="0" branch="false"/>
245
+ <line number="59" hits="0" branch="false"/>
246
+ <line number="60" hits="0" branch="false"/>
247
+ <line number="1" hits="1" branch="false"/>
248
+ <line number="2" hits="1" branch="false"/>
249
+ <line number="3" hits="1" branch="false"/>
250
+ <line number="4" hits="1" branch="false"/>
251
+ <line number="5" hits="1" branch="false"/>
252
+ <line number="6" hits="1" branch="false"/>
253
+ <line number="7" hits="1" branch="false"/>
254
+ <line number="8" hits="1" branch="false"/>
255
+ <line number="9" hits="1" branch="false"/>
256
+ <line number="10" hits="1" branch="false"/>
257
+ <line number="11" hits="1" branch="false"/>
258
+ <line number="12" hits="1" branch="false"/>
259
+ <line number="13" hits="1" branch="false"/>
260
+ <line number="14" hits="1" branch="false"/>
261
+ <line number="15" hits="1" branch="false"/>
262
+ <line number="16" hits="1" branch="false"/>
263
+ <line number="17" hits="1" branch="false"/>
264
+ <line number="18" hits="1" branch="false"/>
265
+ <line number="19" hits="1" branch="false"/>
266
+ <line number="20" hits="1" branch="false"/>
267
+ <line number="21" hits="1" branch="false"/>
268
+ <line number="22" hits="1" branch="false"/>
269
+ <line number="23" hits="1" branch="false"/>
270
+ <line number="24" hits="1" branch="false"/>
271
+ <line number="25" hits="1" branch="false"/>
272
+ <line number="26" hits="1" branch="false"/>
273
+ <line number="27" hits="1" branch="false"/>
274
+ </lines>
275
+ </class>
276
+ <class name="AccountProfile" filename="test/baselines/classes/AccountProfile.cls" line-rate="0.8710" branch-rate="1">
277
+ <methods/>
278
+ <lines>
279
+ <line number="52" hits="0" branch="false"/>
280
+ <line number="53" hits="0" branch="false"/>
281
+ <line number="59" hits="0" branch="false"/>
282
+ <line number="60" hits="0" branch="false"/>
283
+ <line number="54" hits="1" branch="false"/>
284
+ <line number="55" hits="1" branch="false"/>
285
+ <line number="56" hits="1" branch="false"/>
286
+ <line number="57" hits="1" branch="false"/>
287
+ <line number="58" hits="1" branch="false"/>
288
+ <line number="61" hits="1" branch="false"/>
289
+ <line number="62" hits="1" branch="false"/>
290
+ <line number="63" hits="1" branch="false"/>
291
+ <line number="64" hits="1" branch="false"/>
292
+ <line number="65" hits="1" branch="false"/>
293
+ <line number="66" hits="1" branch="false"/>
294
+ <line number="67" hits="1" branch="false"/>
295
+ <line number="68" hits="1" branch="false"/>
296
+ <line number="69" hits="1" branch="false"/>
297
+ <line number="70" hits="1" branch="false"/>
298
+ <line number="71" hits="1" branch="false"/>
299
+ <line number="72" hits="1" branch="false"/>
300
+ <line number="1" hits="1" branch="false"/>
301
+ <line number="2" hits="1" branch="false"/>
302
+ <line number="3" hits="1" branch="false"/>
303
+ <line number="4" hits="1" branch="false"/>
304
+ <line number="5" hits="1" branch="false"/>
305
+ <line number="6" hits="1" branch="false"/>
306
+ <line number="7" hits="1" branch="false"/>
307
+ <line number="8" hits="1" branch="false"/>
308
+ <line number="9" hits="1" branch="false"/>
309
+ <line number="10" hits="1" branch="false"/>
310
+ </lines>
311
+ </class>
312
+ </classes>
313
+ </package>
314
+ </packages>
315
+ </coverage>
316
+ ```
317
+
218
318
  ## Issues
219
319
 
220
320
  If you encounter any issues, please create an issue in the repository's [issue tracker](https://github.com/mcarvin8/apex-code-coverage-transformer/issues). Please also create issues to suggest any new features.
@@ -7,6 +7,7 @@ export default class TransformerTransform extends SfCommand<TransformerTransform
7
7
  static readonly flags: {
8
8
  'coverage-json': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
9
  xml: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
11
  };
11
12
  run(): Promise<TransformerTransformResult>;
12
13
  }
@@ -26,11 +26,20 @@ export default class TransformerTransform extends SfCommand {
26
26
  exists: false,
27
27
  default: 'coverage.xml',
28
28
  }),
29
+ format: Flags.string({
30
+ summary: messages.getMessage('flags.format.summary'),
31
+ char: 'f',
32
+ required: true,
33
+ multiple: false,
34
+ default: 'sonar',
35
+ options: ['sonar', 'cobertura'],
36
+ }),
29
37
  };
30
38
  async run() {
31
39
  const { flags } = await this.parse(TransformerTransform);
32
40
  const jsonFilePath = resolve(flags['coverage-json']);
33
41
  const xmlFilePath = resolve(flags['xml']);
42
+ const format = flags['format'];
34
43
  const jsonData = await readFile(jsonFilePath, 'utf-8');
35
44
  let xmlData;
36
45
  let warnings = [];
@@ -39,13 +48,13 @@ export default class TransformerTransform extends SfCommand {
39
48
  const commandType = checkCoverageDataType(parsedData);
40
49
  // Determine the type of coverage data using type guards
41
50
  if (commandType === 'TestCoverageData') {
42
- const result = await transformTestCoverageReport(parsedData);
51
+ const result = await transformTestCoverageReport(parsedData, format);
43
52
  xmlData = result.xml;
44
53
  warnings = result.warnings;
45
54
  filesProcessed = result.filesProcessed;
46
55
  }
47
56
  else if (commandType === 'DeployCoverageData') {
48
- const result = await transformDeployCoverageReport(parsedData);
57
+ const result = await transformDeployCoverageReport(parsedData, format);
49
58
  xmlData = result.xml;
50
59
  warnings = result.warnings;
51
60
  filesProcessed = result.filesProcessed;
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/commands/acc-transformer/transform.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAA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kB,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,UAAgC,EAAE,MAAM,CAAC,CAAC;YAC3F,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC;YACrB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YAC3B,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QACzC,CAAC;aAAM,IAAI,WAAW,KAAK,oBAAoB,EAAE,CAAC;YAChD,MAAM,MAAM,GAAG,MAAM,6BAA6B,CAAC,UAAgC,EAAE,MAAM,CAAC,CAAC;YAC7F,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC;YACrB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YAC3B,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CACR,2GAA2G,CAC5G,CAAC;QACJ,CAAC;QAED,wBAAwB;QACxB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,cAAc,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;QAC7G,CAAC;QAED,MAAM,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QAChE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CoberturaClass } from './types.js';
2
+ export declare function setCoveredLinesCobertura(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, classObj: CoberturaClass): Promise<void>;
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+ import { join } from 'node:path';
3
+ import { getTotalLines } from './getTotalLines.js';
4
+ export async function setCoveredLinesCobertura(coveredLines, uncoveredLines, repoRoot, filePath, classObj) {
5
+ const randomLines = [];
6
+ const totalLines = await getTotalLines(join(repoRoot, filePath));
7
+ for (const coveredLine of coveredLines) {
8
+ if (coveredLine > totalLines) {
9
+ for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
10
+ if (!uncoveredLines.includes(randomLineNumber) &&
11
+ !coveredLines.includes(randomLineNumber) &&
12
+ !randomLines.includes(randomLineNumber)) {
13
+ const randomLine = {
14
+ '@number': randomLineNumber,
15
+ '@hits': 1,
16
+ '@branch': 'false',
17
+ };
18
+ classObj.lines.line.push(randomLine);
19
+ randomLines.push(randomLineNumber);
20
+ break;
21
+ }
22
+ }
23
+ }
24
+ else {
25
+ const coveredLineObj = {
26
+ '@number': coveredLine,
27
+ '@hits': 1,
28
+ '@branch': 'false',
29
+ };
30
+ classObj.lines.line.push(coveredLineObj);
31
+ }
32
+ }
33
+ }
34
+ //# sourceMappingURL=setCoveredLinesCobertura.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setCoveredLinesCobertura.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesCobertura.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,QAAwB;IAExB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjE,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;YAC7B,KAAK,IAAI,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,IAAI,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;gBAClF,IACE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBAC1C,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBACxC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACvC,CAAC;oBACD,MAAM,UAAU,GAAkB;wBAChC,SAAS,EAAE,gBAAgB;wBAC3B,OAAO,EAAE,CAAC;wBACV,SAAS,EAAE,OAAO;qBACnB,CAAC;oBACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACrC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,cAAc,GAAkB;gBACpC,SAAS,EAAE,WAAW;gBACtB,OAAO,EAAE,CAAC;gBACV,SAAS,EAAE,OAAO;aACnB,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { FileObject } from './types.js';
2
+ export declare function setCoveredLinesSonar(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, fileObj: FileObject): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  import { join } from 'node:path';
3
3
  import { getTotalLines } from './getTotalLines.js';
4
- export async function setCoveredLines(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
4
+ export async function setCoveredLinesSonar(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
5
5
  const randomLines = [];
6
6
  const totalLines = await getTotalLines(join(repoRoot, filePath));
7
7
  for (const coveredLine of coveredLines) {
@@ -27,4 +27,4 @@ export async function setCoveredLines(coveredLines, uncoveredLines, repoRoot, fi
27
27
  }
28
28
  }
29
29
  }
30
- //# sourceMappingURL=setCoveredLines.js.map
30
+ //# sourceMappingURL=setCoveredLinesSonar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setCoveredLinesSonar.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesSonar.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,OAAmB;IAEnB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;YAC7B,KAAK,IAAI,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,IAAI,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;gBAClF,IACE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBAC1C,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBACxC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACvC,CAAC;oBACD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;wBACvB,aAAa,EAAE,gBAAgB;wBAC/B,UAAU,EAAE,MAAM;qBACnB,CAAC,CAAC;oBACH,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;gBACvB,aAAa,EAAE,WAAW;gBAC1B,UAAU,EAAE,MAAM;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { DeployCoverageData } from './types.js';
2
- export declare function transformDeployCoverageReport(data: DeployCoverageData): Promise<{
2
+ export declare function transformDeployCoverageReport(data: DeployCoverageData, format: string): Promise<{
3
3
  xml: string;
4
4
  warnings: string[];
5
5
  filesProcessed: number;
@@ -3,42 +3,116 @@
3
3
  import { create } from 'xmlbuilder2';
4
4
  import { getPackageDirectories } from './getPackageDirectories.js';
5
5
  import { findFilePath } from './findFilePath.js';
6
- import { setCoveredLines } from './setCoveredLines.js';
6
+ import { setCoveredLinesSonar } from './setCoveredLinesSonar.js';
7
+ import { setCoveredLinesCobertura } from './setCoveredLinesCobertura.js';
7
8
  import { normalizePathToUnix } from './normalizePathToUnix.js';
8
- export async function transformDeployCoverageReport(data) {
9
- const coverageObj = { coverage: { '@version': '1', file: [] } };
9
+ export async function transformDeployCoverageReport(data, format) {
10
10
  const warnings = [];
11
11
  let filesProcessed = 0;
12
12
  const { repoRoot, packageDirectories } = await getPackageDirectories();
13
- for (const fileName in data) {
14
- if (!Object.hasOwn(data, fileName))
15
- continue;
16
- const fileInfo = data[fileName];
17
- const formattedFileName = fileName.replace(/no-map[\\/]+/, '');
18
- const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
19
- if (relativeFilePath === undefined) {
20
- warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
21
- continue;
13
+ if (format === 'sonar') {
14
+ const coverageObj = { coverage: { '@version': '1', file: [] } };
15
+ for (const fileName in data) {
16
+ if (!Object.hasOwn(data, fileName))
17
+ continue;
18
+ const fileInfo = data[fileName];
19
+ const formattedFileName = fileName.replace(/no-map[\\/]+/, '');
20
+ const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
21
+ if (relativeFilePath === undefined) {
22
+ warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
23
+ continue;
24
+ }
25
+ const uncoveredLines = Object.keys(fileInfo.s)
26
+ .filter((lineNumber) => fileInfo.s[lineNumber] === 0)
27
+ .map(Number);
28
+ const coveredLines = Object.keys(fileInfo.s)
29
+ .filter((lineNumber) => fileInfo.s[lineNumber] === 1)
30
+ .map(Number);
31
+ const fileObj = {
32
+ '@path': normalizePathToUnix(relativeFilePath),
33
+ lineToCover: uncoveredLines.map((lineNumber) => ({
34
+ '@lineNumber': lineNumber,
35
+ '@covered': 'false',
36
+ })),
37
+ };
38
+ await setCoveredLinesSonar(coveredLines, uncoveredLines, repoRoot, relativeFilePath, fileObj);
39
+ filesProcessed++;
40
+ coverageObj.coverage.file.push(fileObj);
22
41
  }
23
- const uncoveredLines = Object.keys(fileInfo.s)
24
- .filter((lineNumber) => fileInfo.s[lineNumber] === 0)
25
- .map(Number);
26
- const coveredLines = Object.keys(fileInfo.s)
27
- .filter((lineNumber) => fileInfo.s[lineNumber] === 1)
28
- .map(Number);
29
- const fileObj = {
30
- '@path': normalizePathToUnix(relativeFilePath),
31
- lineToCover: uncoveredLines.map((lineNumber) => ({
32
- '@lineNumber': lineNumber,
33
- '@covered': 'false',
34
- })),
42
+ const xml = create(coverageObj).end({ prettyPrint: true, indent: ' ' });
43
+ return { xml, warnings, filesProcessed };
44
+ }
45
+ else if (format === 'cobertura') {
46
+ const coberturaObj = {
47
+ coverage: {
48
+ '@lines-valid': 0,
49
+ '@lines-covered': 0,
50
+ '@line-rate': 0,
51
+ '@branches-valid': 0,
52
+ '@branches-covered': 0,
53
+ '@branch-rate': 1,
54
+ '@timestamp': Date.now(),
55
+ '@complexity': 0,
56
+ '@version': '0.1',
57
+ sources: { source: ['.'] },
58
+ packages: { package: [] },
59
+ },
60
+ };
61
+ // Single package for all classes
62
+ const packageObj = {
63
+ '@name': 'main',
64
+ '@line-rate': 0,
65
+ '@branch-rate': 1,
66
+ classes: { class: [] },
35
67
  };
36
- // this function is only needed until Salesforce fixes the API to correctly return covered lines
37
- await setCoveredLines(coveredLines, uncoveredLines, repoRoot, relativeFilePath, fileObj);
38
- filesProcessed++;
39
- coverageObj.coverage.file.push(fileObj);
68
+ coberturaObj.coverage.packages.package.push(packageObj);
69
+ for (const fileName in data) {
70
+ if (!Object.hasOwn(data, fileName))
71
+ continue;
72
+ const fileInfo = data[fileName];
73
+ const formattedFileName = fileName.replace(/no-map[\\/]+/, '');
74
+ const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
75
+ if (relativeFilePath === undefined) {
76
+ warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
77
+ continue;
78
+ }
79
+ const uncoveredLines = Object.keys(fileInfo.s)
80
+ .filter((lineNumber) => fileInfo.s[lineNumber] === 0)
81
+ .map(Number);
82
+ const coveredLines = Object.keys(fileInfo.s)
83
+ .filter((lineNumber) => fileInfo.s[lineNumber] === 1)
84
+ .map(Number);
85
+ const classObj = {
86
+ '@name': formattedFileName,
87
+ '@filename': normalizePathToUnix(relativeFilePath),
88
+ '@line-rate': (coveredLines.length / (coveredLines.length + uncoveredLines.length)).toFixed(4),
89
+ '@branch-rate': '1',
90
+ methods: {},
91
+ lines: {
92
+ line: [
93
+ ...uncoveredLines.map((lineNumber) => ({
94
+ '@number': lineNumber,
95
+ '@hits': 0,
96
+ '@branch': 'false',
97
+ })),
98
+ ],
99
+ },
100
+ };
101
+ await setCoveredLinesCobertura(coveredLines, uncoveredLines, repoRoot, relativeFilePath, classObj);
102
+ // Update package and overall coverage metrics
103
+ coberturaObj.coverage['@lines-valid'] += uncoveredLines.length + coveredLines.length;
104
+ coberturaObj.coverage['@lines-covered'] += coveredLines.length;
105
+ packageObj.classes.class.push(classObj);
106
+ filesProcessed++;
107
+ }
108
+ // Update overall line-rate for the package
109
+ packageObj['@line-rate'] = Number((coberturaObj.coverage['@lines-covered'] / coberturaObj.coverage['@lines-valid']).toFixed(4));
110
+ coberturaObj.coverage['@line-rate'] = packageObj['@line-rate'];
111
+ let xml = create(coberturaObj).end({ prettyPrint: true, indent: ' ', headless: true });
112
+ // Add DOCTYPE declaration at the beginning of the XML
113
+ xml = `<?xml version="1.0" ?>\n<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">\n${xml}`;
114
+ return { xml, warnings, filesProcessed };
40
115
  }
41
- const xml = create(coverageObj).end({ prettyPrint: true, indent: ' ' });
42
- return { xml, warnings, filesProcessed };
116
+ throw new Error(`Unsupported format: ${format}`);
43
117
  }
44
118
  //# sourceMappingURL=transformDeployCoverageReport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformDeployCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformDeployCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,IAAwB;IAExB,MAAM,WAAW,GAAmB,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC;IAChF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,cAAc,GAAW,CAAC,CAAC;IAC/B,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,MAAM,qBAAqB,EAAE,CAAC;IAEvE,KAAK,MAAM,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC;YAAE,SAAS;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC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AAM,GAAG,YAAY,CAAC,MAAM,CAAC;YACrF,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC;YAE/D,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxC,cAAc,EAAE,CAAC;QACnB,CAAC;QAED,2CAA2C;QAC3C,UAAU,CAAC,YAAY,CAAC,GAAG,MAAM,CAC/B,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAC7F,CAAC;QACF,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;QAE/D,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAExF,sDAAsD;QACtD,GAAG,GAAG,8GAA8G,GAAG,EAAE,CAAC;QAC1H,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAC;AACnD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { TestCoverageData } from './types.js';
2
- export declare function transformTestCoverageReport(testCoverageData: TestCoverageData[]): Promise<{
2
+ export declare function transformTestCoverageReport(testCoverageData: TestCoverageData[], format: string): Promise<{
3
3
  xml: string;
4
4
  warnings: string[];
5
5
  filesProcessed: number;
@@ -4,40 +4,119 @@ import { create } from 'xmlbuilder2';
4
4
  import { getPackageDirectories } from './getPackageDirectories.js';
5
5
  import { findFilePath } from './findFilePath.js';
6
6
  import { normalizePathToUnix } from './normalizePathToUnix.js';
7
- export async function transformTestCoverageReport(testCoverageData) {
8
- const coverageObj = { coverage: { '@version': '1', file: [] } };
7
+ export async function transformTestCoverageReport(testCoverageData, format) {
9
8
  const warnings = [];
10
9
  let filesProcessed = 0;
11
10
  const { repoRoot, packageDirectories } = await getPackageDirectories();
12
- if (!Array.isArray(testCoverageData)) {
13
- testCoverageData = [testCoverageData];
11
+ let coverageData = testCoverageData;
12
+ if (!Array.isArray(coverageData)) {
13
+ coverageData = [coverageData];
14
14
  }
15
- for (const data of testCoverageData) {
16
- const name = data?.name;
17
- const lines = data?.lines;
18
- if (!name || !lines) {
19
- continue;
15
+ if (format === 'sonar') {
16
+ const coverageObj = { coverage: { '@version': '1', file: [] } };
17
+ for (const data of coverageData) {
18
+ const name = data?.name;
19
+ const lines = data?.lines;
20
+ if (!name || !lines)
21
+ continue;
22
+ const formattedFileName = name.replace(/no-map[\\/]+/, '');
23
+ const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
24
+ if (relativeFilePath === undefined) {
25
+ warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
26
+ continue;
27
+ }
28
+ const fileObj = {
29
+ '@path': normalizePathToUnix(relativeFilePath),
30
+ lineToCover: [],
31
+ };
32
+ for (const [lineNumber, isCovered] of Object.entries(lines)) {
33
+ fileObj.lineToCover.push({
34
+ '@lineNumber': Number(lineNumber),
35
+ '@covered': `${isCovered === 1}`,
36
+ });
37
+ }
38
+ filesProcessed++;
39
+ coverageObj.coverage.file.push(fileObj);
20
40
  }
21
- const formattedFileName = name.replace(/no-map[\\/]+/, '');
22
- const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
23
- if (relativeFilePath === undefined) {
24
- warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
25
- continue;
26
- }
27
- const fileObj = {
28
- '@path': normalizePathToUnix(relativeFilePath),
29
- lineToCover: [],
41
+ const xml = create(coverageObj).end({ prettyPrint: true, indent: ' ' });
42
+ return { xml, warnings, filesProcessed };
43
+ }
44
+ else if (format === 'cobertura') {
45
+ const coberturaObj = {
46
+ coverage: {
47
+ '@lines-valid': 0,
48
+ '@lines-covered': 0,
49
+ '@line-rate': 0,
50
+ '@branches-valid': 0,
51
+ '@branches-covered': 0,
52
+ '@branch-rate': 1,
53
+ '@timestamp': Date.now(),
54
+ '@complexity': 0,
55
+ '@version': '0.1',
56
+ sources: { source: ['.'] },
57
+ packages: { package: [] },
58
+ },
59
+ };
60
+ // Single package for all classes
61
+ const packageObj = {
62
+ '@name': 'main',
63
+ '@line-rate': 0,
64
+ '@branch-rate': 1,
65
+ classes: { class: [] },
30
66
  };
31
- for (const [lineNumber, isCovered] of Object.entries(lines)) {
32
- fileObj.lineToCover.push({
33
- '@lineNumber': Number(lineNumber),
34
- '@covered': `${isCovered === 1}`,
35
- });
67
+ coberturaObj.coverage.packages.package.push(packageObj);
68
+ for (const data of coverageData) {
69
+ const name = data?.name;
70
+ const lines = data?.lines;
71
+ if (!name || !lines)
72
+ continue;
73
+ const formattedFileName = name.replace(/no-map[\\/]+/, '');
74
+ const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
75
+ if (relativeFilePath === undefined) {
76
+ warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
77
+ continue;
78
+ }
79
+ const uncoveredLines = Object.entries(lines)
80
+ .filter(([, isCovered]) => isCovered === 0)
81
+ .map(([lineNumber]) => Number(lineNumber));
82
+ const coveredLines = Object.entries(lines)
83
+ .filter(([, isCovered]) => isCovered === 1)
84
+ .map(([lineNumber]) => Number(lineNumber));
85
+ const classObj = {
86
+ '@name': formattedFileName,
87
+ '@filename': normalizePathToUnix(relativeFilePath),
88
+ '@line-rate': (coveredLines.length / (coveredLines.length + uncoveredLines.length)).toFixed(4),
89
+ '@branch-rate': '1',
90
+ methods: {},
91
+ lines: {
92
+ line: [
93
+ ...uncoveredLines.map((lineNumber) => ({
94
+ '@number': lineNumber,
95
+ '@hits': 0,
96
+ '@branch': 'false',
97
+ })),
98
+ ...coveredLines.map((lineNumber) => ({
99
+ '@number': lineNumber,
100
+ '@hits': 1,
101
+ '@branch': 'false',
102
+ })),
103
+ ],
104
+ },
105
+ };
106
+ // Update package and overall coverage metrics
107
+ coberturaObj.coverage['@lines-valid'] += uncoveredLines.length + coveredLines.length;
108
+ coberturaObj.coverage['@lines-covered'] += coveredLines.length;
109
+ packageObj.classes.class.push(classObj);
110
+ filesProcessed++;
36
111
  }
37
- filesProcessed++;
38
- coverageObj.coverage.file.push(fileObj);
112
+ // Update overall line-rate for the package
113
+ packageObj['@line-rate'] = parseFloat((coberturaObj.coverage['@lines-covered'] / coberturaObj.coverage['@lines-valid']).toFixed(4));
114
+ coberturaObj.coverage['@line-rate'] = packageObj['@line-rate'];
115
+ let xml = create(coberturaObj).end({ prettyPrint: true, indent: ' ', headless: true });
116
+ // Add DOCTYPE declaration at the beginning of the XML
117
+ xml = `<?xml version="1.0" ?>\n<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">\n${xml}`;
118
+ return { xml, warnings, filesProcessed };
39
119
  }
40
- const xml = create(coverageObj).end({ prettyPrint: true, indent: ' ' });
41
- return { xml, warnings, filesProcessed };
120
+ throw new Error(`Unsupported format: ${format}`);
42
121
  }
43
122
  //# sourceMappingURL=transformTestCoverageReport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformTestCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformTestCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,gBAAoC;IAEpC,MAAM,WAAW,GAAmB,EAAE,QAAQ,EAAE,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AAM,GAAG,YAAY,CAAC,MAAM,CAAC;YACrF,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC;YAE/D,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxC,cAAc,EAAE,CAAC;QACnB,CAAC;QAED,2CAA2C;QAC3C,UAAU,CAAC,YAAY,CAAC,GAAG,UAAU,CACnC,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAC7F,CAAC;QACF,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;QAE/D,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAExF,sDAAsD;QACtD,GAAG,GAAG,8GAA8G,GAAG,EAAE,CAAC;QAC1H,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAC;AACnD,CAAC"}
@@ -52,5 +52,48 @@ export type ConfigFile = {
52
52
  deployCoverageJsonPath: string;
53
53
  testCoverageJsonPath: string;
54
54
  coverageXmlPath: string;
55
+ format: string;
56
+ };
57
+ export type CoberturaLine = {
58
+ '@number': number;
59
+ '@hits': number;
60
+ '@branch': string;
61
+ };
62
+ export type CoberturaClass = {
63
+ '@name': string;
64
+ '@filename': string;
65
+ '@line-rate': string;
66
+ '@branch-rate': string;
67
+ methods: Record<string, never>;
68
+ lines: {
69
+ line: CoberturaLine[];
70
+ };
71
+ };
72
+ type CoberturaPackage = {
73
+ '@name': string;
74
+ '@line-rate': number;
75
+ '@branch-rate': number;
76
+ classes: {
77
+ class: CoberturaClass[];
78
+ };
79
+ };
80
+ export type CoberturaCoverageObject = {
81
+ coverage: {
82
+ '@lines-valid': number;
83
+ '@lines-covered': number;
84
+ '@line-rate': number;
85
+ '@branches-valid': number;
86
+ '@branches-covered': number;
87
+ '@branch-rate': number | string;
88
+ '@timestamp': number;
89
+ '@complexity': number;
90
+ '@version': string;
91
+ sources: {
92
+ source: string[];
93
+ };
94
+ packages: {
95
+ package: CoberturaPackage[];
96
+ };
97
+ };
55
98
  };
56
99
  export {};
@@ -30,6 +30,7 @@ export const postrun = async function (options) {
30
30
  return;
31
31
  }
32
32
  const coverageXml = configFile.coverageXmlPath || 'coverage.xml';
33
+ const coverageFormat = configFile.format || 'sonar';
33
34
  if (commandType === 'deploy') {
34
35
  coverageJson = configFile.deployCoverageJsonPath || '.';
35
36
  }
@@ -49,6 +50,8 @@ export const postrun = async function (options) {
49
50
  commandArgs.push(coverageJsonPath);
50
51
  commandArgs.push('--xml');
51
52
  commandArgs.push(coverageXmlPath);
53
+ commandArgs.push('--format');
54
+ commandArgs.push(coverageFormat);
52
55
  await TransformerTransform.run(commandArgs);
53
56
  };
54
57
  //# sourceMappingURL=postrun.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../src/hooks/postrun.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,WAAW,OAAO;IAC7D,IAAI,WAAmB,CAAC;IACxB,IAAI,YAAoB,CA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AC,CAAC;IAClC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7B,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACjC,MAAM,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC"}
@@ -1,19 +1,24 @@
1
1
  # summary
2
2
 
3
- Transforms the Code Coverage JSON into the Generic Test Coverage Format (XML).
3
+ Transforms the Code Coverage JSON into SonarQube or Cobertura format.
4
4
 
5
5
  # description
6
6
 
7
- This plugin will convert the code coverage JSON file created by the Salesforce CLI during Apex deployments and test runs into an XML accepted by tools like SonarQube.
7
+ Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube or Cobertura format.
8
8
 
9
9
  # examples
10
10
 
11
- - `sf acc-transformer transform -j "coverage.json" -x "coverage.xml"`
11
+ - `sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "sonar"`
12
+ - `sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "cobertura"`
12
13
 
13
14
  # flags.coverage-json.summary
14
15
 
15
- Path to the code coverage JSON file created by the Salesforce CLI deployment or test command.
16
+ Path to the code coverage JSON file created by the Salesforce CLI deploy or test command.
16
17
 
17
18
  # flags.xml.summary
18
19
 
19
- Path to code coverage XML file that will be created by this plugin.
20
+ Path to the code coverage XML file that will be created by this plugin.
21
+
22
+ # flags.format.summary
23
+
24
+ Output format for the coverage report.
@@ -3,9 +3,10 @@
3
3
  "acc-transformer:transform": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "This plugin will convert the code coverage JSON file created by the Salesforce CLI during Apex deployments and test runs into an XML accepted by tools like SonarQube.",
6
+ "description": "Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube or Cobertura format.",
7
7
  "examples": [
8
- "`sf acc-transformer transform -j \"coverage.json\" -x \"coverage.xml\"`"
8
+ "`sf acc-transformer transform -j \"coverage.json\" -x \"coverage.xml\" -f \"sonar\"`",
9
+ "`sf acc-transformer transform -j \"coverage.json\" -x \"coverage.xml\" -f \"cobertura\"`"
9
10
  ],
10
11
  "flags": {
11
12
  "json": {
@@ -27,7 +28,7 @@
27
28
  "char": "j",
28
29
  "name": "coverage-json",
29
30
  "required": true,
30
- "summary": "Path to the code coverage JSON file created by the Salesforce CLI deployment or test command.",
31
+ "summary": "Path to the code coverage JSON file created by the Salesforce CLI deploy or test command.",
31
32
  "hasDynamicHelp": false,
32
33
  "multiple": false,
33
34
  "type": "option"
@@ -36,11 +37,25 @@
36
37
  "char": "x",
37
38
  "name": "xml",
38
39
  "required": true,
39
- "summary": "Path to code coverage XML file that will be created by this plugin.",
40
+ "summary": "Path to the code coverage XML file that will be created by this plugin.",
40
41
  "default": "coverage.xml",
41
42
  "hasDynamicHelp": false,
42
43
  "multiple": false,
43
44
  "type": "option"
45
+ },
46
+ "format": {
47
+ "char": "f",
48
+ "name": "format",
49
+ "required": true,
50
+ "summary": "Output format for the coverage report.",
51
+ "default": "sonar",
52
+ "hasDynamicHelp": false,
53
+ "multiple": false,
54
+ "options": [
55
+ "sonar",
56
+ "cobertura"
57
+ ],
58
+ "type": "option"
44
59
  }
45
60
  },
46
61
  "hasDynamicHelp": false,
@@ -50,7 +65,7 @@
50
65
  "pluginName": "apex-code-coverage-transformer",
51
66
  "pluginType": "core",
52
67
  "strict": true,
53
- "summary": "Transforms the Code Coverage JSON into the Generic Test Coverage Format (XML).",
68
+ "summary": "Transforms the Code Coverage JSON into SonarQube or Cobertura format.",
54
69
  "enableJsonFlag": true,
55
70
  "isESM": true,
56
71
  "relativePath": [
@@ -66,5 +81,5 @@
66
81
  ]
67
82
  }
68
83
  },
69
- "version": "2.2.1"
84
+ "version": "2.3.0"
70
85
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "apex-code-coverage-transformer",
3
- "description": "Transforms the Apex code coverage JSON created during Salesforce deployments and test runs into the Generic Test Coverage Format (XML) for SonarQube.",
4
- "version": "2.2.1",
3
+ "description": "Transforms the Apex code coverage JSON created during Salesforce deployments and test runs into SonarQube or Cobertura format.",
4
+ "version": "2.3.0",
5
5
  "dependencies": {
6
6
  "@oclif/core": "^4.0.37",
7
7
  "@salesforce/core": "^8.8.0",
@@ -45,7 +45,8 @@
45
45
  "sonarqube",
46
46
  "apex",
47
47
  "coverage",
48
- "git"
48
+ "git",
49
+ "cobertura"
49
50
  ],
50
51
  "license": "MIT",
51
52
  "oclif": {
@@ -1,2 +0,0 @@
1
- import { FileObject } from './types.js';
2
- export declare function setCoveredLines(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, fileObj: FileObject): Promise<void>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"setCoveredLines.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLines.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,OAAmB;IAEnB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;YAC7B,KAAK,IAAI,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,IAAI,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;gBAClF,IACE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBAC1C,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBACxC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACvC,CAAC;oBACD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;wBACvB,aAAa,EAAE,gBAAgB;wBAC/B,UAAU,EAAE,MAAM;qBACnB,CAAC,CAAC;oBACH,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;gBACvB,aAAa,EAAE,WAAW;gBAC1B,UAAU,EAAE,MAAM;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}