apex-code-coverage-transformer 1.6.4 → 1.6.5

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/README.md CHANGED
@@ -2,21 +2,21 @@
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/apex-code-coverage-transformer.svg?label=apex-code-coverage-transformer)](https://www.npmjs.com/package/apex-code-coverage-transformer) [![Downloads/week](https://img.shields.io/npm/dw/apex-code-coverage-transformer.svg)](https://npmjs.org/package/apex-code-coverage-transformer) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/LICENSE.md)
4
4
 
5
- The `apex-code-coverage-transformer` is a simple Salesforce CLI plugin to transform the Apex Code Coverage JSON file into Generic Test Coverage Format (XML). This format is accepted by static code analysis tools like SonarQube.
5
+ The `apex-code-coverage-transformer` is a Salesforce CLI plugin to transform the Apex Code Coverage JSON files created during deployments into the Generic Test Coverage Format (XML). This format is accepted by static code analysis tools like SonarQube.
6
6
 
7
7
  This plugin supports code coverage metrics created for Apex Classes and Apex Triggers. This also supports multiple package directories as listed in your project's `sfdx-project.json` configuration, assuming unique file-names are used in your package directories.
8
8
 
9
9
  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:
10
10
 
11
11
  ```
12
- sf project deploy validate -x manifest/package.xml -l RunSpecifiedTests -t {testclasses} --verbose --coverage-formatters json --results-dir coverage
12
+ sf project deploy [start/validate] -x manifest/package.xml -l RunSpecifiedTests -t {testclasses} --verbose --coverage-formatters json --results-dir coverage
13
13
  ```
14
14
 
15
15
  This will create a coverage JSON in this relative path - `coverage/coverage/coverage.json`
16
16
 
17
17
  This JSON isn't accepted by SonarQube automatically and needs to be converted using this plugin.
18
18
 
19
- **Disclaimer**: Due to existing bugs with how the Salesforce CLI reports `covered` lines (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, 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). Once Salesforce updates the API to correctly return `covered` lines in the deploy command, this function will be removed.
19
+ **Disclaimer**: Due to existing bugs with how the Salesforce CLI reports covered lines (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, 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.
20
20
 
21
21
  ## Install
22
22
 
@@ -24,7 +24,7 @@ This JSON isn't accepted by SonarQube automatically and needs to be converted us
24
24
  sf plugins install apex-code-coverage-transformer@x.y.z
25
25
  ```
26
26
 
27
- ## Commands
27
+ ## Command
28
28
 
29
29
  The `apex-code-coverage-transformer` has 1 command:
30
30
 
@@ -39,18 +39,18 @@ USAGE
39
39
  $ sf apex-code-coverage transformer transform -j <value> -x <value> -c <value> [--json]
40
40
 
41
41
  FLAGS
42
- -j, --coverage-json=<value> The path to the JSON file created by the Salesforce CLI for code coverage.
43
- -x, --xml=<value> [default: coverage.xml] Output path for the XML file created by this plugin
44
- -c, --sfdx-configuration=<value> [default: 'sfdx-project.json' in the current working directory] The path to your Salesforce DX configuration file, 'sfdx-project.json'.
42
+ -j, --coverage-json=<value> Path to the code coverage JSON file created by the Salesforce CLI deployment command.
43
+ -x, --xml=<value> [default: coverage.xml] Path to code coverage XML file that will be created by this plugin.
44
+ -c, --sfdx-configuration=<value> [default: 'sfdx-project.json'] Path to your project's Salesforce DX configuration file.
45
45
 
46
46
  GLOBAL FLAGS
47
47
  --json Format output as json.
48
48
 
49
49
  DESCRIPTION
50
- This plugin will convert the JSON file created by the Salesforce CLI during Apex deployments into the Generic Test Coverage Format.
50
+ This plugin will convert the code coverage JSON file created by the Salesforce CLI during Apex deployments into an XML accepted by tools like SonarQube.
51
51
 
52
52
  EXAMPLES
53
- $ apex-code-coverage transformer transform -j "test.json" -x "coverage.xml" -c "sfdx-project.json"
53
+ $ sf apex-code-coverage transformer transform -j "coverage.json" -x "coverage.xml" -c "sfdx-project.json"
54
54
  ```
55
55
 
56
56
  ## Errors and Warnings
@@ -85,76 +85,76 @@ Error (1): ENOENT: no such file or directory: {packageDirPath}
85
85
 
86
86
  ## Example
87
87
 
88
- This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/coverage_no_file_exts.json) created by the Salesforce CLI will be transformed into:
88
+ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/coverage_no_file_exts.json) created during a Salesforce CLI deployment will be transformed into:
89
89
 
