apex-code-coverage-transformer 2.3.0 → 2.4.1
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 +90 -9
- package/lib/commands/acc-transformer/transform.js +2 -1
- package/lib/commands/acc-transformer/transform.js.map +1 -1
- package/lib/helpers/constants.d.ts +1 -0
- package/lib/helpers/constants.js +2 -0
- package/lib/helpers/constants.js.map +1 -0
- package/lib/helpers/generateXml.d.ts +2 -0
- package/lib/helpers/generateXml.js +14 -0
- package/lib/helpers/generateXml.js.map +1 -0
- package/lib/helpers/initializeCoverageObject.d.ts +5 -0
- package/lib/helpers/initializeCoverageObject.js +68 -0
- package/lib/helpers/initializeCoverageObject.js.map +1 -0
- package/lib/helpers/setCoveredLinesClover.d.ts +2 -0
- package/lib/helpers/setCoveredLinesClover.js +35 -0
- package/lib/helpers/setCoveredLinesClover.js.map +1 -0
- package/lib/helpers/setCoveredLinesSonar.d.ts +2 -2
- package/lib/helpers/transformDeployCoverageReport.js +101 -103
- package/lib/helpers/transformDeployCoverageReport.js.map +1 -1
- package/lib/helpers/transformTestCoverageReport.js +103 -105
- package/lib/helpers/transformTestCoverageReport.js.map +1 -1
- package/lib/helpers/types.d.ts +54 -7
- package/lib/hooks/postrun.js.map +1 -1
- package/messages/transformer.transform.md +3 -2
- package/oclif.manifest.json +7 -5
- package/package.json +10 -3
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.4.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.4.0...v2.4.1) (2024-12-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix clover file level metrics in deploy reports ([cddded4](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/cddded4f996771af1fafa07213f7e9866f4c1191))
|
|
14
|
+
|
|
15
|
+
## [2.4.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.3.0...v2.4.0) (2024-12-21)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add support for clover format ([00ffa74](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/00ffa742455609028f36d48f9a4cabc86aa32ecb))
|
|
21
|
+
|
|
8
22
|
## [2.3.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.2.1...v2.3.0) (2024-12-17)
|
|
9
23
|
|
|
10
24
|
|
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 SonarQube
|
|
21
|
+
A Salesforce CLI plugin to transform the Apex code coverage JSON files created during deployments and test runs into SonarQube, Cobertura, or Clover format.
|
|
22
22
|
|
|
23
23
|
## Install
|
|
24
24
|
|
|
@@ -36,9 +36,9 @@ When the plugin is unable to find the Apex file from the Salesforce CLI coverage
|
|
|
36
36
|
|
|
37
37
|
## Creating Code Coverage Files with the Salesforce CLI
|
|
38
38
|
|
|
39
|
-
**This tool will only support the
|
|
39
|
+
**This tool will only support the "json" coverage format from the Salesforce CLI. Do not use the "json-summary", "clover", or "cobertura" format from the Salesforce CLI.**
|
|
40
40
|
|
|
41
|
-
To create the code coverage JSON
|
|
41
|
+
To create the code coverage JSON when deploying or validating, 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`.
|
|
42
42
|
|
|
43
43
|
```
|
|
44
44
|
sf project deploy [start/validate] --coverage-formatters json --results-dir "coverage"
|
|
@@ -72,19 +72,21 @@ FLAGS
|
|
|
72
72
|
-x, --xml=<value> Path to the code coverage XML file that will be created by this plugin.
|
|
73
73
|
[default: "coverage.xml"]
|
|
74
74
|
-f, --format=<value> Output format for the code coverage format.
|
|
75
|
-
Valid options are "sonar" or "cobertura".
|
|
75
|
+
Valid options are "sonar", "clover", or "cobertura".
|
|
76
76
|
[default: "sonar"]
|
|
77
77
|
|
|
78
78
|
GLOBAL FLAGS
|
|
79
79
|
--json Format output as json.
|
|
80
80
|
|
|
81
81
|
DESCRIPTION
|
|
82
|
-
Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube or Cobertura format.
|
|
82
|
+
Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube, Clover, or Cobertura format.
|
|
83
83
|
|
|
84
84
|
EXAMPLES
|
|
85
85
|
$ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "sonar"
|
|
86
86
|
|
|
87
87
|
$ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "cobertura"
|
|
88
|
+
|
|
89
|
+
$ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "clover"
|
|
88
90
|
```
|
|
89
91
|
|
|
90
92
|
## Hook
|
|
@@ -109,7 +111,7 @@ The `.apexcodecovtransformer.config.json` should look like this:
|
|
|
109
111
|
- `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.
|
|
110
112
|
- `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.
|
|
111
113
|
- `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".
|
|
114
|
+
- `format` is optional and should be the intended output format for the code coverage XML created by this plugin. Options are "sonar", "clover", or "cobertura". If this isn't provided, it will default to "sonar".
|
|
113
115
|
|
|
114
116
|
If the `.apexcodecovtransformer.config.json` file isn't found, the hook will be skipped.
|
|
115
117
|
|
|
@@ -230,14 +232,14 @@ and this format for Cobertura:
|
|
|
230
232
|
```xml
|
|
231
233
|
<?xml version="1.0" ?>
|
|
232
234
|
<!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="
|
|
235
|
+
<coverage lines-valid="62" lines-covered="54" line-rate="0.871" branches-valid="0" branches-covered="0" branch-rate="1" timestamp="1734621101529" complexity="0" version="0.1">
|
|
234
236
|
<sources>
|
|
235
237
|
<source>.</source>
|
|
236
238
|
</sources>
|
|
237
239
|
<packages>
|
|
238
240
|
<package name="main" line-rate="0.871" branch-rate="1">
|
|
239
241
|
<classes>
|
|
240
|
-
<class name="AccountTrigger" filename="
|
|
242
|
+
<class name="AccountTrigger" filename="packaged/triggers/AccountTrigger.trigger" line-rate="0.8710" branch-rate="1">
|
|
241
243
|
<methods/>
|
|
242
244
|
<lines>
|
|
243
245
|
<line number="52" hits="0" branch="false"/>
|
|
@@ -273,7 +275,7 @@ and this format for Cobertura:
|
|
|
273
275
|
<line number="27" hits="1" branch="false"/>
|
|
274
276
|
</lines>
|
|
275
277
|
</class>
|
|
276
|
-
<class name="AccountProfile" filename="
|
|
278
|
+
<class name="AccountProfile" filename="force-app/main/default/classes/AccountProfile.cls" line-rate="0.8710" branch-rate="1">
|
|
277
279
|
<methods/>
|
|
278
280
|
<lines>
|
|
279
281
|
<line number="52" hits="0" branch="false"/>
|
|
@@ -315,6 +317,85 @@ and this format for Cobertura:
|
|
|
315
317
|
</coverage>
|
|
316
318
|
```
|
|
317
319
|
|
|
320
|
+
and this format for Clover:
|
|
321
|
+
|
|
322
|
+
```xml
|
|
323
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
324
|
+
<coverage generated="1734898566028" clover="3.2.0">
|
|
325
|
+
<project timestamp="1734898566028" name="All files">
|
|
326
|
+
<metrics statements="62" coveredstatements="54" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="62" coveredelements="54" complexity="0" loc="62" ncloc="62" packages="1" files="2" classes="2"/>
|
|
327
|
+
<file name="AccountTrigger" path="packaged/triggers/AccountTrigger.trigger">
|
|
328
|
+
<metrics statements="31" coveredstatements="27" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
329
|
+
<line num="52" count="0" type="stmt"/>
|
|
330
|
+
<line num="53" count="0" type="stmt"/>
|
|
331
|
+
<line num="59" count="0" type="stmt"/>
|
|
332
|
+
<line num="60" count="0" type="stmt"/>
|
|
333
|
+
<line num="1" count="1" type="stmt"/>
|
|
334
|
+
<line num="2" count="1" type="stmt"/>
|
|
335
|
+
<line num="3" count="1" type="stmt"/>
|
|
336
|
+
<line num="4" count="1" type="stmt"/>
|
|
337
|
+
<line num="5" count="1" type="stmt"/>
|
|
338
|
+
<line num="6" count="1" type="stmt"/>
|
|
339
|
+
<line num="7" count="1" type="stmt"/>
|
|
340
|
+
<line num="8" count="1" type="stmt"/>
|
|
341
|
+
<line num="9" count="1" type="stmt"/>
|
|
342
|
+
<line num="10" count="1" type="stmt"/>
|
|
343
|
+
<line num="11" count="1" type="stmt"/>
|
|
344
|
+
<line num="12" count="1" type="stmt"/>
|
|
345
|
+
<line num="13" count="1" type="stmt"/>
|
|
346
|
+
<line num="14" count="1" type="stmt"/>
|
|
347
|
+
<line num="15" count="1" type="stmt"/>
|
|
348
|
+
<line num="16" count="1" type="stmt"/>
|
|
349
|
+
<line num="17" count="1" type="stmt"/>
|
|
350
|
+
<line num="18" count="1" type="stmt"/>
|
|
351
|
+
<line num="19" count="1" type="stmt"/>
|
|
352
|
+
<line num="20" count="1" type="stmt"/>
|
|
353
|
+
<line num="21" count="1" type="stmt"/>
|
|
354
|
+
<line num="22" count="1" type="stmt"/>
|
|
355
|
+
<line num="23" count="1" type="stmt"/>
|
|
356
|
+
<line num="24" count="1" type="stmt"/>
|
|
357
|
+
<line num="25" count="1" type="stmt"/>
|
|
358
|
+
<line num="26" count="1" type="stmt"/>
|
|
359
|
+
<line num="27" count="1" type="stmt"/>
|
|
360
|
+
</file>
|
|
361
|
+
<file name="AccountProfile" path="force-app/main/default/classes/AccountProfile.cls">
|
|
362
|
+
<metrics statements="31" coveredstatements="27" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
363
|
+
<line num="52" count="0" type="stmt"/>
|
|
364
|
+
<line num="53" count="0" type="stmt"/>
|
|
365
|
+
<line num="59" count="0" type="stmt"/>
|
|
366
|
+
<line num="60" count="0" type="stmt"/>
|
|
367
|
+
<line num="54" count="1" type="stmt"/>
|
|
368
|
+
<line num="55" count="1" type="stmt"/>
|
|
369
|
+
<line num="56" count="1" type="stmt"/>
|
|
370
|
+
<line num="57" count="1" type="stmt"/>
|
|
371
|
+
<line num="58" count="1" type="stmt"/>
|
|
372
|
+
<line num="61" count="1" type="stmt"/>
|
|
373
|
+
<line num="62" count="1" type="stmt"/>
|
|
374
|
+
<line num="63" count="1" type="stmt"/>
|
|
375
|
+
<line num="64" count="1" type="stmt"/>
|
|
376
|
+
<line num="65" count="1" type="stmt"/>
|
|
377
|
+
<line num="66" count="1" type="stmt"/>
|
|
378
|
+
<line num="67" count="1" type="stmt"/>
|
|
379
|
+
<line num="68" count="1" type="stmt"/>
|
|
380
|
+
<line num="69" count="1" type="stmt"/>
|
|
381
|
+
<line num="70" count="1" type="stmt"/>
|
|
382
|
+
<line num="71" count="1" type="stmt"/>
|
|
383
|
+
<line num="72" count="1" type="stmt"/>
|
|
384
|
+
<line num="1" count="1" type="stmt"/>
|
|
385
|
+
<line num="2" count="1" type="stmt"/>
|
|
386
|
+
<line num="3" count="1" type="stmt"/>
|
|
387
|
+
<line num="4" count="1" type="stmt"/>
|
|
388
|
+
<line num="5" count="1" type="stmt"/>
|
|
389
|
+
<line num="6" count="1" type="stmt"/>
|
|
390
|
+
<line num="7" count="1" type="stmt"/>
|
|
391
|
+
<line num="8" count="1" type="stmt"/>
|
|
392
|
+
<line num="9" count="1" type="stmt"/>
|
|
393
|
+
<line num="10" count="1" type="stmt"/>
|
|
394
|
+
</file>
|
|
395
|
+
</project>
|
|
396
|
+
</coverage>
|
|
397
|
+
```
|
|
398
|
+
|
|
318
399
|
## Issues
|
|
319
400
|
|
|
320
401
|
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.
|
|
@@ -6,6 +6,7 @@ import { Messages } from '@salesforce/core';
|
|
|
6
6
|
import { transformDeployCoverageReport } from '../../helpers/transformDeployCoverageReport.js';
|
|
7
7
|
import { transformTestCoverageReport } from '../../helpers/transformTestCoverageReport.js';
|
|
8
8
|
import { checkCoverageDataType } from '../../helpers/setCoverageDataType.js';
|
|
9
|
+
import { formatOptions } from '../../helpers/constants.js';
|
|
9
10
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
10
11
|
const messages = Messages.loadMessages('apex-code-coverage-transformer', 'transformer.transform');
|
|
11
12
|
export default class TransformerTransform extends SfCommand {
|
|
@@ -32,7 +33,7 @@ export default class TransformerTransform extends SfCommand {
|
|
|
32
33
|
required: true,
|
|
33
34
|
multiple: false,
|
|
34
35
|
default: 'sonar',
|
|
35
|
-
options:
|
|
36
|
+
options: formatOptions,
|
|
36
37
|
}),
|
|
37
38
|
};
|
|
38
39
|
async run() {
|
|
@@ -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,EA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"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAa,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import { create } from 'xmlbuilder2';
|
|
3
|
+
export function generateXml(coverageObj, format) {
|
|
4
|
+
const isHeadless = format === 'cobertura' || format === 'clover';
|
|
5
|
+
let xml = create(coverageObj).end({ prettyPrint: true, indent: ' ', headless: isHeadless });
|
|
6
|
+
if (format === 'cobertura') {
|
|
7
|
+
xml = `<?xml version="1.0" ?>\n<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">\n${xml}`;
|
|
8
|
+
}
|
|
9
|
+
else if (format === 'clover') {
|
|
10
|
+
xml = `<?xml version="1.0" encoding="UTF-8"?>\n${xml}`;
|
|
11
|
+
}
|
|
12
|
+
return xml;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=generateXml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateXml.js","sourceRoot":"","sources":["../../src/helpers/generateXml.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,UAAU,WAAW,CACzB,WAAiF,EACjF,MAAc;IAEd,MAAM,UAAU,GAAG,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,QAAQ,CAAC;IACjE,IAAI,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAE7F,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3B,GAAG,GAAG,8GAA8G,GAAG,EAAE,CAAC;IAC5H,CAAC;SAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,GAAG,GAAG,2CAA2C,GAAG,EAAE,CAAC;IACzD,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SonarCoverageObject, CoberturaCoverageObject, CloverCoverageObject, CoberturaPackage } from './types.js';
|
|
2
|
+
export declare function initializeCoverageObject(format: string): {
|
|
3
|
+
coverageObj: SonarCoverageObject | CoberturaCoverageObject | CloverCoverageObject;
|
|
4
|
+
packageObj: CoberturaPackage | null;
|
|
5
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
export function initializeCoverageObject(format) {
|
|
3
|
+
let coverageObj;
|
|
4
|
+
if (format === 'sonar') {
|
|
5
|
+
coverageObj = {
|
|
6
|
+
coverage: { '@version': '1', file: [] },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
else if (format === 'cobertura') {
|
|
10
|
+
coverageObj = {
|
|
11
|
+
coverage: {
|
|
12
|
+
'@lines-valid': 0,
|
|
13
|
+
'@lines-covered': 0,
|
|
14
|
+
'@line-rate': 0,
|
|
15
|
+
'@branches-valid': 0,
|
|
16
|
+
'@branches-covered': 0,
|
|
17
|
+
'@branch-rate': 1,
|
|
18
|
+
'@timestamp': Date.now(),
|
|
19
|
+
'@complexity': 0,
|
|
20
|
+
'@version': '0.1',
|
|
21
|
+
sources: { source: ['.'] },
|
|
22
|
+
packages: { package: [] },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
coverageObj = {
|
|
28
|
+
coverage: {
|
|
29
|
+
'@generated': Date.now(),
|
|
30
|
+
'@clover': '3.2.0',
|
|
31
|
+
project: {
|
|
32
|
+
'@timestamp': Date.now(),
|
|
33
|
+
'@name': 'All files',
|
|
34
|
+
metrics: {
|
|
35
|
+
'@statements': 0,
|
|
36
|
+
'@coveredstatements': 0,
|
|
37
|
+
'@conditionals': 0,
|
|
38
|
+
'@coveredconditionals': 0,
|
|
39
|
+
'@methods': 0,
|
|
40
|
+
'@coveredmethods': 0,
|
|
41
|
+
'@elements': 0,
|
|
42
|
+
'@coveredelements': 0,
|
|
43
|
+
'@complexity': 0,
|
|
44
|
+
'@loc': 0,
|
|
45
|
+
'@ncloc': 0,
|
|
46
|
+
'@packages': 1,
|
|
47
|
+
'@files': 0,
|
|
48
|
+
'@classes': 0,
|
|
49
|
+
},
|
|
50
|
+
file: [],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const packageObj = format === 'cobertura'
|
|
56
|
+
? {
|
|
57
|
+
'@name': 'main',
|
|
58
|
+
'@line-rate': 0,
|
|
59
|
+
'@branch-rate': 1,
|
|
60
|
+
classes: { class: [] },
|
|
61
|
+
}
|
|
62
|
+
: null;
|
|
63
|
+
if (packageObj) {
|
|
64
|
+
coverageObj.coverage.packages.package.push(packageObj);
|
|
65
|
+
}
|
|
66
|
+
return { coverageObj, packageObj };
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=initializeCoverageObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializeCoverageObject.js","sourceRoot":"","sources":["../../src/helpers/initializeCoverageObject.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAUb,MAAM,UAAU,wBAAwB,CAAC,MAAc;IAIrD,IAAI,WAAiF,CAAC;IAEtF,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,WAAW,GAAG;YACZ,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;SACjB,CAAC;IAC3B,CAAC;SAAM,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,WAAW,GAAG;YACZ,QAAQ,EAAE;gBACR,cAAc,EAAE,CAAC;gBACjB,gBAAgB,EAAE,CAAC;gBACnB,YAAY,EAAE,CAAC;gBACf,iBAAiB,EAAE,CAAC;gBACpB,mBAAm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C,UAAU,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { getTotalLines } from './getTotalLines.js';
|
|
5
|
+
export async function setCoveredLinesClover(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
|
|
6
|
+
const randomLines = [];
|
|
7
|
+
const totalLines = await getTotalLines(join(repoRoot, filePath));
|
|
8
|
+
for (const coveredLine of coveredLines) {
|
|
9
|
+
if (coveredLine > totalLines) {
|
|
10
|
+
for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
|
|
11
|
+
if (!uncoveredLines.includes(randomLineNumber) &&
|
|
12
|
+
!coveredLines.includes(randomLineNumber) &&
|
|
13
|
+
!randomLines.includes(randomLineNumber)) {
|
|
14
|
+
const randomLine = {
|
|
15
|
+
'@num': randomLineNumber,
|
|
16
|
+
'@count': 1,
|
|
17
|
+
'@type': 'stmt',
|
|
18
|
+
};
|
|
19
|
+
fileObj.line.push(randomLine);
|
|
20
|
+
randomLines.push(randomLineNumber);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const coveredLineObj = {
|
|
27
|
+
'@num': coveredLine,
|
|
28
|
+
'@count': 1,
|
|
29
|
+
'@type': 'stmt',
|
|
30
|
+
};
|
|
31
|
+
fileObj.line.push(coveredLineObj);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=setCoveredLinesClover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setCoveredLinesClover.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesClover.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,sCA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
1
|
-
import {
|
|
2
|
-
export declare function setCoveredLinesSonar(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, fileObj:
|
|
1
|
+
import { SonarClass } from './types.js';
|
|
2
|
+
export declare function setCoveredLinesSonar(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, fileObj: SonarClass): Promise<void>;
|
|
@@ -1,118 +1,116 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
|
-
import { create } from 'xmlbuilder2';
|
|
4
2
|
import { getPackageDirectories } from './getPackageDirectories.js';
|
|
5
3
|
import { findFilePath } from './findFilePath.js';
|
|
6
4
|
import { setCoveredLinesSonar } from './setCoveredLinesSonar.js';
|
|
7
5
|
import { setCoveredLinesCobertura } from './setCoveredLinesCobertura.js';
|
|
6
|
+
import { setCoveredLinesClover } from './setCoveredLinesClover.js';
|
|
8
7
|
import { normalizePathToUnix } from './normalizePathToUnix.js';
|
|
8
|
+
import { generateXml } from './generateXml.js';
|
|
9
|
+
import { formatOptions } from './constants.js';
|
|
10
|
+
import { initializeCoverageObject } from './initializeCoverageObject.js';
|
|
9
11
|
export async function transformDeployCoverageReport(data, format) {
|
|
12
|
+
if (!formatOptions.includes(format)) {
|
|
13
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
14
|
+
}
|
|
10
15
|
const warnings = [];
|
|
11
16
|
let filesProcessed = 0;
|
|
12
17
|
const { repoRoot, packageDirectories } = await getPackageDirectories();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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);
|
|
18
|
+
const { coverageObj, packageObj } = initializeCoverageObject(format);
|
|
19
|
+
for (const fileName in data) {
|
|
20
|
+
if (!Object.hasOwn(data, fileName))
|
|
21
|
+
continue;
|
|
22
|
+
const fileInfo = data[fileName];
|
|
23
|
+
const formattedFileName = fileName.replace(/no-map[\\/]+/, '');
|
|
24
|
+
const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
|
|
25
|
+
if (relativeFilePath === undefined) {
|
|
26
|
+
warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
|
|
27
|
+
continue;
|
|
41
28
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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: [] },
|
|
67
|
-
};
|
|
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++;
|
|
29
|
+
const uncoveredLines = Object.keys(fileInfo.s)
|
|
30
|
+
.filter((lineNumber) => fileInfo.s[lineNumber] === 0)
|
|
31
|
+
.map(Number);
|
|
32
|
+
const coveredLines = Object.keys(fileInfo.s)
|
|
33
|
+
.filter((lineNumber) => fileInfo.s[lineNumber] === 1)
|
|
34
|
+
.map(Number);
|
|
35
|
+
if (format === 'sonar') {
|
|
36
|
+
await handleSonarFormat(relativeFilePath, uncoveredLines, coveredLines, repoRoot, coverageObj);
|
|
37
|
+
}
|
|
38
|
+
else if (format === 'cobertura') {
|
|
39
|
+
await handleCoberturaFormat(relativeFilePath, formattedFileName, uncoveredLines, coveredLines, repoRoot, coverageObj, packageObj);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
await handleCloverFormat(relativeFilePath, formattedFileName, uncoveredLines, coveredLines, repoRoot, coverageObj);
|
|
107
43
|
}
|
|
108
|
-
|
|
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 };
|
|
44
|
+
filesProcessed++;
|
|
115
45
|
}
|
|
116
|
-
|
|
46
|
+
const xml = generateXml(coverageObj, format);
|
|
47
|
+
return { xml, warnings, filesProcessed };
|
|
48
|
+
}
|
|
49
|
+
async function handleSonarFormat(filePath, uncoveredLines, coveredLines, repoRoot, coverageObj) {
|
|
50
|
+
const fileObj = {
|
|
51
|
+
'@path': normalizePathToUnix(filePath),
|
|
52
|
+
lineToCover: uncoveredLines.map((lineNumber) => ({
|
|
53
|
+
'@lineNumber': lineNumber,
|
|
54
|
+
'@covered': 'false',
|
|
55
|
+
})),
|
|
56
|
+
};
|
|
57
|
+
await setCoveredLinesSonar(coveredLines, uncoveredLines, repoRoot, filePath, fileObj);
|
|
58
|
+
coverageObj.coverage.file.push(fileObj);
|
|
59
|
+
}
|
|
60
|
+
async function handleCoberturaFormat(filePath, fileName, uncoveredLines, coveredLines, repoRoot, coverageObj, packageObj) {
|
|
61
|
+
const classObj = {
|
|
62
|
+
'@name': fileName,
|
|
63
|
+
'@filename': normalizePathToUnix(filePath),
|
|
64
|
+
'@line-rate': (coveredLines.length / (coveredLines.length + uncoveredLines.length)).toFixed(4),
|
|
65
|
+
'@branch-rate': '1',
|
|
66
|
+
methods: {},
|
|
67
|
+
lines: {
|
|
68
|
+
line: [
|
|
69
|
+
...uncoveredLines.map((lineNumber) => ({
|
|
70
|
+
'@number': lineNumber,
|
|
71
|
+
'@hits': 0,
|
|
72
|
+
'@branch': 'false',
|
|
73
|
+
})),
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
await setCoveredLinesCobertura(coveredLines, uncoveredLines, repoRoot, filePath, classObj);
|
|
78
|
+
coverageObj.coverage['@lines-valid'] += uncoveredLines.length + coveredLines.length;
|
|
79
|
+
coverageObj.coverage['@lines-covered'] += coveredLines.length;
|
|
80
|
+
packageObj.classes.class.push(classObj);
|
|
81
|
+
packageObj['@line-rate'] = Number((coverageObj.coverage['@lines-covered'] / coverageObj.coverage['@lines-valid']).toFixed(4));
|
|
82
|
+
coverageObj.coverage['@line-rate'] = packageObj['@line-rate'];
|
|
83
|
+
}
|
|
84
|
+
async function handleCloverFormat(filePath, fileName, uncoveredLines, coveredLines, repoRoot, coverageObj) {
|
|
85
|
+
const cloverFile = {
|
|
86
|
+
'@name': fileName,
|
|
87
|
+
'@path': normalizePathToUnix(filePath),
|
|
88
|
+
metrics: {
|
|
89
|
+
'@statements': uncoveredLines.length + coveredLines.length,
|
|
90
|
+
'@coveredstatements': coveredLines.length,
|
|
91
|
+
'@conditionals': 0,
|
|
92
|
+
'@coveredconditionals': 0,
|
|
93
|
+
'@methods': 0,
|
|
94
|
+
'@coveredmethods': 0,
|
|
95
|
+
},
|
|
96
|
+
line: [
|
|
97
|
+
...uncoveredLines.map((lineNumber) => ({
|
|
98
|
+
'@num': lineNumber,
|
|
99
|
+
'@count': 0,
|
|
100
|
+
'@type': 'stmt',
|
|
101
|
+
})),
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
await setCoveredLinesClover(coveredLines, uncoveredLines, repoRoot, filePath, cloverFile);
|
|
105
|
+
coverageObj.coverage.project.file.push(cloverFile);
|
|
106
|
+
const projectMetrics = coverageObj.coverage.project.metrics;
|
|
107
|
+
projectMetrics['@statements'] += uncoveredLines.length + coveredLines.length;
|
|
108
|
+
projectMetrics['@coveredstatements'] += coveredLines.length;
|
|
109
|
+
projectMetrics['@elements'] += uncoveredLines.length + coveredLines.length;
|
|
110
|
+
projectMetrics['@coveredelements'] += coveredLines.length;
|
|
111
|
+
projectMetrics['@files'] += 1;
|
|
112
|
+
projectMetrics['@classes'] += 1;
|
|
113
|
+
projectMetrics['@loc'] += uncoveredLines.length + coveredLines.length;
|
|
114
|
+
projectMetrics['@ncloc'] += uncoveredLines.length + coveredLines.length;
|
|
117
115
|
}
|
|
118
116
|
//# sourceMappingURL=transformDeployCoverageReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDeployCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformDeployCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"transformDeployCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformDeployCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAcb,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,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,CAAC,OAAO,CAAC,OAAO,CAAC;IAE5D,cAAc,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IAC7E,cAAc,CAAC,oBAAoB,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC;IAC5D,cAAc,CAAC,WAAW,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IAC3E,cAAc,CAAC,kBAAkB,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC;IAC1D,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9B,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACtE,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;AAC1E,CAAC"}
|
|
@@ -1,122 +1,120 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
|
-
import { create } from 'xmlbuilder2';
|
|
4
2
|
import { getPackageDirectories } from './getPackageDirectories.js';
|
|
5
3
|
import { findFilePath } from './findFilePath.js';
|
|
6
4
|
import { normalizePathToUnix } from './normalizePathToUnix.js';
|
|
5
|
+
import { generateXml } from './generateXml.js';
|
|
6
|
+
import { formatOptions } from './constants.js';
|
|
7
|
+
import { initializeCoverageObject } from './initializeCoverageObject.js';
|
|
7
8
|
export async function transformTestCoverageReport(testCoverageData, format) {
|
|
9
|
+
if (!formatOptions.includes(format)) {
|
|
10
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
11
|
+
}
|
|
8
12
|
const warnings = [];
|
|
9
13
|
let filesProcessed = 0;
|
|
10
14
|
const { repoRoot, packageDirectories } = await getPackageDirectories();
|
|
15
|
+
const { coverageObj, packageObj } = initializeCoverageObject(format);
|
|
11
16
|
let coverageData = testCoverageData;
|
|
12
17
|
if (!Array.isArray(coverageData)) {
|
|
13
18
|
coverageData = [coverageData];
|
|
14
19
|
}
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
for (const data of coverageData) {
|
|
21
|
+
const name = data?.name;
|
|
22
|
+
const lines = data?.lines;
|
|
23
|
+
if (!name || !lines)
|
|
24
|
+
continue;
|
|
25
|
+
const formattedFileName = name.replace(/no-map[\\/]+/, '');
|
|
26
|
+
const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
|
|
27
|
+
if (relativeFilePath === undefined) {
|
|
28
|
+
warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
|
|
29
|
+
continue;
|
|
40
30
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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: [] },
|
|
66
|
-
};
|
|
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++;
|
|
31
|
+
const uncoveredLines = Object.entries(lines)
|
|
32
|
+
.filter(([, isCovered]) => isCovered === 0)
|
|
33
|
+
.map(([lineNumber]) => Number(lineNumber));
|
|
34
|
+
const coveredLines = Object.entries(lines)
|
|
35
|
+
.filter(([, isCovered]) => isCovered === 1)
|
|
36
|
+
.map(([lineNumber]) => Number(lineNumber));
|
|
37
|
+
if (format === 'sonar') {
|
|
38
|
+
handleSonarFormat(relativeFilePath, lines, coverageObj);
|
|
39
|
+
}
|
|
40
|
+
else if (format === 'cobertura') {
|
|
41
|
+
handleCoberturaFormat(relativeFilePath, formattedFileName, lines, uncoveredLines, coveredLines, coverageObj, packageObj);
|
|
111
42
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
43
|
+
else {
|
|
44
|
+
handleCloverFormat(relativeFilePath, formattedFileName, lines, uncoveredLines, coveredLines, coverageObj);
|
|
45
|
+
}
|
|
46
|
+
filesProcessed++;
|
|
47
|
+
}
|
|
48
|
+
const xml = generateXml(coverageObj, format);
|
|
49
|
+
return { xml, warnings, filesProcessed };
|
|
50
|
+
}
|
|
51
|
+
function handleSonarFormat(filePath, lines, coverageObj) {
|
|
52
|
+
const fileObj = {
|
|
53
|
+
'@path': normalizePathToUnix(filePath),
|
|
54
|
+
lineToCover: [],
|
|
55
|
+
};
|
|
56
|
+
for (const [lineNumber, isCovered] of Object.entries(lines)) {
|
|
57
|
+
fileObj.lineToCover.push({
|
|
58
|
+
'@lineNumber': Number(lineNumber),
|
|
59
|
+
'@covered': `${isCovered === 1}`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
coverageObj.coverage.file.push(fileObj);
|
|
63
|
+
}
|
|
64
|
+
function handleCoberturaFormat(filePath, fileName, lines, uncoveredLines, coveredLines, coverageObj, packageObj) {
|
|
65
|
+
const classObj = {
|
|
66
|
+
'@name': fileName,
|
|
67
|
+
'@filename': normalizePathToUnix(filePath),
|
|
68
|
+
'@line-rate': (coveredLines.length / (coveredLines.length + uncoveredLines.length)).toFixed(4),
|
|
69
|
+
'@branch-rate': '1',
|
|
70
|
+
methods: {},
|
|
71
|
+
lines: {
|
|
72
|
+
line: [],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
for (const [lineNumber, isCovered] of Object.entries(lines)) {
|
|
76
|
+
classObj.lines.line.push({
|
|
77
|
+
'@number': Number(lineNumber),
|
|
78
|
+
'@hits': isCovered === 1 ? 1 : 0,
|
|
79
|
+
'@branch': 'false',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
coverageObj.coverage['@lines-valid'] += uncoveredLines.length + coveredLines.length;
|
|
83
|
+
coverageObj.coverage['@lines-covered'] += coveredLines.length;
|
|
84
|
+
packageObj.classes.class.push(classObj);
|
|
85
|
+
packageObj['@line-rate'] = Number((coverageObj.coverage['@lines-covered'] / coverageObj.coverage['@lines-valid']).toFixed(4));
|
|
86
|
+
coverageObj.coverage['@line-rate'] = packageObj['@line-rate'];
|
|
87
|
+
}
|
|
88
|
+
function handleCloverFormat(filePath, fileName, lines, uncoveredLines, coveredLines, coverageObj) {
|
|
89
|
+
const cloverFile = {
|
|
90
|
+
'@name': fileName,
|
|
91
|
+
'@path': normalizePathToUnix(filePath),
|
|
92
|
+
metrics: {
|
|
93
|
+
'@statements': uncoveredLines.length + coveredLines.length,
|
|
94
|
+
'@coveredstatements': coveredLines.length,
|
|
95
|
+
'@conditionals': 0,
|
|
96
|
+
'@coveredconditionals': 0,
|
|
97
|
+
'@methods': 0,
|
|
98
|
+
'@coveredmethods': 0,
|
|
99
|
+
},
|
|
100
|
+
line: [],
|
|
101
|
+
};
|
|
102
|
+
for (const [lineNumber, isCovered] of Object.entries(lines)) {
|
|
103
|
+
cloverFile.line.push({
|
|
104
|
+
'@num': Number(lineNumber),
|
|
105
|
+
'@count': isCovered === 1 ? 1 : 0,
|
|
106
|
+
'@type': 'stmt',
|
|
107
|
+
});
|
|
119
108
|
}
|
|
120
|
-
|
|
109
|
+
coverageObj.coverage.project.file.push(cloverFile);
|
|
110
|
+
const projectMetrics = coverageObj.coverage.project.metrics;
|
|
111
|
+
projectMetrics['@statements'] += uncoveredLines.length + coveredLines.length;
|
|
112
|
+
projectMetrics['@coveredstatements'] += coveredLines.length;
|
|
113
|
+
projectMetrics['@elements'] += uncoveredLines.length + coveredLines.length;
|
|
114
|
+
projectMetrics['@coveredelements'] += coveredLines.length;
|
|
115
|
+
projectMetrics['@files'] += 1;
|
|
116
|
+
projectMetrics['@classes'] += 1;
|
|
117
|
+
projectMetrics['@loc'] += uncoveredLines.length + coveredLines.length;
|
|
118
|
+
projectMetrics['@ncloc'] += uncoveredLines.length + coveredLines.length;
|
|
121
119
|
}
|
|
122
120
|
//# sourceMappingURL=transformTestCoverageReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformTestCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformTestCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"transformTestCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformTestCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAcb,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MA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,CAAC;IACL,CAAC;IAED,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;IAE5D,cAAc,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IAC7E,cAAc,CAAC,oBAAoB,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC;IAC5D,cAAc,CAAC,WAAW,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IAC3E,cAAc,CAAC,kBAAkB,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC;IAC1D,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9B,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACtE,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;AAC1E,CAAC"}
|
package/lib/helpers/types.d.ts
CHANGED
|
@@ -34,21 +34,21 @@ export type SfdxProject = {
|
|
|
34
34
|
path: string;
|
|
35
35
|
}>;
|
|
36
36
|
};
|
|
37
|
-
type
|
|
37
|
+
type SonarLine = {
|
|
38
38
|
'@lineNumber': number;
|
|
39
39
|
'@covered': string;
|
|
40
40
|
};
|
|
41
|
-
export type
|
|
41
|
+
export type SonarClass = {
|
|
42
42
|
'@path': string;
|
|
43
|
-
lineToCover:
|
|
43
|
+
lineToCover: SonarLine[];
|
|
44
44
|
};
|
|
45
|
-
export type
|
|
45
|
+
export type SonarCoverageObject = {
|
|
46
46
|
coverage: {
|
|
47
|
-
file:
|
|
47
|
+
file: SonarClass[];
|
|
48
48
|
'@version': string;
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
export type
|
|
51
|
+
export type HookFile = {
|
|
52
52
|
deployCoverageJsonPath: string;
|
|
53
53
|
testCoverageJsonPath: string;
|
|
54
54
|
coverageXmlPath: string;
|
|
@@ -69,7 +69,7 @@ export type CoberturaClass = {
|
|
|
69
69
|
line: CoberturaLine[];
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
type CoberturaPackage = {
|
|
72
|
+
export type CoberturaPackage = {
|
|
73
73
|
'@name': string;
|
|
74
74
|
'@line-rate': number;
|
|
75
75
|
'@branch-rate': number;
|
|
@@ -96,4 +96,51 @@ export type CoberturaCoverageObject = {
|
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
|
+
export type CloverLine = {
|
|
100
|
+
'@num': number;
|
|
101
|
+
'@count': number;
|
|
102
|
+
'@type': string;
|
|
103
|
+
};
|
|
104
|
+
export type CloverFile = {
|
|
105
|
+
'@name': string;
|
|
106
|
+
'@path': string;
|
|
107
|
+
metrics: {
|
|
108
|
+
'@statements': number;
|
|
109
|
+
'@coveredstatements': number;
|
|
110
|
+
'@conditionals': number;
|
|
111
|
+
'@coveredconditionals': number;
|
|
112
|
+
'@methods': number;
|
|
113
|
+
'@coveredmethods': number;
|
|
114
|
+
};
|
|
115
|
+
line: CloverLine[];
|
|
116
|
+
};
|
|
117
|
+
export type CloverProjectMetrics = {
|
|
118
|
+
'@statements': number;
|
|
119
|
+
'@coveredstatements': number;
|
|
120
|
+
'@conditionals': number;
|
|
121
|
+
'@coveredconditionals': number;
|
|
122
|
+
'@methods': number;
|
|
123
|
+
'@coveredmethods': number;
|
|
124
|
+
'@elements': number;
|
|
125
|
+
'@coveredelements': number;
|
|
126
|
+
'@complexity': number;
|
|
127
|
+
'@loc': number;
|
|
128
|
+
'@ncloc': number;
|
|
129
|
+
'@packages': number;
|
|
130
|
+
'@files': number;
|
|
131
|
+
'@classes': number;
|
|
132
|
+
};
|
|
133
|
+
export type CloverProject = {
|
|
134
|
+
'@timestamp': number;
|
|
135
|
+
'@name': string;
|
|
136
|
+
metrics: CloverProjectMetrics;
|
|
137
|
+
file: CloverFile[];
|
|
138
|
+
};
|
|
139
|
+
export type CloverCoverageObject = {
|
|
140
|
+
coverage: {
|
|
141
|
+
'@generated': number;
|
|
142
|
+
'@clover': string;
|
|
143
|
+
project: CloverProject;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
99
146
|
export {};
|
package/lib/hooks/postrun.js.map
CHANGED
|
@@ -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,CAAC;IACzB,IACE,CAAC,yBAAyB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC,CAAC,QAAQ,CAC5G,OAAO,CAAC,OAAO,CAAC,EAAE,CACnB,EACD,CAAC;QACD,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC;SAAM,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3E,WAAW,GAAG,MAAM,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO;IACT,CAAC;IACD,IAAI,
|
|
1
|
+
{"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../src/hooks/postrun.ts"],"names":[],"mappings":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E,MAAM,cAAc,GAAW,UAAU,CAAC,MAAM,IAAI,OAAO,CAAC;IAE5D,IAAI,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC7B,YAAY,GAAG,UAAU,CAAC,sBAAsB,IAAI,GAAG,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,YAAY,GAAG,UAAU,CAAC,oBAAoB,IAAI,GAAG,CAAC;IACxD,CAAC;IAED,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/C,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7C,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAClC,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACpC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,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,15 +1,16 @@
|
|
|
1
1
|
# summary
|
|
2
2
|
|
|
3
|
-
Transforms the Code Coverage JSON into SonarQube or Cobertura format.
|
|
3
|
+
Transforms the Code Coverage JSON into SonarQube, Clover, or Cobertura format.
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube or Cobertura format.
|
|
7
|
+
Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube, Clover, or Cobertura format.
|
|
8
8
|
|
|
9
9
|
# examples
|
|
10
10
|
|
|
11
11
|
- `sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "sonar"`
|
|
12
12
|
- `sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "cobertura"`
|
|
13
|
+
- `sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "clover"`
|
|
13
14
|
|
|
14
15
|
# flags.coverage-json.summary
|
|
15
16
|
|
package/oclif.manifest.json
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
"acc-transformer:transform": {
|
|
4
4
|
"aliases": [],
|
|
5
5
|
"args": {},
|
|
6
|
-
"description": "Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube or Cobertura format.",
|
|
6
|
+
"description": "Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube, Clover, or Cobertura format.",
|
|
7
7
|
"examples": [
|
|
8
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
|
+
"`sf acc-transformer transform -j \"coverage.json\" -x \"coverage.xml\" -f \"cobertura\"`",
|
|
10
|
+
"`sf acc-transformer transform -j \"coverage.json\" -x \"coverage.xml\" -f \"clover\"`"
|
|
10
11
|
],
|
|
11
12
|
"flags": {
|
|
12
13
|
"json": {
|
|
@@ -53,7 +54,8 @@
|
|
|
53
54
|
"multiple": false,
|
|
54
55
|
"options": [
|
|
55
56
|
"sonar",
|
|
56
|
-
"cobertura"
|
|
57
|
+
"cobertura",
|
|
58
|
+
"clover"
|
|
57
59
|
],
|
|
58
60
|
"type": "option"
|
|
59
61
|
}
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
"pluginName": "apex-code-coverage-transformer",
|
|
66
68
|
"pluginType": "core",
|
|
67
69
|
"strict": true,
|
|
68
|
-
"summary": "Transforms the Code Coverage JSON into SonarQube or Cobertura format.",
|
|
70
|
+
"summary": "Transforms the Code Coverage JSON into SonarQube, Clover, or Cobertura format.",
|
|
69
71
|
"enableJsonFlag": true,
|
|
70
72
|
"isESM": true,
|
|
71
73
|
"relativePath": [
|
|
@@ -81,5 +83,5 @@
|
|
|
81
83
|
]
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
|
-
"version": "2.
|
|
86
|
+
"version": "2.4.1"
|
|
85
87
|
}
|
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 SonarQube or Cobertura format.",
|
|
4
|
-
"version": "2.
|
|
3
|
+
"description": "Transforms the Apex code coverage JSON created during Salesforce deployments and test runs into SonarQube, Clover, or Cobertura format.",
|
|
4
|
+
"version": "2.4.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4.0.37",
|
|
7
7
|
"@salesforce/core": "^8.8.0",
|
|
@@ -46,7 +46,14 @@
|
|
|
46
46
|
"apex",
|
|
47
47
|
"coverage",
|
|
48
48
|
"git",
|
|
49
|
-
"cobertura"
|
|
49
|
+
"cobertura",
|
|
50
|
+
"clover",
|
|
51
|
+
"converter",
|
|
52
|
+
"transformer",
|
|
53
|
+
"code",
|
|
54
|
+
"quality",
|
|
55
|
+
"validation",
|
|
56
|
+
"deployment"
|
|
50
57
|
],
|
|
51
58
|
"license": "MIT",
|
|
52
59
|
"oclif": {
|