apex-code-coverage-transformer 2.2.0 → 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 +14 -0
- package/README.md +124 -20
- package/lib/commands/acc-transformer/transform.d.ts +3 -2
- package/lib/commands/acc-transformer/transform.js +11 -2
- package/lib/commands/acc-transformer/transform.js.map +1 -1
- package/lib/helpers/setCoveredLinesCobertura.d.ts +2 -0
- package/lib/helpers/setCoveredLinesCobertura.js +34 -0
- package/lib/helpers/setCoveredLinesCobertura.js.map +1 -0
- package/lib/helpers/setCoveredLinesSonar.d.ts +2 -0
- package/lib/helpers/{setCoveredLines.js → setCoveredLinesSonar.js} +2 -2
- package/lib/helpers/setCoveredLinesSonar.js.map +1 -0
- package/lib/helpers/transformDeployCoverageReport.d.ts +1 -1
- package/lib/helpers/transformDeployCoverageReport.js +104 -30
- package/lib/helpers/transformDeployCoverageReport.js.map +1 -1
- package/lib/helpers/transformTestCoverageReport.d.ts +1 -1
- package/lib/helpers/transformTestCoverageReport.js +106 -27
- package/lib/helpers/transformTestCoverageReport.js.map +1 -1
- package/lib/helpers/types.d.ts +43 -0
- package/lib/hooks/postrun.js +3 -0
- package/lib/hooks/postrun.js.map +1 -1
- package/messages/transformer.transform.md +10 -5
- package/oclif.lock +3771 -4298
- package/oclif.manifest.json +29 -6
- package/package.json +17 -15
- package/lib/helpers/setCoveredLines.d.ts +0 -2
- package/lib/helpers/setCoveredLines.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
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
|
+
|
|
15
|
+
## [2.2.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.2.0...v2.2.1) (2024-12-14)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* upgrade all dependencies ([7addc5d](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/7addc5dc6ec72f75a26bc1306ae42eee74daea25))
|
|
21
|
+
|
|
8
22
|
## [2.2.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.1.0...v2.2.0) (2024-10-28)
|
|
9
23
|
|
|
10
24
|
|
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
<summary>Table of Contents</summary>
|
|
8
8
|
|
|
9
9
|
- [Install](#install)
|
|
10
|
+
- [Who is the Plugin For?](#who-is-the-plugin-for)
|
|
11
|
+
- [Creating Code Coverage Files with the Salesforce CLI](#creating-code-coverage-files-with-the-salesforce-cli)
|
|
10
12
|
- [Command](#command)
|
|
11
13
|
- [`sf acc-transformer transform`](#sf-acc-transformer-transform)
|
|
12
14
|
- [Hook](#hook)
|
|
@@ -16,13 +18,25 @@
|
|
|
16
18
|
- [License](#license)
|
|
17
19
|
</details>
|
|
18
20
|
|
|
19
|
-
|
|
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.
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
sf plugins install apex-code-coverage-transformer@x.y.z
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Who is the Plugin For?
|
|
22
30
|
|
|
23
|
-
This plugin is intended for users who deploy their Apex codebase from
|
|
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.
|
|
24
32
|
|
|
25
|
-
|
|
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
|
+
|
|
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
|
+
|
|
37
|
+
## Creating Code Coverage Files with the Salesforce CLI
|
|
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.**
|
|
26
40
|
|
|
27
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`.
|
|
28
42
|
|
|
@@ -37,42 +51,40 @@ sf apex run test --code-coverage --result-format json --output-dir "coverage"
|
|
|
37
51
|
sf apex get test --test-run-id <test run id> --code-coverage --result-format json --output-dir "coverage"
|
|
38
52
|
```
|
|
39
53
|
|
|
40
|
-
The code coverage JSONs created by the Salesforce CLI aren't accepted
|
|
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.
|
|
41
55
|
|
|
42
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.
|
|
43
57
|
|
|
44
|
-
## Install
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
sf plugins install apex-code-coverage-transformer@x.y.z
|
|
48
|
-
```
|
|
49
|
-
|
|
50
58
|
## Command
|
|
51
59
|
|
|
52
60
|
The `apex-code-coverage-transformer` has 1 command:
|
|
53
61
|
|
|
54
62
|
- `sf acc-transformer transform`
|
|
55
63
|
|
|
56
|
-
This command needs to be ran somewhere inside your Salesforce DX repository, whether in the root folder (recommended) or in a subfolder. This plugin will determine the root folder of this repository and read the `sfdx-project.json` file in the root folder. All package directories listed in the `sfdx-project.json` file will be processed when running this plugin.
|
|
57
|
-
|
|
58
64
|
## `sf acc-transformer transform`
|
|
59
65
|
|
|
60
66
|
```
|
|
61
67
|
USAGE
|
|
62
|
-
$ sf acc-transformer transform -j <value> -x <value> [--json]
|
|
68
|
+
$ sf acc-transformer transform -j <value> -x <value> -f <value> [--json]
|
|
63
69
|
|
|
64
70
|
FLAGS
|
|
65
|
-
-j, --coverage-json=<value> Path to the code coverage JSON file created by the Salesforce CLI
|
|
66
|
-
-x, --xml=<value>
|
|
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"]
|
|
67
77
|
|
|
68
78
|
GLOBAL FLAGS
|
|
69
79
|
--json Format output as json.
|
|
70
80
|
|
|
71
81
|
DESCRIPTION
|
|
72
|
-
|
|
82
|
+
Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube or Cobertura format.
|
|
73
83
|
|
|
74
84
|
EXAMPLES
|
|
75
|
-
$ 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"
|
|
76
88
|
```
|
|
77
89
|
|
|
78
90
|
## Hook
|
|
@@ -89,13 +101,15 @@ The `.apexcodecovtransformer.config.json` should look like this:
|
|
|
89
101
|
{
|
|
90
102
|
"deployCoverageJsonPath": "coverage/coverage/coverage.json",
|
|
91
103
|
"testCoverageJsonPath": "coverage/test-coverage.json",
|
|
92
|
-
"coverageXmlPath": "coverage.xml"
|
|
104
|
+
"coverageXmlPath": "coverage.xml",
|
|
105
|
+
"format": "sonar"
|
|
93
106
|
}
|
|
94
107
|
```
|
|
95
108
|
|
|
96
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.
|
|
97
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.
|
|
98
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".
|
|
99
113
|
|
|
100
114
|
If the `.apexcodecovtransformer.config.json` file isn't found, the hook will be skipped.
|
|
101
115
|
|
|
@@ -137,7 +151,7 @@ Error (1): ENOENT: no such file or directory: {packageDirPath}
|
|
|
137
151
|
|
|
138
152
|
## Example
|
|
139
153
|
|
|
140
|
-
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:
|
|
141
155
|
|
|
142
156
|
```xml
|
|
143
157
|
<?xml version="1.0"?>
|
|
@@ -211,6 +225,96 @@ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-c
|
|
|
211
225
|
</coverage>
|
|
212
226
|
```
|
|
213
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
|
+
|
|
214
318
|
## Issues
|
|
215
319
|
|
|
216
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.
|
|
@@ -5,8 +5,9 @@ export default class TransformerTransform extends SfCommand<TransformerTransform
|
|
|
5
5
|
static readonly description: string;
|
|
6
6
|
static readonly examples: string[];
|
|
7
7
|
static readonly flags: {
|
|
8
|
-
'coverage-json': import("@oclif/core/
|
|
9
|
-
xml: import("@oclif/core/
|
|
8
|
+
'coverage-json': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
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
|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,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,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"}
|
|
@@ -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
|
|
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=
|
|
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 {
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'@
|
|
33
|
-
'@covered':
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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;
|
|
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;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,IAAwB,EACxB,MAAc;IAEd,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,IAAI,MAAM,KAAK,O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AC;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;
|