90
90
  ```xml
91
91
  <?xml version="1.0"?>
92
92
  <coverage version="1">
93
- <file path="packaged\triggers\AccountTrigger.trigger">
94
- <lineToCover lineNumber="52" covered="false"/>
95
- <lineToCover lineNumber="53" covered="false"/>
96
- <lineToCover lineNumber="59" covered="false"/>
97
- <lineToCover lineNumber="60" covered="false"/>
98
- <lineToCover lineNumber="1" covered="true"/>
99
- <lineToCover lineNumber="2" covered="true"/>
100
- <lineToCover lineNumber="3" covered="true"/>
101
- <lineToCover lineNumber="4" covered="true"/>
102
- <lineToCover lineNumber="5" covered="true"/>
103
- <lineToCover lineNumber="6" covered="true"/>
104
- <lineToCover lineNumber="7" covered="true"/>
105
- <lineToCover lineNumber="8" covered="true"/>
106
- <lineToCover lineNumber="9" covered="true"/>
107
- <lineToCover lineNumber="10" covered="true"/>
108
- <lineToCover lineNumber="11" covered="true"/>
109
- <lineToCover lineNumber="12" covered="true"/>
110
- <lineToCover lineNumber="13" covered="true"/>
111
- <lineToCover lineNumber="14" covered="true"/>
112
- <lineToCover lineNumber="15" covered="true"/>
113
- <lineToCover lineNumber="16" covered="true"/>
114
- <lineToCover lineNumber="17" covered="true"/>
115
- <lineToCover lineNumber="18" covered="true"/>
116
- <lineToCover lineNumber="19" covered="true"/>
117
- <lineToCover lineNumber="20" covered="true"/>
118
- <lineToCover lineNumber="21" covered="true"/>
119
- <lineToCover lineNumber="22" covered="true"/>
120
- <lineToCover lineNumber="23" covered="true"/>
121
- <lineToCover lineNumber="24" covered="true"/>
122
- <lineToCover lineNumber="25" covered="true"/>
123
- <lineToCover lineNumber="26" covered="true"/>
124
- <lineToCover lineNumber="27" covered="true"/>
125
- </file>
126
- <file path="force-app\main\default\classes\AccountProfile.cls">
127
- <lineToCover lineNumber="52" covered="false"/>
128
- <lineToCover lineNumber="53" covered="false"/>
129
- <lineToCover lineNumber="59" covered="false"/>
130
- <lineToCover lineNumber="60" covered="false"/>
131
- <lineToCover lineNumber="54" covered="true"/>
132
- <lineToCover lineNumber="55" covered="true"/>
133
- <lineToCover lineNumber="56" covered="true"/>
134
- <lineToCover lineNumber="57" covered="true"/>
135
- <lineToCover lineNumber="58" covered="true"/>
136
- <lineToCover lineNumber="61" covered="true"/>
137
- <lineToCover lineNumber="62" covered="true"/>
138
- <lineToCover lineNumber="63" covered="true"/>
139
- <lineToCover lineNumber="64" covered="true"/>
140
- <lineToCover lineNumber="65" covered="true"/>
141
- <lineToCover lineNumber="66" covered="true"/>
142
- <lineToCover lineNumber="67" covered="true"/>
143
- <lineToCover lineNumber="68" covered="true"/>
144
- <lineToCover lineNumber="69" covered="true"/>
145
- <lineToCover lineNumber="70" covered="true"/>
146
- <lineToCover lineNumber="71" covered="true"/>
147
- <lineToCover lineNumber="72" covered="true"/>
148
- <lineToCover lineNumber="1" covered="true"/>
149
- <lineToCover lineNumber="2" covered="true"/>
150
- <lineToCover lineNumber="3" covered="true"/>
151
- <lineToCover lineNumber="4" covered="true"/>
152
- <lineToCover lineNumber="5" covered="true"/>
153
- <lineToCover lineNumber="6" covered="true"/>
154
- <lineToCover lineNumber="7" covered="true"/>
155
- <lineToCover lineNumber="8" covered="true"/>
156
- <lineToCover lineNumber="9" covered="true"/>
157
- <lineToCover lineNumber="10" covered="true"/>
158
- </file>
93
+ <file path="packaged/triggers/AccountTrigger.trigger">
94
+ <lineToCover lineNumber="52" covered="false"/>
95
+ <lineToCover lineNumber="53" covered="false"/>
96
+ <lineToCover lineNumber="59" covered="false"/>
97
+ <lineToCover lineNumber="60" covered="false"/>
98
+ <lineToCover lineNumber="1" covered="true"/>
99
+ <lineToCover lineNumber="2" covered="true"/>
100
+ <lineToCover lineNumber="3" covered="true"/>
101
+ <lineToCover lineNumber="4" covered="true"/>
102
+ <lineToCover lineNumber="5" covered="true"/>
103
+ <lineToCover lineNumber="6" covered="true"/>
104
+ <lineToCover lineNumber="7" covered="true"/>
105
+ <lineToCover lineNumber="8" covered="true"/>
106
+ <lineToCover lineNumber="9" covered="true"/>
107
+ <lineToCover lineNumber="10" covered="true"/>
108
+ <lineToCover lineNumber="11" covered="true"/>
109
+ <lineToCover lineNumber="12" covered="true"/>
110
+ <lineToCover lineNumber="13" covered="true"/>
111
+ <lineToCover lineNumber="14" covered="true"/>
112
+ <lineToCover lineNumber="15" covered="true"/>
113
+ <lineToCover lineNumber="16" covered="true"/>
114
+ <lineToCover lineNumber="17" covered="true"/>
115
+ <lineToCover lineNumber="18" covered="true"/>
116
+ <lineToCover lineNumber="19" covered="true"/>
117
+ <lineToCover lineNumber="20" covered="true"/>
118
+ <lineToCover lineNumber="21" covered="true"/>
119
+ <lineToCover lineNumber="22" covered="true"/>
120
+ <lineToCover lineNumber="23" covered="true"/>
121
+ <lineToCover lineNumber="24" covered="true"/>
122
+ <lineToCover lineNumber="25" covered="true"/>
123
+ <lineToCover lineNumber="26" covered="true"/>
124
+ <lineToCover lineNumber="27" covered="true"/>
125
+ </file>
126
+ <file path="force-app/main/default/classes/AccountProfile.cls">
127
+ <lineToCover lineNumber="52" covered="false"/>
128
+ <lineToCover lineNumber="53" covered="false"/>
129
+ <lineToCover lineNumber="59" covered="false"/>
130
+ <lineToCover lineNumber="60" covered="false"/>
131
+ <lineToCover lineNumber="54" covered="true"/>
132
+ <lineToCover lineNumber="55" covered="true"/>
133
+ <lineToCover lineNumber="56" covered="true"/>
134
+ <lineToCover lineNumber="57" covered="true"/>
135
+ <lineToCover lineNumber="58" covered="true"/>
136
+ <lineToCover lineNumber="61" covered="true"/>
137
+ <lineToCover lineNumber="62" covered="true"/>
138
+ <lineToCover lineNumber="63" covered="true"/>
139
+ <lineToCover lineNumber="64" covered="true"/>
140
+ <lineToCover lineNumber="65" covered="true"/>
141
+ <lineToCover lineNumber="66" covered="true"/>
142
+ <lineToCover lineNumber="67" covered="true"/>
143
+ <lineToCover lineNumber="68" covered="true"/>
144
+ <lineToCover lineNumber="69" covered="true"/>
145
+ <lineToCover lineNumber="70" covered="true"/>
146
+ <lineToCover lineNumber="71" covered="true"/>
147
+ <lineToCover lineNumber="72" covered="true"/>
148
+ <lineToCover lineNumber="1" covered="true"/>
149
+ <lineToCover lineNumber="2" covered="true"/>
150
+ <lineToCover lineNumber="3" covered="true"/>
151
+ <lineToCover lineNumber="4" covered="true"/>
152
+ <lineToCover lineNumber="5" covered="true"/>
153
+ <lineToCover lineNumber="6" covered="true"/>
154
+ <lineToCover lineNumber="7" covered="true"/>
155
+ <lineToCover lineNumber="8" covered="true"/>
156
+ <lineToCover lineNumber="9" covered="true"/>
157
+ <lineToCover lineNumber="10" covered="true"/>
158
+ </file>
159
159
  </coverage>
160
160
  ```
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
+ /* eslint-disable no-await-in-loop */
3
+ import { create } from 'xmlbuilder2';
2
4
  import { findFilePath } from './findFilePath.js';
