apex-code-coverage-transformer 2.12.0 → 2.13.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 +11 -7
- package/lib/commands/acc-transformer/transform.d.ts +1 -1
- package/lib/commands/acc-transformer/transform.js +5 -6
- package/lib/commands/acc-transformer/transform.js.map +1 -1
- package/lib/hooks/postrun.js +8 -2
- package/lib/hooks/postrun.js.map +1 -1
- package/lib/transformers/coverageTransformer.d.ts +2 -2
- package/lib/transformers/coverageTransformer.js +72 -38
- package/lib/transformers/coverageTransformer.js.map +1 -1
- package/lib/transformers/reportGenerator.d.ts +1 -1
- package/lib/transformers/reportGenerator.js +5 -3
- package/lib/transformers/reportGenerator.js.map +1 -1
- package/lib/utils/types.d.ts +9 -1
- package/oclif.lock +35 -10
- package/oclif.manifest.json +3 -4
- package/package.json +5 -4
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.13.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.12.1...v2.13.0) (2025-06-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* allow multiple output formats ([#193](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/193)) ([58c024d](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/58c024dff5e5bdba983ba55ce15ca0d7c25b4a98))
|
|
14
|
+
|
|
15
|
+
## [2.12.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.12.0...v2.12.1) (2025-06-22)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* upgrade @salesforce/sf-plugins-core from 12.2.1 to 12.2.2 ([#191](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/191)) ([0fd939d](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/0fd939d8e2977d2f8f90238e339b5116f573affa))
|
|
21
|
+
|
|
8
22
|
## [2.12.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.11.8...v2.12.0) (2025-06-17)
|
|
9
23
|
|
|
10
24
|
|
package/README.md
CHANGED
|
@@ -99,6 +99,8 @@ FLAGS
|
|
|
99
99
|
-r, --output-report=<value> Path to the code coverage file that will be created by this plugin.
|
|
100
100
|
[default: "coverage.[xml/info]"]
|
|
101
101
|
-f, --format=<value> Output format for the code coverage format.
|
|
102
|
+
Can be declared multiple times.
|
|
103
|
+
If declared multiple times, the output report will have the format appended to the file-name, i.e. `coverage-sonar.xml`
|
|
102
104
|
[default: "sonar"]
|
|
103
105
|
-i, --ignore-package-directory=<value> Package directory to ignore when looking for matching files in the coverage report.
|
|
104
106
|
Should be as they appear in the "sfdx-project.json".
|
|
@@ -133,6 +135,8 @@ EXAMPLES
|
|
|
133
135
|
|
|
134
136
|
The `-f`/`--format` flag allows you to specify the format of the transformed coverage report.
|
|
135
137
|
|
|
138
|
+
You can provide multiple `--format` flags in a single command to create multiple reports. If multiple `--format` flags are provided, each output report will have the format appended to the name. For example, if `--output-report` is set `coverage.xml` and you supply `--format sonar --format cobertura` to the command, the output reports will be `coverage-sonar.xml` and `coverage-cobertura.xml`.
|
|
139
|
+
|
|
136
140
|
| Flag Option | Description |
|
|
137
141
|
| ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
138
142
|
| [sonar](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/baselines/sonar_baseline.xml) | Generates a SonarQube-compatible coverage report. This is the default option. |
|
|
@@ -161,13 +165,13 @@ You can copy & update the sample [SFDX Hardis .apexcodecovtransformer.config.jso
|
|
|
161
165
|
|
|
162
166
|
**`.apexcodecovtransformer.config.json` structure**
|
|
163
167
|
|
|
164
|
-
| JSON Key | Required | Description
|
|
165
|
-
| -------------------------- | -------------------------------------- |
|
|
166
|
-
| `deployCoverageJsonPath` | Yes (for deploy command) | Code coverage JSON created by the Salesforce CLI deploy commands.
|
|
167
|
-
| `testCoverageJsonPath` | Yes (for test command) | Code coverage JSON created by the Salesforce CLI test commands.
|
|
168
|
-
| `outputReportPath` | No (defaults to `coverage.[xml/info]`) | Transformed code coverage report path.
|
|
169
|
-
| `format` | No (defaults to `sonar`) | Transformed code coverage report [format](#coverage-report-formats).
|
|
170
|
-
| `ignorePackageDirectories` | No | Comma-separated string of package directories to ignore when looking for matching Apex files.
|
|
168
|
+
| JSON Key | Required | Description |
|
|
169
|
+
| -------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
170
|
+
| `deployCoverageJsonPath` | Yes (for deploy command) | Code coverage JSON created by the Salesforce CLI deploy commands. |
|
|
171
|
+
| `testCoverageJsonPath` | Yes (for test command) | Code coverage JSON created by the Salesforce CLI test commands. |
|
|
172
|
+
| `outputReportPath` | No (defaults to `coverage.[xml/info]`) | Transformed code coverage report path. |
|
|
173
|
+
| `format` | No (defaults to `sonar`) | Transformed code coverage report [format(s)](#coverage-report-formats). If you're providing multiple formats, provide a comma-separated list, i.e. `sonar,cobertura,jacoco` |
|
|
174
|
+
| `ignorePackageDirectories` | No | Comma-separated string of package directories to ignore when looking for matching Apex files. |
|
|
171
175
|
|
|
172
176
|
## Troubleshooting
|
|
173
177
|
|
|
@@ -7,7 +7,7 @@ export default class TransformerTransform extends SfCommand<TransformerTransform
|
|
|
7
7
|
static readonly flags: {
|
|
8
8
|
'coverage-json': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
'output-report': 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
|
+
format: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
'ignore-package-directory': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
13
|
run(): Promise<TransformerTransformResult>;
|
|
@@ -24,9 +24,8 @@ export default class TransformerTransform extends SfCommand {
|
|
|
24
24
|
format: Flags.string({
|
|
25
25
|
summary: messages.getMessage('flags.format.summary'),
|
|
26
26
|
char: 'f',
|
|
27
|
-
required:
|
|
28
|
-
multiple:
|
|
29
|
-
default: 'sonar',
|
|
27
|
+
required: false,
|
|
28
|
+
multiple: true,
|
|
30
29
|
options: formatOptions,
|
|
31
30
|
}),
|
|
32
31
|
'ignore-package-directory': Flags.directory({
|
|
@@ -39,15 +38,15 @@ export default class TransformerTransform extends SfCommand {
|
|
|
39
38
|
async run() {
|
|
40
39
|
const { flags } = await this.parse(TransformerTransform);
|
|
41
40
|
const warnings = [];
|
|
42
|
-
const result = await transformCoverageReport(flags['coverage-json'], flags['output-report'], flags['format'], flags['ignore-package-directory'] ?? []);
|
|
41
|
+
const result = await transformCoverageReport(flags['coverage-json'], flags['output-report'], flags['format'] ?? ['sonar'], flags['ignore-package-directory'] ?? []);
|
|
43
42
|
warnings.push(...result.warnings);
|
|
44
|
-
const finalPath = result.
|
|
43
|
+
const finalPath = result.finalPaths;
|
|
45
44
|
if (warnings.length > 0) {
|
|
46
45
|
warnings.forEach((warning) => {
|
|
47
46
|
this.warn(warning);
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
|
-
this.log(`The coverage report has been written to ${finalPath}`);
|
|
49
|
+
this.log(`The coverage report has been written to: ${finalPath.join(', ')}`);
|
|
51
50
|
return { path: finalPath };
|
|
52
51
|
}
|
|
53
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/commands/acc-transformer/transform.ts"],"names":[],"mappings":"AAAA,YA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QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,aAAa;SACvB,CAAC;QACF,0BAA0B,EAAE,KAAK,CAAC,SAAS,CAAC;YAC1C,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wCAAwC,CAAC;YACtE,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAC1C,KAAK,CAAC,eAAe,CAAC,EACtB,KAAK,CAAC,eAAe,CAAC,EACtB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAC5B,KAAK,CAAC,0BAA0B,CAAC,IAAI,EAAE,CACxC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;QAEpC,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,GAAG,CAAC,4CAA4C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7E,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC7B,CAAC"}
|
package/lib/hooks/postrun.js
CHANGED
|
@@ -57,8 +57,14 @@ export const postrun = async function (options) {
|
|
|
57
57
|
commandArgs.push(coverageJsonPath);
|
|
58
58
|
commandArgs.push('--output-report');
|
|
59
59
|
commandArgs.push(outputReportPath);
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if (coverageFormat.trim() !== '') {
|
|
61
|
+
const formatArray = coverageFormat.split(',');
|
|
62
|
+
for (const format of formatArray) {
|
|
63
|
+
const sanitizedFormat = format.replace(/,/g, '');
|
|
64
|
+
commandArgs.push('--format');
|
|
65
|
+
commandArgs.push(sanitizedFormat);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
62
68
|
if (ignorePackageDirs.trim() !== '') {
|
|
63
69
|
const ignorePackageDirArray = ignorePackageDirs.split(',');
|
|
64
70
|
for (const dirs of ignorePackageDirArray) {
|
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,yBAAyB,CAAC;AAEtD,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,WAAW,OAAO;IAC7D,IAAI,WAAmB,CAAC;IACxB,IAAI,YAAoB,CAAC;IACzB,IACE;QACE,yBAAyB;QACzB,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;QACvB,6BAA6B;KAC9B,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAC9B,CAAC;QACD,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC;SAAM,IAAI,CAAC,eAAe,EAAE,eAAe,EAAE,sBAAsB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QACnG,WAAW,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,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxD,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;YACjC,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACjD,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7B,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IACD,IAAI,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACpC,MAAM,qBAAqB,GAAa,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrE,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;YACzC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5C,WAAW,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YAC/C,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,MAAM,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function transformCoverageReport(jsonFilePath: string, outputReportPath: string,
|
|
2
|
-
|
|
1
|
+
export declare function transformCoverageReport(jsonFilePath: string, outputReportPath: string, formats: string[], ignoreDirs: string[]): Promise<{
|
|
2
|
+
finalPaths: string[];
|
|
3
3
|
warnings: string[];
|
|
4
4
|
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
1
2
|
import { readFile } from 'node:fs/promises';
|
|
2
3
|
import { mapLimit } from 'async';
|
|
3
4
|
import { getCoverageHandler } from '../handlers/getHandler.js';
|
|
@@ -7,50 +8,30 @@ import { setCoveredLines } from '../utils/setCoveredLines.js';
|
|
|
7
8
|
import { getConcurrencyThreshold } from '../utils/getConcurrencyThreshold.js';
|
|
8
9
|
import { checkCoverageDataType } from '../utils/setCoverageDataType.js';
|
|
9
10
|
import { generateAndWriteReport } from './reportGenerator.js';
|
|
10
|
-
export async function transformCoverageReport(jsonFilePath, outputReportPath,
|
|
11
|
+
export async function transformCoverageReport(jsonFilePath, outputReportPath, formats, ignoreDirs) {
|
|
11
12
|
const warnings = [];
|
|
13
|
+
const finalPaths = [];
|
|
12
14
|
let filesProcessed = 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
warnings.push(`Failed to read ${jsonFilePath}. Confirm file exists.`);
|
|
19
|
-
return { finalPath: outputReportPath, warnings };
|
|
20
|
-
}
|
|
15
|
+
const jsonData = await tryReadJson(jsonFilePath, warnings);
|
|
16
|
+
if (!jsonData)
|
|
17
|
+
return { finalPaths: [outputReportPath], warnings };
|
|
21
18
|
const parsedData = JSON.parse(jsonData);
|
|
22
19
|
const { repoRoot, packageDirectories } = await getPackageDirectories(ignoreDirs);
|
|
23
|
-
const
|
|
20
|
+
const handlers = createHandlers(formats);
|
|
24
21
|
const commandType = checkCoverageDataType(parsedData);
|
|
25
22
|
const concurrencyLimit = getConcurrencyThreshold();
|
|
23
|
+
const context = {
|
|
24
|
+
handlers,
|
|
25
|
+
packageDirs: packageDirectories,
|
|
26
|
+
repoRoot,
|
|
27
|
+
concurrencyLimit,
|
|
28
|
+
warnings,
|
|
29
|
+
};
|
|
26
30
|
if (commandType === 'DeployCoverageData') {
|
|
27
|
-
await
|
|
28
|
-
const fileInfo = parsedData[fileName];
|
|
29
|
-
const formattedFileName = fileName.replace(/no-map[\\/]+/, '');
|
|
30
|
-
const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
|
|
31
|
-
if (!relativeFilePath) {
|
|
32
|
-
warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const updatedLines = await setCoveredLines(relativeFilePath, repoRoot, fileInfo.s);
|
|
36
|
-
fileInfo.s = updatedLines;
|
|
37
|
-
handler.processFile(relativeFilePath, formattedFileName, fileInfo.s);
|
|
38
|
-
filesProcessed++;
|
|
39
|
-
});
|
|
31
|
+
filesProcessed = await processDeployCoverage(parsedData, context);
|
|
40
32
|
}
|
|
41
33
|
else if (commandType === 'TestCoverageData') {
|
|
42
|
-
await
|
|
43
|
-
const name = entry?.name;
|
|
44
|
-
const lines = entry?.lines;
|
|
45
|
-
const formattedFileName = name.replace(/no-map[\\/]+/, '');
|
|
46
|
-
const relativeFilePath = await findFilePath(formattedFileName, packageDirectories, repoRoot);
|
|
47
|
-
if (!relativeFilePath) {
|
|
48
|
-
warnings.push(`The file name ${formattedFileName} was not found in any package directory.`);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
handler.processFile(relativeFilePath, formattedFileName, lines);
|
|
52
|
-
filesProcessed++;
|
|
53
|
-
});
|
|
34
|
+
filesProcessed = await processTestCoverage(parsedData, context);
|
|
54
35
|
}
|
|
55
36
|
else {
|
|
56
37
|
throw new Error('The provided JSON does not match a known coverage data format from the Salesforce deploy or test command.');
|
|
@@ -58,8 +39,61 @@ export async function transformCoverageReport(jsonFilePath, outputReportPath, fo
|
|
|
58
39
|
if (filesProcessed === 0) {
|
|
59
40
|
warnings.push('None of the files listed in the coverage JSON were processed. The coverage report will be empty.');
|
|
60
41
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
for (const [format, handler] of handlers.entries()) {
|
|
43
|
+
const coverageObj = handler.finalize();
|
|
44
|
+
const finalPath = await generateAndWriteReport(outputReportPath, coverageObj, format, formats);
|
|
45
|
+
finalPaths.push(finalPath);
|
|
46
|
+
}
|
|
47
|
+
return { finalPaths, warnings };
|
|
48
|
+
}
|
|
49
|
+
async function tryReadJson(path, warnings) {
|
|
50
|
+
try {
|
|
51
|
+
return await readFile(path, 'utf-8');
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
warnings.push(`Failed to read ${path}. Confirm file exists.`);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function createHandlers(formats) {
|
|
59
|
+
const handlers = new Map();
|
|
60
|
+
for (const format of formats) {
|
|
61
|
+
handlers.set(format, getCoverageHandler(format));
|
|
62
|
+
}
|
|
63
|
+
return handlers;
|
|
64
|
+
}
|
|
65
|
+
async function processDeployCoverage(data, context) {
|
|
66
|
+
let processed = 0;
|
|
67
|
+
await mapLimit(Object.keys(data), context.concurrencyLimit, async (fileName) => {
|
|
68
|
+
const fileInfo = data[fileName];
|
|
69
|
+
const formattedName = fileName.replace(/no-map[\\/]+/, '');
|
|
70
|
+
const path = await findFilePath(formattedName, context.packageDirs, context.repoRoot);
|
|
71
|
+
if (!path) {
|
|
72
|
+
context.warnings.push(`The file name ${formattedName} was not found in any package directory.`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
fileInfo.s = await setCoveredLines(path, context.repoRoot, fileInfo.s);
|
|
76
|
+
for (const handler of context.handlers.values()) {
|
|
77
|
+
handler.processFile(path, formattedName, fileInfo.s);
|
|
78
|
+
}
|
|
79
|
+
processed++;
|
|
80
|
+
});
|
|
81
|
+
return processed;
|
|
82
|
+
}
|
|
83
|
+
async function processTestCoverage(data, context) {
|
|
84
|
+
let processed = 0;
|
|
85
|
+
await mapLimit(data, context.concurrencyLimit, async (entry) => {
|
|
86
|
+
const formattedName = entry.name.replace(/no-map[\\/]+/, '');
|
|
87
|
+
const path = await findFilePath(formattedName, context.packageDirs, context.repoRoot);
|
|
88
|
+
if (!path) {
|
|
89
|
+
context.warnings.push(`The file name ${formattedName} was not found in any package directory.`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
for (const handler of context.handlers.values()) {
|
|
93
|
+
handler.processFile(path, formattedName, entry.lines);
|
|
94
|
+
}
|
|
95
|
+
processed++;
|
|
96
|
+
});
|
|
97
|
+
return processed;
|
|
64
98
|
}
|
|
65
99
|
//# sourceMappingURL=coverageTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverageTransformer.js","sourceRoot":"","sources":["../../src/transformers/coverageTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAI9D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,YAAoB,EACpB,gBAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"coverageTransformer.js","sourceRoot":"","sources":["../../src/transformers/coverageTransformer.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAA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AAC;YAChG,OAAO;QACT,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAChD,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACxD,CAAC;QACD,SAAS,EAAE,CAAC;IACd,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SonarCoverageObject, CoberturaCoverageObject, CloverCoverageObject, LcovCoverageObject, JaCoCoCoverageObject, IstanbulCoverageObject } from '../utils/types.js';
|
|
2
|
-
export declare function generateAndWriteReport(outputPath: string, coverageObj: SonarCoverageObject | CoberturaCoverageObject | CloverCoverageObject | LcovCoverageObject | JaCoCoCoverageObject | IstanbulCoverageObject, format: string): Promise<string>;
|
|
2
|
+
export declare function generateAndWriteReport(outputPath: string, coverageObj: SonarCoverageObject | CoberturaCoverageObject | CloverCoverageObject | LcovCoverageObject | JaCoCoCoverageObject | IstanbulCoverageObject, format: string, allFormats: string[]): Promise<string>;
|
|
3
3
|
export declare function getExtensionForFormat(format: string): string;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { extname, basename, dirname, join } from 'node:path';
|
|
3
3
|
import { create } from 'xmlbuilder2';
|
|
4
|
-
export async function generateAndWriteReport(outputPath, coverageObj, format
|
|
4
|
+
export async function generateAndWriteReport(outputPath, coverageObj, format, allFormats // NEW PARAMETER
|
|
5
|
+
) {
|
|
5
6
|
const content = generateReportContent(coverageObj, format);
|
|
6
7
|
const extension = getExtensionForFormat(format);
|
|
7
|
-
const base = basename(outputPath, extname(outputPath)); //
|
|
8
|
+
const base = basename(outputPath, extname(outputPath)); // e.g., 'coverage'
|
|
8
9
|
const dir = dirname(outputPath);
|
|
9
|
-
const
|
|
10
|
+
const suffix = allFormats.length > 1 ? `-${format}` : '';
|
|
11
|
+
const filePath = join(dir, `${base}${suffix}${extension}`);
|
|
10
12
|
await writeFile(filePath, content, 'utf-8');
|
|
11
13
|
return filePath;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportGenerator.js","sourceRoot":"","sources":["../../src/transformers/reportGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAWrC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAkB,EAClB,WAM0B,EAC1B,MAAc
|
|
1
|
+
{"version":3,"file":"reportGenerator.js","sourceRoot":"","sources":["../../src/transformers/reportGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAWrC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAkB,EAClB,WAM0B,EAC1B,MAAc,EACd,UAAoB,CAAC,gBAAgB;;IAErC,MAAM,OAAO,GAAG,qBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEhD,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,mBAAmB;IAC3E,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEhC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,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IAAI,CAAC,UAAU,EAAE;YACvB,OAAO;YACP,OAAO;YACP,QAAQ;YACR,MAAM,IAAI,CAAC,UAAU,EAAE;YACvB,MAAM,IAAI,CAAC,YAAY,EAAE;YACzB,OAAO;YACP,OAAO;YACP,eAAe;SAChB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW,EAAE,MAAc;IACnD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,8GAA8G,GAAG,EAAE,CAAC;QAC7H,KAAK,QAAQ;YACX,OAAO,2CAA2C,GAAG,EAAE,CAAC;QAC1D,KAAK,QAAQ;YACX,OAAO,mIAAmI,GAAG,EAAE,CAAC;QAClJ;YACE,OAAO,GAAG,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,IAAI,MAAM,KAAK,UAAU;QAAE,OAAO,OAAO,CAAC;IAC1C,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAY;IACxC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,IAAI,GAAG,CAAC;AACnE,CAAC"}
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { getCoverageHandler } from '../handlers/getHandler.js';
|
|
1
2
|
export type TransformerTransformResult = {
|
|
2
|
-
path: string;
|
|
3
|
+
path: string[];
|
|
3
4
|
};
|
|
4
5
|
export type DeployCoverageData = {
|
|
5
6
|
[className: string]: {
|
|
@@ -34,6 +35,13 @@ export type SfdxProject = {
|
|
|
34
35
|
path: string;
|
|
35
36
|
}>;
|
|
36
37
|
};
|
|
38
|
+
export type CoverageProcessingContext = {
|
|
39
|
+
handlers: Map<string, ReturnType<typeof getCoverageHandler>>;
|
|
40
|
+
packageDirs: string[];
|
|
41
|
+
repoRoot: string;
|
|
42
|
+
concurrencyLimit: number;
|
|
43
|
+
warnings: string[];
|
|
44
|
+
};
|
|
37
45
|
type SonarLine = {
|
|
38
46
|
'@lineNumber': number;
|
|
39
47
|
'@covered': string;
|
package/oclif.lock
CHANGED
|
@@ -2108,7 +2108,7 @@
|
|
|
2108
2108
|
strip-ansi "6.0.1"
|
|
2109
2109
|
ts-retry-promise "^0.8.1"
|
|
2110
2110
|
|
|
2111
|
-
"@salesforce/core@^8.10.0", "@salesforce/core@^8.11.4", "@salesforce/core@^8.8.0"
|
|
2111
|
+
"@salesforce/core@^8.10.0", "@salesforce/core@^8.11.4", "@salesforce/core@^8.8.0":
|
|
2112
2112
|
version "8.11.4"
|
|
2113
2113
|
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.11.4.tgz#e4f049351540a46e12bb5c1b6574232fd4d1288b"
|
|
2114
2114
|
integrity sha512-6jrACrCmpic7mrnp4XQ6tiyx5FvHs101dQ2v+m8+aHF97036bul+GeeYuSjVp3ASh0sjR5CotYf7R65chd4H+A==
|
|
@@ -2186,16 +2186,16 @@
|
|
|
2186
2186
|
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.9.0.tgz#ba477a112653a20b4edcf989c61c57bdff9aa3ca"
|
|
2187
2187
|
integrity sha512-LiN37zG5ODT6z70sL1fxF7BQwtCX9JOWofSU8iliSNIM+WDEeinnoFtVqPInRSNt8I0RiJxIKCrqstsmQRBNvA==
|
|
2188
2188
|
|
|
2189
|
-
"@salesforce/sf-plugins-core@^12.2.
|
|
2190
|
-
version "12.2.
|
|
2191
|
-
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-12.2.
|
|
2192
|
-
integrity sha512-
|
|
2189
|
+
"@salesforce/sf-plugins-core@^12.2.2":
|
|
2190
|
+
version "12.2.2"
|
|
2191
|
+
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-12.2.2.tgz#41e704e47ba997dcb6922ab9563aa19407079c85"
|
|
2192
|
+
integrity sha512-LuNT1kzi0N185xhCBCOU9P650CwoehiICB2lCP1RsO98NqfHTRpD6Rq1TDQtLTudOh3pDUFZTgo8kt4qwz20yw==
|
|
2193
2193
|
dependencies:
|
|
2194
2194
|
"@inquirer/confirm" "^3.1.22"
|
|
2195
2195
|
"@inquirer/password" "^2.2.0"
|
|
2196
|
-
"@oclif/core" "^4.
|
|
2196
|
+
"@oclif/core" "^4.3.0"
|
|
2197
2197
|
"@oclif/table" "^0.4.6"
|
|
2198
|
-
"@salesforce/core" "^8.
|
|
2198
|
+
"@salesforce/core" "^8.10.0"
|
|
2199
2199
|
"@salesforce/kit" "^3.2.3"
|
|
2200
2200
|
"@salesforce/ts-types" "^2.0.12"
|
|
2201
2201
|
ansis "^3.3.2"
|
|
@@ -9257,7 +9257,16 @@ string-length@^4.0.1:
|
|
|
9257
9257
|
char-regex "^1.0.2"
|
|
9258
9258
|
strip-ansi "^6.0.0"
|
|
9259
9259
|
|
|
9260
|
-
"string-width-cjs@npm:string-width@^4.2.0"
|
|
9260
|
+
"string-width-cjs@npm:string-width@^4.2.0":
|
|
9261
|
+
version "4.2.3"
|
|
9262
|
+
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
|
9263
|
+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
|
9264
|
+
dependencies:
|
|
9265
|
+
emoji-regex "^8.0.0"
|
|
9266
|
+
is-fullwidth-code-point "^3.0.0"
|
|
9267
|
+
strip-ansi "^6.0.1"
|
|
9268
|
+
|
|
9269
|
+
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
|
|
9261
9270
|
version "4.2.3"
|
|
9262
9271
|
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
|
9263
9272
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
|
@@ -9365,7 +9374,14 @@ stringify-entities@^4.0.0:
|
|
|
9365
9374
|
character-entities-html4 "^2.0.0"
|
|
9366
9375
|
character-entities-legacy "^3.0.0"
|
|
9367
9376
|
|
|
9368
|
-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1"
|
|
9377
|
+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
|
9378
|
+
version "6.0.1"
|
|
9379
|
+
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
|
9380
|
+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
|
9381
|
+
dependencies:
|
|
9382
|
+
ansi-regex "^5.0.1"
|
|
9383
|
+
|
|
9384
|
+
strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
|
9369
9385
|
version "6.0.1"
|
|
9370
9386
|
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
|
9371
9387
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
|
@@ -10183,7 +10199,7 @@ workerpool@^6.5.1:
|
|
|
10183
10199
|
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"
|
|
10184
10200
|
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
|
|
10185
10201
|
|
|
10186
|
-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0"
|
|
10202
|
+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
|
|
10187
10203
|
version "7.0.0"
|
|
10188
10204
|
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
|
|
10189
10205
|
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
|
@@ -10201,6 +10217,15 @@ wrap-ansi@^6.2.0:
|
|
|
10201
10217
|
string-width "^4.1.0"
|
|
10202
10218
|
strip-ansi "^6.0.0"
|
|
10203
10219
|
|
|
10220
|
+
wrap-ansi@^7.0.0:
|
|
10221
|
+
version "7.0.0"
|
|
10222
|
+
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
|
|
10223
|
+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
|
10224
|
+
dependencies:
|
|
10225
|
+
ansi-styles "^4.0.0"
|
|
10226
|
+
string-width "^4.1.0"
|
|
10227
|
+
strip-ansi "^6.0.0"
|
|
10228
|
+
|
|
10204
10229
|
wrap-ansi@^8.1.0:
|
|
10205
10230
|
version "8.1.0"
|
|
10206
10231
|
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
|
package/oclif.manifest.json
CHANGED
|
@@ -49,11 +49,10 @@
|
|
|
49
49
|
"format": {
|
|
50
50
|
"char": "f",
|
|
51
51
|
"name": "format",
|
|
52
|
-
"required":
|
|
52
|
+
"required": false,
|
|
53
53
|
"summary": "Output format for the coverage report.",
|
|
54
|
-
"default": "sonar",
|
|
55
54
|
"hasDynamicHelp": false,
|
|
56
|
-
"multiple":
|
|
55
|
+
"multiple": true,
|
|
57
56
|
"options": [
|
|
58
57
|
"sonar",
|
|
59
58
|
"cobertura",
|
|
@@ -97,5 +96,5 @@
|
|
|
97
96
|
]
|
|
98
97
|
}
|
|
99
98
|
},
|
|
100
|
-
"version": "2.
|
|
99
|
+
"version": "2.13.0"
|
|
101
100
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apex-code-coverage-transformer",
|
|
3
|
-
"description": "Transform Salesforce Apex code coverage JSONs
|
|
4
|
-
"version": "2.
|
|
3
|
+
"description": "Transform Salesforce Apex code coverage JSONs into other formats accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.",
|
|
4
|
+
"version": "2.13.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4.3.0",
|
|
7
7
|
"@salesforce/core": "^8.11.4",
|
|
8
|
-
"@salesforce/sf-plugins-core": "^12.2.
|
|
8
|
+
"@salesforce/sf-plugins-core": "^12.2.2",
|
|
9
9
|
"async": "^3.2.6",
|
|
10
10
|
"xmlbuilder2": "^3.1.1"
|
|
11
11
|
},
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"bitbucket",
|
|
68
68
|
"jacoco",
|
|
69
69
|
"lcov",
|
|
70
|
-
"json2xml"
|
|
70
|
+
"json2xml",
|
|
71
|
+
"istanbul"
|
|
71
72
|
],
|
|
72
73
|
"license": "MIT",
|
|
73
74
|
"oclif": {
|