apex-code-coverage-transformer 2.12.1 → 2.13.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 +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 +73 -38
- package/lib/transformers/coverageTransformer.js.map +1 -1
- package/lib/transformers/reportGenerator.d.ts +1 -1
- package/lib/transformers/reportGenerator.js +4 -3
- package/lib/transformers/reportGenerator.js.map +1 -1
- package/lib/utils/types.d.ts +9 -1
- package/oclif.manifest.json +3 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## [2.13.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.13.0...v2.13.1) (2025-06-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* set format amount in main function ([#195](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/195)) ([b63c2a2](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/b63c2a2c6fada03986b34cf62145b126147c3f99))
|
|
14
|
+
|
|
15
|
+
## [2.13.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.12.1...v2.13.0) (2025-06-24)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* 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))
|
|
21
|
+
|
|
8
22
|
## [2.12.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.12.0...v2.12.1) (2025-06-22)
|
|
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,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAA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AAO,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,GAAG,MAAM,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OA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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,31 @@ 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 = [];
|
|
14
|
+
const formatAmount = formats.length;
|
|
12
15
|
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
|
-
}
|
|
16
|
+
const jsonData = await tryReadJson(jsonFilePath, warnings);
|
|
17
|
+
if (!jsonData)
|
|
18
|
+
return { finalPaths: [outputReportPath], warnings };
|
|
21
19
|
const parsedData = JSON.parse(jsonData);
|
|
22
20
|
const { repoRoot, packageDirectories } = await getPackageDirectories(ignoreDirs);
|
|
23
|
-
const
|
|
21
|
+
const handlers = createHandlers(formats);
|
|
24
22
|
const commandType = checkCoverageDataType(parsedData);
|
|
25
23
|
const concurrencyLimit = getConcurrencyThreshold();
|
|
24
|
+
const context = {
|
|
25
|
+
handlers,
|
|
26
|
+
packageDirs: packageDirectories,
|
|
27
|
+
repoRoot,
|
|
28
|
+
concurrencyLimit,
|
|
29
|
+
warnings,
|
|
30
|
+
};
|
|
26
31
|
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
|
-
});
|
|
32
|
+
filesProcessed = await processDeployCoverage(parsedData, context);
|
|
40
33
|
}
|
|
41
34
|
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
|
-
});
|
|
35
|
+
filesProcessed = await processTestCoverage(parsedData, context);
|
|
54
36
|
}
|
|
55
37
|
else {
|
|
56
38
|
throw new Error('The provided JSON does not match a known coverage data format from the Salesforce deploy or test command.');
|
|
@@ -58,8 +40,61 @@ export async function transformCoverageReport(jsonFilePath, outputReportPath, fo
|
|
|
58
40
|
if (filesProcessed === 0) {
|
|
59
41
|
warnings.push('None of the files listed in the coverage JSON were processed. The coverage report will be empty.');
|
|
60
42
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
43
|
+
for (const [format, handler] of handlers.entries()) {
|
|
44
|
+
const coverageObj = handler.finalize();
|
|
45
|
+
const finalPath = await generateAndWriteReport(outputReportPath, coverageObj, format, formatAmount);
|
|
46
|
+
finalPaths.push(finalPath);
|
|
47
|
+
}
|
|
48
|
+
return { finalPaths, warnings };
|
|
49
|
+
}
|
|
50
|
+
async function tryReadJson(path, warnings) {
|
|
51
|
+
try {
|
|
52
|
+
return await readFile(path, 'utf-8');
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
warnings.push(`Failed to read ${path}. Confirm file exists.`);
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function createHandlers(formats) {
|
|
60
|
+
const handlers = new Map();
|
|
61
|
+
for (const format of formats) {
|
|
62
|
+
handlers.set(format, getCoverageHandler(format));
|
|
63
|
+
}
|
|
64
|
+
return handlers;
|
|
65
|
+
}
|
|
66
|
+
async function processDeployCoverage(data, context) {
|
|
67
|
+
let processed = 0;
|
|
68
|
+
await mapLimit(Object.keys(data), context.concurrencyLimit, async (fileName) => {
|
|
69
|
+
const fileInfo = data[fileName];
|
|
70
|
+
const formattedName = fileName.replace(/no-map[\\/]+/, '');
|
|
71
|
+
const path = await findFilePath(formattedName, context.packageDirs, context.repoRoot);
|
|
72
|
+
if (!path) {
|
|
73
|
+
context.warnings.push(`The file name ${formattedName} was not found in any package directory.`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
fileInfo.s = await setCoveredLines(path, context.repoRoot, fileInfo.s);
|
|
77
|
+
for (const handler of context.handlers.values()) {
|
|
78
|
+
handler.processFile(path, formattedName, fileInfo.s);
|
|
79
|
+
}
|
|
80
|
+
processed++;
|
|
81
|
+
});
|
|
82
|
+
return processed;
|
|
83
|
+
}
|
|
84
|
+
async function processTestCoverage(data, context) {
|
|
85
|
+
let processed = 0;
|
|
86
|
+
await mapLimit(data, context.concurrencyLimit, async (entry) => {
|
|
87
|
+
const formattedName = entry.name.replace(/no-map[\\/]+/, '');
|
|
88
|
+
const path = await findFilePath(formattedName, context.packageDirs, context.repoRoot);
|
|
89
|
+
if (!path) {
|
|
90
|
+
context.warnings.push(`The file name ${formattedName} was not found in any package directory.`);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
for (const handler of context.handlers.values()) {
|
|
94
|
+
handler.processFile(path, formattedName, entry.lines);
|
|
95
|
+
}
|
|
96
|
+
processed++;
|
|
97
|
+
});
|
|
98
|
+
return processed;
|
|
64
99
|
}
|
|
65
100
|
//# 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,EAAE,MAAM,iCAAiC,C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iBAAiB,aAAa,0CAA0C,CAAC,CAAC;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, formatAmount: number): Promise<string>;
|
|
3
3
|
export declare function getExtensionForFormat(format: string): string;
|
|
@@ -1,12 +1,13 @@
|
|
|
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, formatAmount) {
|
|
5
5
|
const content = generateReportContent(coverageObj, format);
|
|
6
6
|
const extension = getExtensionForFormat(format);
|
|
7
|
-
const base = basename(outputPath, extname(outputPath)); //
|
|
7
|
+
const base = basename(outputPath, extname(outputPath)); // e.g., 'coverage'
|
|
8
8
|
const dir = dirname(outputPath);
|
|
9
|
-
const
|
|
9
|
+
const suffix = formatAmount > 1 ? `-${format}` : '';
|
|
10
|
+
const filePath = join(dir, `${base}${suffix}${extension}`);
|
|
10
11
|
await writeFile(filePath, content, 'utf-8');
|
|
11
12
|
return filePath;
|
|
12
13
|
}
|
|
@@ -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,YAAoB;IAEpB,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,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,E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AAE;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.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.1"
|
|
101
100
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apex-code-coverage-transformer",
|
|
3
3
|
"description": "Transform Salesforce Apex code coverage JSONs into other formats accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4.3.0",
|
|
7
7
|
"@salesforce/core": "^8.11.4",
|