3
5
  import { setCoveredLines } from './setCoveredLines.js';
4
6
  export async function convertToGenericCoverageReport(data, dxConfigFile) {
5
- let xml = '<?xml version="1.0"?>\n<coverage version="1">\n';
7
+ const coverageObj = { coverage: { '@version': '1', file: [] } };
6
8
  const warnings = [];
7
9
  let filesProcessed = 0;
8
10
  for (const fileName in data) {
@@ -15,23 +17,25 @@ export async function convertToGenericCoverageReport(data, dxConfigFile) {
15
17
  warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
16
18
  continue;
17
19
  }
18
- // Extract the "uncovered lines" from the JSON data
19
20
  const uncoveredLines = Object.keys(fileInfo.s)
20
21
  .filter((lineNumber) => fileInfo.s[lineNumber] === 0)
21
22
  .map(Number);
22
23
  const coveredLines = Object.keys(fileInfo.s)
23
24
  .filter((lineNumber) => fileInfo.s[lineNumber] === 1)
24
25
  .map(Number);
25
- xml += `\t<file path="${filePath}">\n`;
26
- for (const uncoveredLine of uncoveredLines) {
27
- xml += `\t\t<lineToCover lineNumber="${uncoveredLine}" covered="false"/>\n`;
28
- }
26
+ const fileObj = {
27
+ '@path': filePath,
28
+ lineToCover: uncoveredLines.map((lineNumber) => ({
29
+ '@lineNumber': lineNumber,
30
+ '@covered': 'false',
31
+ })),
32
+ };
29
33
  // this function is only needed until Salesforce fixes the API to correctly return covered lines
30
- xml += await setCoveredLines(coveredLines, uncoveredLines, filePath);
34
+ await setCoveredLines(coveredLines, uncoveredLines, filePath, fileObj);
31
35
  filesProcessed++;
32
- xml += '\t</file>\n';
36
+ coverageObj.coverage.file.push(fileObj);
33
37
  }
34
- xml += '</coverage>';
38
+ const xml = create(coverageObj).end({ prettyPrint: true, indent: ' ' });
35
39
  return { xml, warnings, filesProcessed };
36
40
  }
37
41
  //# sourceMappingURL=convertToGenericCoverageReport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertToGenericCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/convertToGenericCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,IAAk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;YAC5F,SAAS;QACX,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC3C,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aACpD,GAAG,CAAC,MAAM,CAAC,CAAC;QACf,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;aACzC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aACpD,GAAG,CAAC,MAAM,CAAC,CAAC;QAEf,MAAM,OAAO,GAAe;YAC1B,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC;gBACvD,aAAa,EAAE,UAAU;gBACzB,UAAU,EAAE,OAAO;aACpB,CAAC,CAAC;SACJ,CAAC;QAEF,gGAAgG;QAChG,MAAM,eAAe,CAAC,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvE,cAAc,EAAE,CAAC;QACjB,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAC3C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  /* eslint-disable no-await-in-loop */
3
3
  import { readdir, stat } from 'node:fs/promises';
4
- import { join } from 'node:path';
4
+ import { join } from 'node:path/posix';
5
5
  import { getPackageDirectories } from './getPackageDirectories.js';
6
6
  export async function findFilePath(fileName, dxConfigFile) {
7
7
  const packageDirectories = await getPackageDirectories(dxConfigFile);
@@ -1 +1 @@
1
- {"version":3,"file":"findFilePath.js","sourceRoot":"","sources":["../../src/helpers/findFilePath.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,YAAoB;IACvE,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAErE,IAAI,QAA4B,CAAC;IACjC,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE,CAAC;QAC3C,QAAQ,GAAG,MAAM,uBAAuB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,QAAgB,EAAE,WAAmB;IACpE,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC3D,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,MAAM,CAAC;YA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AC;IACpE,CAAC;SAAM,CAAC;QACN,+DAA+D;QAC/D,MAAM,QAAQ,GAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC9C,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC3B,gBAAgB,GAAG,MAAM,iBAAiB,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;YAC9E,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -1 +1,2 @@
1
- export declare function setCoveredLines(coveredLines: number[], uncoveredLines: number[], filePath: string): Promise<string>;
1
+ import { FileObject } from './types.js';
2
+ export declare function setCoveredLines(coveredLines: number[], uncoveredLines: number[], filePath: string, fileObj: FileObject): Promise<void>;
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
  import { getTotalLines } from './getTotalLines.js';
3
- export async function setCoveredLines(coveredLines, uncoveredLines, filePath) {
4
- let formattedCoveredLines = '';
3
+ export async function setCoveredLines(coveredLines, uncoveredLines, filePath, fileObj) {
5
4
  const randomLines = [];
6
5
  const totalLines = await getTotalLines(filePath);
7
6
  for (const coveredLine of coveredLines) {
@@ -10,16 +9,21 @@ export async function setCoveredLines(coveredLines, uncoveredLines, filePath) {
10
9
  if (!uncoveredLines.includes(randomLineNumber) &&
11
10
  !coveredLines.includes(randomLineNumber) &&
12
11
  !randomLines.includes(randomLineNumber)) {
13
- formattedCoveredLines += `\t\t<lineToCover lineNumber="${randomLineNumber}" covered="true"/>\n`;
12
+ fileObj.lineToCover.push({
13
+ '@lineNumber': randomLineNumber,
14
+ '@covered': 'true',
15
+ });
14
16
  randomLines.push(randomLineNumber);
15
17
  break;
16
18
  }
17
19
  }
18
20
  }
19
21
  else {
20
- formattedCoveredLines += `\t\t<lineToCover lineNumber="${coveredLine}" covered="true"/>\n`;
22
+ fileObj.lineToCover.push({
23
+ '@lineNumber': coveredLine,
24
+ '@covered': 'true',
25
+ });
21
26
  }
22
27
  }
23
- return formattedCoveredLines;
24
28
  }
25
29
  //# sourceMappingURL=setCoveredLines.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setCoveredLines.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLines.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,YAAsB,EACtB,cAAwB,EACxB,QAAgB;IAEhB,IAAI,qBAAqB,GAAW,EAAE,CAAC;IACvC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,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,qBAAqB,IAAI,gCAAgC,gBAAgB,sBAAsB,CAAC;oBAChG,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,qBAAqB,IAAI,gCAAgC,WAAW,sBAAsB,CAAC;QAC7F,CAAC;IACH,CAAC;IACD,OAAO,qBAAqB,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"setCoveredLines.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLines.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,OAAmB;IAEnB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,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"}
@@ -23,3 +23,18 @@ export interface SfdxProject {
23
23
  path: string;
24
24
  }>;
25
25
  }
26
+ interface LineToCover {
27
+ '@lineNumber': number;
28
+ '@covered': string;
29
+ }
30
+ export interface FileObject {
31
+ '@path': string;
32
+ lineToCover: LineToCover[];
33
+ }
34
+ export interface CoverageObject {
35
+ coverage: {
36
+ file: FileObject[];
37
+ '@version': string;
38
+ };
39
+ }
40
+ export {};
@@ -1,23 +1,23 @@
1
1
  # summary
2
2
 
3
- Transforms the Code Coverage JSON into the Generic Test Data Format (XML).
3
+ Transforms the Code Coverage JSON into the Generic Test Coverage Format (XML).
4
4
 
5
5
  # description
6
6
 
7
- This plugin will convert the JSON file created by the Salesforce CLI during Apex deployments
7
+ This plugin will convert the code coverage JSON file created by the Salesforce CLI during Apex deployments into an XML accepted by tools like SonarQube.
8
8
 
9
9
  # examples
10
10
 
11
- - `sf apex-code-coverage transformer transform --coverage-json "path-to-cli-coverage.json"`
11
+ - `sf apex-code-coverage transformer transform -j "coverage.json" -x "coverage.xml" -c "sfdx-project.json"`
12
12
 
13
13
  # flags.sfdx-configuration.summary
14
14
 
15
- Path to your project's Salesforce DX configuration file (`sfdx-project.json`). By default, it will look for `sfdx-project.json` in the same directory you're running this plugin in.
15
+ Path to your project's Salesforce DX configuration file.
16
16
 
17
17
  # flags.coverage-json.summary
18
18
 
19
- Path to the JSON file created by the Salesforce CLI deployment command.
19
+ Path to the code coverage JSON file created by the Salesforce CLI deployment command.
20
20
 
21
21
  # flags.xml.summary
22
22
 
23
- XML file created by this plugin (default: `coverage.xml`).
23
+ Path to code coverage XML file that will be created by this plugin.
package/oclif.lock CHANGED
@@ -2105,6 +2105,35 @@
2105
2105
  dependencies:
2106
2106
  "@octokit/openapi-types" "^12.11.0"
2107
2107
 
2108
+ "@oozcitak/dom@1.15.10":
2109
+ version "1.15.10"
2110
+ resolved "https://registry.yarnpkg.com/@oozcitak/dom/-/dom-1.15.10.tgz#dca7289f2b292cff2a901ea4fbbcc0a1ab0b05c2"
2111
+ integrity sha512-0JT29/LaxVgRcGKvHmSrUTEvZ8BXvZhGl2LASRUgHqDTC1M5g1pLmVv56IYNyt3bG2CUjDkc67wnyZC14pbQrQ==
2112
+ dependencies:
2113
+ "@oozcitak/infra" "1.0.8"
2114
+ "@oozcitak/url" "1.0.4"
2115
+ "@oozcitak/util" "8.3.8"
2116
+
2117
+ "@oozcitak/infra@1.0.8":
2118
+ version "1.0.8"
2119
+ resolved "https://registry.yarnpkg.com/@oozcitak/infra/-/infra-1.0.8.tgz#b0b089421f7d0f6878687608301fbaba837a7d17"
2120
+ integrity sha512-JRAUc9VR6IGHOL7OGF+yrvs0LO8SlqGnPAMqyzOuFZPSZSXI7Xf2O9+awQPSMXgIWGtgUf/dA6Hs6X6ySEaWTg==
2121
+ dependencies:
2122
+ "@oozcitak/util" "8.3.8"
2123
+
2124
+ "@oozcitak/url@1.0.4":
2125
+ version "1.0.4"
2126
+ resolved "https://registry.yarnpkg.com/@oozcitak/url/-/url-1.0.4.tgz#ca8b1c876319cf5a648dfa1123600a6aa5cda6ba"
2127
+ integrity sha512-kDcD8y+y3FCSOvnBI6HJgl00viO/nGbQoCINmQ0h98OhnGITrWR3bOGfwYCthgcrV8AnTJz8MzslTQbC3SOAmw==
2128
+ dependencies:
2129
+ "@oozcitak/infra" "1.0.8"
2130
+ "@oozcitak/util" "8.3.8"
2131
+
2132
+ "@oozcitak/util@8.3.8":
2133
+ version "8.3.8"
2134
+ resolved "https://registry.yarnpkg.com/@oozcitak/util/-/util-8.3.8.tgz#10f65fe1891fd8cde4957360835e78fd1936bfdd"
2135
+ integrity sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==
2136
+
2108
2137
  "@pkgjs/parseargs@^0.11.0":
2109
2138
  version "0.11.0"
2110
2139
  resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz"
@@ -7125,14 +7154,7 @@ js-tokens@^4.0.0:
7125
7154
  resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
7126
7155
  integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
7127
7156
 
7128
- js-yaml@4.1.0, js-yaml@^4.1.0:
7129
- version "4.1.0"
7130
- resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz"
7131
- integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
7132
- dependencies:
7133
- argparse "^2.0.1"
7134
-
7135
- js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.14.1:
7157
+ js-yaml@3.14.1, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.14.1:
7136
7158
  version "3.14.1"
7137
7159
  resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz"
7138
7160
  integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
@@ -7140,6 +7162,13 @@ js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.14.1:
7140
7162
  argparse "^1.0.7"
7141
7163
  esprima "^4.0.0"
7142
7164
 
7165
+ js-yaml@4.1.0, js-yaml@^4.1.0:
7166
+ version "4.1.0"
7167
+ resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz"
7168
+ integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
7169
+ dependencies:
7170
+ argparse "^2.0.1"
7171
+
7143
7172
  js2xmlparser@^4.0.1:
7144
7173
  version "4.0.2"
7145
7174
  resolved "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz"
@@ -8681,7 +8710,7 @@ npm-package-arg@^11.0.0, npm-package-arg@^11.0.1:
8681
8710
  semver "^7.3.5"
8682
8711
  validate-npm-package-name "^5.0.0"
8683
8712
 
8684
- npm-package-arg@^8.0.0, npm-package-arg@^8.0.1, npm-package-arg@^8.1.0, npm-package-arg@^8.1.2, npm-package-arg@^8.1.4, npm-package-arg@^8.1.5:
8713
+ npm-package-arg@^8.0.0, npm-package-arg@^8.0.1, npm-package-arg@^8.1.0, npm-package-arg@^8.1.1, npm-package-arg@^8.1.2, npm-package-arg@^8.1.5:
8685
8714
  version "8.1.5"
8686
8715
  resolved "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz"
8687
8716
  integrity sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==
@@ -9388,7 +9417,7 @@ package-hash@^4.0.0:
9388
9417
  lodash.flattendeep "^4.4.0"
9389
9418
  release-zalgo "^1.0.0"
9390
9419
 
9391
- pacote@^11.1.11, pacote@^11.2.6, pacote@^11.3.1, pacote@^11.3.4, pacote@^11.3.5:
9420
+ pacote@^11.1.11, pacote@^11.2.6, pacote@^11.3.0, pacote@^11.3.1, pacote@^11.3.5:
9392
9421
  version "11.3.5"
9393
9422
  resolved "https://registry.npmjs.org/pacote/-/pacote-11.3.5.tgz"
9394
9423
  integrity sha512-fT375Yczn4zi+6Hkk2TBe1x1sP8FgFsEIZ2/iWaXY2r/NkhDJfxbcn5paz1+RTFCyNf+dPnaoBDJoAxXSU8Bkg==
@@ -10841,7 +10870,7 @@ stream-combiner2@~1.1.1:
10841
10870
  duplexer2 "~0.1.0"
10842
10871
  readable-stream "^2.0.2"
10843
10872
 
10844
- "string-width-cjs@npm:string-width@^4.2.0":
10873
+ "string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10845
10874
  version "4.2.3"
10846
10875
  resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10847
10876
  integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10859,15 +10888,6 @@ string-width@^1.0.1:
10859
10888
  is-fullwidth-code-point "^1.0.0"
10860
10889
  strip-ansi "^3.0.0"
10861
10890
 
10862
- "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10863
- version "4.2.3"
10864
- resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10865
- integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10866
- dependencies:
10867
- emoji-regex "^8.0.0"
10868
- is-fullwidth-code-point "^3.0.0"
10869
- strip-ansi "^6.0.1"
10870
-
10871
10891
  string-width@^2.0.0:
10872
10892
  version "2.1.1"
10873
10893
  resolved "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz"
@@ -10931,14 +10951,7 @@ stringify-package@^1.0.1:
10931
10951
  resolved "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.1.tgz"
10932
10952
  integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg==
10933
10953
 
10934
- "strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10935
- version "6.0.1"
10936
- resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10937
- integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10938
- dependencies:
10939
- ansi-regex "^5.0.1"
10940
-
10941
- strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10954
+ "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10942
10955
  version "6.0.1"
10943
10956
  resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10944
10957
  integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11849,7 +11862,7 @@ workerpool@6.2.1:
11849
11862
  resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz"
11850
11863
  integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
11851
11864
 
11852
- "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11865
+ "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
11853
11866
  version "7.0.0"
11854
11867
  resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11855
11868
  integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11867,15 +11880,6 @@ wrap-ansi@^6.2.0:
11867
11880
  string-width "^4.1.0"
11868
11881
  strip-ansi "^6.0.0"
11869
11882
 
11870
- wrap-ansi@^7.0.0:
11871
- version "7.0.0"
11872
- resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11873
- integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11874
- dependencies:
11875
- ansi-styles "^4.0.0"
11876
- string-width "^4.1.0"
11877
- strip-ansi "^6.0.0"
11878
-
11879
11883
  wrap-ansi@^8.1.0:
11880
11884
  version "8.1.0"
11881
11885
  resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11924,6 +11928,16 @@ xml2js@^0.5.0:
11924
11928
  sax ">=0.6.0"
11925
11929
  xmlbuilder "~11.0.0"
11926
11930
 
11931
+ xmlbuilder2@^3.1.1:
11932
+ version "3.1.1"
11933
+ resolved "https://registry.yarnpkg.com/xmlbuilder2/-/xmlbuilder2-3.1.1.tgz#b977ef8a6fb27a1ea7ffa7d850d2c007ff343bc0"
11934
+ integrity sha512-WCSfbfZnQDdLQLiMdGUQpMxxckeQ4oZNMNhLVkcekTu7xhD4tuUDyAPoY8CwXvBYE6LwBHd6QW2WZXlOWr1vCw==
11935
+ dependencies:
11936
+ "@oozcitak/dom" "1.15.10"
11937
+ "@oozcitak/infra" "1.0.8"
11938
+ "@oozcitak/util" "8.3.8"
11939
+ js-yaml "3.14.1"
11940
+
11927
11941
  xmlbuilder@~11.0.0:
11928
11942
  version "11.0.1"
11929
11943
  resolved "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz"
@@ -3,9 +3,9 @@
3
3
  "apex-code-coverage:transformer:transform": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "This plugin will convert the JSON file created by the Salesforce CLI during Apex deployments",
6
+ "description": "This plugin will convert the code coverage JSON file created by the Salesforce CLI during Apex deployments into an XML accepted by tools like SonarQube.",
7
7
  "examples": [
8
- "`sf apex-code-coverage transformer transform --coverage-json \"path-to-cli-coverage.json\"`"
8
+ "`sf apex-code-coverage transformer transform -j \"coverage.json\" -x \"coverage.xml\" -c \"sfdx-project.json\"`"
9
9
  ],
10
10
  "flags": {
11
11
  "json": {
@@ -19,7 +19,7 @@
19
19
  "char": "c",
20
20
  "name": "sfdx-configuration",
21
21
  "required": true,
22
- "summary": "Path to your project's Salesforce DX configuration file (`sfdx-project.json`). By default, it will look for `sfdx-project.json` in the same directory you're running this plugin in.",
22
+ "summary": "Path to your project's Salesforce DX configuration file.",
23
23
  "default": "sfdx-project.json",
24
24
  "hasDynamicHelp": false,
25
25
  "multiple": false,
@@ -29,7 +29,7 @@
29
29
  "char": "j",
30
30
  "name": "coverage-json",
31
31
  "required": true,
32
- "summary": "Path to the JSON file created by the Salesforce CLI deployment command.",
32
+ "summary": "Path to the code coverage JSON file created by the Salesforce CLI deployment command.",
33
33
  "hasDynamicHelp": false,
34
34
  "multiple": false,
35
35
  "type": "option"
@@ -38,7 +38,7 @@
38
38
  "char": "x",
39
39
  "name": "xml",
40
40
  "required": true,
41
- "summary": "XML file created by this plugin (default: `coverage.xml`).",
41
+ "summary": "Path to code coverage XML file that will be created by this plugin.",
42
42
  "default": "coverage.xml",
43
43
  "hasDynamicHelp": false,
44
44
  "multiple": false,
@@ -52,7 +52,7 @@
52
52
  "pluginName": "apex-code-coverage-transformer",
53
53
  "pluginType": "core",
54
54
  "strict": true,
55
- "summary": "Transforms the Code Coverage JSON into the Generic Test Data Format (XML).",
55
+ "summary": "Transforms the Code Coverage JSON into the Generic Test Coverage Format (XML).",
56
56
  "enableJsonFlag": true,
57
57
  "isESM": true,
58
58
  "relativePath": [
@@ -73,5 +73,5 @@
73
73
  ]
74
74
  }
75
75
  },
76
- "version": "1.6.4"
76
+ "version": "1.6.5"
77
77
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "apex-code-coverage-transformer",
3
- "description": "Transforms the Apex Code Coverage JSON into the Generic Test Data Report.",
4
- "version": "1.6.4",
3
+ "description": "Transforms the Apex code coverage JSON created during Salesforce deployments into the Generic Test Coverage Format (XML).",
4
+ "version": "1.6.5",
5
5
  "dependencies": {
6
6
  "@oclif/core": "^3.18.1",
7
7
  "@salesforce/core": "^6.4.7",
8
- "@salesforce/sf-plugins-core": "^7.1.3"
8
+ "@salesforce/sf-plugins-core": "^7.1.3",
9
+ "xmlbuilder2": "^3.1.1"
9
10
  },
10
11
  "devDependencies": {
11
12
  "@commitlint/cli": "^18.6.0",
@@ -46,7 +47,9 @@
46
47
  "sfdx-plugin",
47
48
  "xml",
48
49
  "json",
49
- "sonarqube"
50
+ "sonarqube",
51
+ "apex",
52
+ "coverage"
50
53
  ],
51
54
  "license": "MIT",
52
55
  "oclif": {