apex-code-coverage-transformer 3.0.2 → 3.1.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 +92 -20
- package/lib/commands/acc-transformer/transform.js +3 -0
- package/lib/commands/acc-transformer/transform.js.map +1 -1
- package/lib/transformers/coverageTransformer.d.ts +1 -0
- package/lib/transformers/coverageTransformer.js +3 -5
- package/lib/transformers/coverageTransformer.js.map +1 -1
- package/lib/transformers/reportGenerator.js +2 -2
- package/lib/transformers/reportGenerator.js.map +1 -1
- package/lib/utils/constants.d.ts +1 -11
- package/lib/utils/constants.js +1 -11
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/xmlBuilder.d.ts +22 -0
- package/lib/utils/xmlBuilder.js +68 -0
- package/lib/utils/xmlBuilder.js.map +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +79 -9
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
|
+
## [3.1.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.0.3...v3.1.0) (2026-08-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **action:** add native GitHub Action wrapper ([#376](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/376)) ([83810f9](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/83810f92f29b5592c83ea3feaa63bf7c07f218dc))
|
|
14
|
+
|
|
15
|
+
## [3.0.3](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.0.2...v3.0.3) (2026-08-19)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **deps:** replace fast-xml-builder with in-house XML builder ([#373](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/373)) ([b537784](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/b537784cc1568a8c32bd8a4e06c954ee86e2f63f))
|
|
21
|
+
|
|
8
22
|
## [3.0.2](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.0.1...v3.0.2) (2026-08-17)
|
|
9
23
|
|
|
10
24
|
|
package/README.md
CHANGED
|
@@ -110,35 +110,75 @@ Works with [sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis):
|
|
|
110
110
|
|
|
111
111
|
## Command Reference
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
<!-- commands -->
|
|
114
|
+
* [`sf acc-transformer transform`](#sf-acc-transformer-transform)
|
|
115
|
+
|
|
116
|
+
## `sf acc-transformer transform`
|
|
117
|
+
|
|
118
|
+
Transform Salesforce Apex code coverage JSONs created during deployments and test runs into other formats accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.
|
|
114
119
|
|
|
115
120
|
```
|
|
116
121
|
USAGE
|
|
117
|
-
$ sf acc-transformer transform -j <value>...
|
|
118
|
-
|
|
122
|
+
$ sf acc-transformer transform -j <value>... -r <value> [--json] [--flags-dir <value>] [-f
|
|
123
|
+
clover|cobertura|github-actions|html|jacoco|json|json-summary|lcovonly|markdown|opencover|simplecov|sonar...] [-i
|
|
124
|
+
<value>...] [--min-coverage <value>] [--max-annotations <value>] [-e <value>...]
|
|
119
125
|
|
|
120
126
|
FLAGS
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
-e, --exclude-pattern=<value>... Glob pattern for file paths to exclude from the coverage report. Matched
|
|
128
|
+
against the relative path from the repo root (e.g.
|
|
129
|
+
force-app/main/default/classes/MyClass.cls). Repeat the flag for multiple
|
|
130
|
+
patterns.
|
|
131
|
+
-f, --format=<option>... Output format for the coverage report.
|
|
132
|
+
<options: clover|cobertura|github-actions|html|jacoco|json|json-summary|lco
|
|
133
|
+
vonly|markdown|opencover|simplecov|sonar>
|
|
134
|
+
-i, --ignore-package-directory=<value>... Ignore a package directory when looking for matching files in the coverage
|
|
135
|
+
report.
|
|
136
|
+
-j, --coverage-json=<value>... (required) Path to a code coverage JSON file created by the Salesforce CLI
|
|
137
|
+
deploy or test command. Repeat the flag to merge multiple files. When the
|
|
138
|
+
same Apex file appears in multiple inputs, covered lines are unioned across
|
|
139
|
+
all inputs — if a line is covered in any input it is counted as covered in
|
|
140
|
+
the final report, even if it is uncovered in others.
|
|
141
|
+
-r, --output-report=<value> (required) [default: coverage.xml] Path to the code coverage file that will
|
|
142
|
+
be created by this plugin.
|
|
143
|
+
--max-annotations=<value> [default: 50] Maximum number of GitHub Actions ::warning annotations to
|
|
144
|
+
emit when using --format github-actions. Defaults to 50. Annotations beyond
|
|
145
|
+
this limit are summarised in a ::notice line.
|
|
146
|
+
--min-coverage=<value> Minimum required line coverage percentage (0–100). The command exits with
|
|
147
|
+
an error if overall coverage is below this threshold. Reports are still
|
|
148
|
+
written before the check.
|
|
137
149
|
|
|
138
150
|
GLOBAL FLAGS
|
|
139
|
-
--
|
|
151
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
152
|
+
--json Format output as json.
|
|
153
|
+
|
|
154
|
+
DESCRIPTION
|
|
155
|
+
Transform Salesforce Apex code coverage JSONs created during deployments and test runs into other formats accepted by
|
|
156
|
+
SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.
|
|
157
|
+
|
|
158
|
+
Transform Salesforce Apex code coverage JSONs created during deployments and test runs into other formats accepted by
|
|
159
|
+
SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.
|
|
160
|
+
|
|
161
|
+
EXAMPLES
|
|
162
|
+
`sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "sonar"`
|
|
163
|
+
|
|
164
|
+
`sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "cobertura"`
|
|
165
|
+
|
|
166
|
+
`sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "clover"`
|
|
167
|
+
|
|
168
|
+
`sf acc-transformer transform -j "coverage.json" -r "coverage.info" -f "lcovonly"`
|
|
169
|
+
|
|
170
|
+
`sf acc-transformer transform -j "coverage.json" -r "coverage.md" -f "markdown"`
|
|
171
|
+
|
|
172
|
+
`sf acc-transformer transform -j "coverage.json" -r "coverage.txt" -f "github-actions"`
|
|
173
|
+
|
|
174
|
+
`sf acc-transformer transform -j "coverage.json" -i "force-app"`
|
|
175
|
+
|
|
176
|
+
`sf acc-transformer transform -j "coverage1.json" -j "coverage2.json" -r "coverage.xml" -f "sonar"`
|
|
140
177
|
```
|
|
141
178
|
|
|
179
|
+
_See code: [src/commands/acc-transformer/transform.ts](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/v3.1.0/src/commands/acc-transformer/transform.ts)_
|
|
180
|
+
<!-- commandsstop -->
|
|
181
|
+
|
|
142
182
|
## Coverage Report Formats
|
|
143
183
|
|
|
144
184
|
Use `-f` / `--format` to choose the output format. Multiple `-f` values produce multiple files with the format in the name (e.g. `coverage-sonar.xml`, `coverage-cobertura.xml`).
|
|
@@ -240,6 +280,38 @@ sonar-scanner \
|
|
|
240
280
|
|
|
241
281
|
### GitHub Actions
|
|
242
282
|
|
|
283
|
+
#### Native Action (skip the sf CLI install)
|
|
284
|
+
|
|
285
|
+
For GitHub Actions specifically, the transform step can run as a native Action instead of `sf acc-transformer transform` - no need to install `@salesforce/cli` or this plugin just to convert a coverage file:
|
|
286
|
+
|
|
287
|
+
```yaml
|
|
288
|
+
- name: Transform Coverage
|
|
289
|
+
uses: mcarvin8/apex-code-coverage-transformer@v3
|
|
290
|
+
with:
|
|
291
|
+
coverage-json: coverage/test-result-codecoverage.json
|
|
292
|
+
output-report: coverage.xml
|
|
293
|
+
format: sonar
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Repeatable inputs (`coverage-json`, `format`, `ignore-package-directory`, `exclude-pattern`) accept one value per line. The action exposes `report-paths`, `coverage-percentage`, and `warnings` as step outputs:
|
|
297
|
+
|
|
298
|
+
```yaml
|
|
299
|
+
- name: Transform Coverage
|
|
300
|
+
id: transform
|
|
301
|
+
uses: mcarvin8/apex-code-coverage-transformer@v3
|
|
302
|
+
with:
|
|
303
|
+
coverage-json: coverage/test-result-codecoverage.json
|
|
304
|
+
format: |
|
|
305
|
+
sonar
|
|
306
|
+
markdown
|
|
307
|
+
min-coverage: 80
|
|
308
|
+
|
|
309
|
+
- name: Use the coverage percentage
|
|
310
|
+
run: echo "Coverage was ${{ steps.transform.outputs.coverage-percentage }}%"
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
`sf acc-transformer transform` remains available for every other CI provider (GitLab, Azure DevOps, Bitbucket) and for local/hook use - see [Automatic Transformation (Hook)](#automatic-transformation-hook) below.
|
|
314
|
+
|
|
243
315
|
#### Markdown PR comments (built-in)
|
|
244
316
|
|
|
245
317
|
Skip third-party summary actions by using the built-in `markdown` format:
|
|
@@ -71,6 +71,9 @@ export default class TransformerTransform extends SfCommand {
|
|
|
71
71
|
this.warn(warning);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
if (!result.success) {
|
|
75
|
+
this.error(`Coverage of ${(result.lineRate * 100).toFixed(2)}% is below the required minimum of ${flags['min-coverage']}%.`);
|
|
76
|
+
}
|
|
74
77
|
return { path: result.finalPaths };
|
|
75
78
|
}
|
|
76
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/commands/acc-transformer/transform.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAA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IAAI,CACjH,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -15,7 +15,7 @@ export async function transformCoverageReport(jsonFilePaths, outputReportPath, f
|
|
|
15
15
|
const jsonDataItems = await Promise.all(jsonFilePaths.map((p) => tryReadJson(p, warnings)));
|
|
16
16
|
const validData = jsonDataItems.filter((d) => d !== null);
|
|
17
17
|
if (validData.length === 0)
|
|
18
|
-
return { finalPaths: [outputReportPath], warnings, lineRate: 0 };
|
|
18
|
+
return { finalPaths: [outputReportPath], warnings, lineRate: 0, success: true };
|
|
19
19
|
const parsedItems = validData.map((d) => JSON.parse(d));
|
|
20
20
|
const types = parsedItems.map(checkCoverageDataType);
|
|
21
21
|
if (types.some((t) => t === 'Unknown')) {
|
|
@@ -54,9 +54,7 @@ export async function transformCoverageReport(jsonFilePaths, outputReportPath, f
|
|
|
54
54
|
const finalPath = await generateAndWriteReport(outputReportPath, coverageObj, format, formatAmount, renderOptions);
|
|
55
55
|
finalPaths.push(finalPath);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
return { finalPaths, warnings, lineRate };
|
|
57
|
+
const success = options?.minCoverage === undefined || lineRate * 100 >= options.minCoverage;
|
|
58
|
+
return { finalPaths, warnings, lineRate, success };
|
|
61
59
|
}
|
|
62
60
|
//# sourceMappingURL=coverageTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverageTransformer.js","sourceRoot":"","sources":["../../src/transformers/coverageTransformer.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,YAAY,CAAC;AAEb,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,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,CAAC;IACpH,CAAC;IAED,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1G,MAAM,aAAa,GAAG,OAAO,EAAE,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAErH,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG,MAAM,sBAAsB,CAAC,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;QACnH,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI,QAAQ,GAAG,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;IAE5F,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { basename, dirname, extname, join } from 'node:path';
|
|
3
|
-
import XMLBuilder from 'fast-xml-builder';
|
|
4
3
|
import { HandlerRegistry } from '../handlers/HandlerRegistry.js';
|
|
5
4
|
import { builderOptions, XML_HEADER_CONFIG } from '../utils/constants.js';
|
|
5
|
+
import { XmlBuilder } from '../utils/xmlBuilder.js';
|
|
6
6
|
import { generateGitHubActions } from './generators/generateGitHubActions.js';
|
|
7
7
|
import { generateHtml } from './generators/generateHtml.js';
|
|
8
8
|
import { generateMarkdown } from './generators/generateMarkdown.js';
|
|
@@ -43,7 +43,7 @@ function generateReportContent(coverageObj, format, options) {
|
|
|
43
43
|
}
|
|
44
44
|
function generateXmlContent(coverageObj, format) {
|
|
45
45
|
const isHeadless = isXmlReportFormat(format);
|
|
46
|
-
const builder = new
|
|
46
|
+
const builder = new XmlBuilder(builderOptions);
|
|
47
47
|
let xml = builder.build(coverageObj);
|
|
48
48
|
if (isHeadless) {
|
|
49
49
|
xml = xml.replace(/^<\?xml[^>]*>\s*/i, '');
|
|
@@ -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,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,
|
|
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,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAS1E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAMpE,SAAS,iBAAiB,CAAC,MAAc;IACvC,OAAO,MAAM,IAAI,iBAAiB,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,uBA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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,0DAA0D;IAC1D,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjF,OAAO,CAAC,MAAM,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5G,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC"}
|
package/lib/utils/constants.d.ts
CHANGED
|
@@ -6,18 +6,8 @@ import { XmlHeaderConfig, XmlReportFormat } from './types.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const formatOptions: string[];
|
|
8
8
|
export declare const builderOptions: {
|
|
9
|
-
|
|
10
|
-
ignoreAttributes: boolean;
|
|
11
|
-
ignoreNameSpace: boolean;
|
|
12
|
-
parseTagValue: boolean;
|
|
13
|
-
parseNodeValue: boolean;
|
|
14
|
-
parseAttributeValue: boolean;
|
|
15
|
-
trimValues: boolean;
|
|
16
|
-
processEntities: boolean;
|
|
9
|
+
attributeNamePrefix: string;
|
|
17
10
|
format: boolean;
|
|
18
11
|
indentBy: string;
|
|
19
|
-
suppressBooleanAttributes: boolean;
|
|
20
|
-
suppressEmptyNode: boolean;
|
|
21
|
-
attributeNamePrefix: string;
|
|
22
12
|
};
|
|
23
13
|
export declare const XML_HEADER_CONFIG: Record<XmlReportFormat, XmlHeaderConfig>;
|
package/lib/utils/constants.js
CHANGED
|
@@ -7,19 +7,9 @@ import '../handlers/getHandler.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export const formatOptions = HandlerRegistry.getAvailableFormats();
|
|
9
9
|
export const builderOptions = {
|
|
10
|
-
|
|
11
|
-
ignoreAttributes: false,
|
|
12
|
-
ignoreNameSpace: false,
|
|
13
|
-
parseTagValue: false,
|
|
14
|
-
parseNodeValue: false,
|
|
15
|
-
parseAttributeValue: false,
|
|
16
|
-
trimValues: true,
|
|
17
|
-
processEntities: false,
|
|
10
|
+
attributeNamePrefix: '@',
|
|
18
11
|
format: true,
|
|
19
12
|
indentBy: ' ',
|
|
20
|
-
suppressBooleanAttributes: false,
|
|
21
|
-
suppressEmptyNode: true,
|
|
22
|
-
attributeNamePrefix: '@',
|
|
23
13
|
};
|
|
24
14
|
export const XML_HEADER_CONFIG = {
|
|
25
15
|
cobertura: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,mDAAmD;AACnD,OAAO,2BAA2B,CAAC;AAGnC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAa,eAAe,CAAC,mBAAmB,EAAE,CAAC;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,mDAAmD;AACnD,OAAO,2BAA2B,CAAC;AAGnC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAa,eAAe,CAAC,mBAAmB,EAAE,CAAC;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB,EAAE,GAAG;IACxB,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAA6C;IACzE,SAAS,EAAE;QACT,OAAO,EAAE,wBAAwB;QACjC,OAAO,EAAE,mFAAmF;KAC7F;IACD,MAAM,EAAE;QACN,OAAO,EAAE,wCAAwC;KAClD;IACD,MAAM,EAAE;QACN,OAAO,EAAE,yDAAyD;QAClE,OAAO,EAAE,uEAAuE;KACjF;IACD,SAAS,EAAE;QACT,OAAO,EAAE,wCAAwC;KAClD;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type XmlBuilderOptions = {
|
|
2
|
+
attributeNamePrefix?: string;
|
|
3
|
+
format?: boolean;
|
|
4
|
+
indentBy?: string;
|
|
5
|
+
};
|
|
6
|
+
type XmlNode = Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Minimal XML serializer for this plugin's coverage-object shapes: nested plain
|
|
9
|
+
* objects become elements, `@`-prefixed keys become attributes, arrays repeat
|
|
10
|
+
* the tag, and childless elements self-close. Replaces fast-xml-builder, which
|
|
11
|
+
* this codebase only ever used with a fixed, narrow slice of its options.
|
|
12
|
+
*/
|
|
13
|
+
export declare class XmlBuilder {
|
|
14
|
+
private readonly options;
|
|
15
|
+
constructor(options?: XmlBuilderOptions);
|
|
16
|
+
build(obj: XmlNode): string;
|
|
17
|
+
private buildChildren;
|
|
18
|
+
private buildElement;
|
|
19
|
+
private splitAttributesAndChildren;
|
|
20
|
+
private buildAttribute;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const DEFAULT_OPTIONS = {
|
|
3
|
+
attributeNamePrefix: '@',
|
|
4
|
+
format: true,
|
|
5
|
+
indentBy: ' ',
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Minimal XML serializer for this plugin's coverage-object shapes: nested plain
|
|
9
|
+
* objects become elements, `@`-prefixed keys become attributes, arrays repeat
|
|
10
|
+
* the tag, and childless elements self-close. Replaces fast-xml-builder, which
|
|
11
|
+
* this codebase only ever used with a fixed, narrow slice of its options.
|
|
12
|
+
*/
|
|
13
|
+
export class XmlBuilder {
|
|
14
|
+
options;
|
|
15
|
+
constructor(options = {}) {
|
|
16
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
17
|
+
}
|
|
18
|
+
build(obj) {
|
|
19
|
+
return this.buildChildren(obj, 0);
|
|
20
|
+
}
|
|
21
|
+
buildChildren(obj, level) {
|
|
22
|
+
let out = '';
|
|
23
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
24
|
+
if (value === undefined)
|
|
25
|
+
continue;
|
|
26
|
+
out += Array.isArray(value)
|
|
27
|
+
? value.map((item) => this.buildElement(key, item, level)).join('')
|
|
28
|
+
: this.buildElement(key, value, level);
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
buildElement(key, value, level) {
|
|
33
|
+
const indent = this.options.format ? this.options.indentBy.repeat(level) : '';
|
|
34
|
+
const newline = this.options.format ? '\n' : '';
|
|
35
|
+
if (value !== null && typeof value === 'object') {
|
|
36
|
+
const { attrStr, children } = this.splitAttributesAndChildren(value);
|
|
37
|
+
if (!children) {
|
|
38
|
+
return `${indent}<${key}${attrStr}/>${newline}`;
|
|
39
|
+
}
|
|
40
|
+
const inner = this.buildChildren(children, level + 1);
|
|
41
|
+
return `${indent}<${key}${attrStr}>${newline}${inner}${indent}</${key}>${newline}`;
|
|
42
|
+
}
|
|
43
|
+
const text = String(value);
|
|
44
|
+
return text === '' ? `${indent}<${key}/>${newline}` : `${indent}<${key}>${text}</${key}>${newline}`;
|
|
45
|
+
}
|
|
46
|
+
splitAttributesAndChildren(obj) {
|
|
47
|
+
const prefix = this.options.attributeNamePrefix;
|
|
48
|
+
let attrStr = '';
|
|
49
|
+
let children;
|
|
50
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
51
|
+
if (value === undefined)
|
|
52
|
+
continue;
|
|
53
|
+
if (key.startsWith(prefix)) {
|
|
54
|
+
attrStr += this.buildAttribute(key.slice(prefix.length), value);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
children ??= {};
|
|
58
|
+
children[key] = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { attrStr, children };
|
|
62
|
+
}
|
|
63
|
+
buildAttribute(name, value) {
|
|
64
|
+
const escaped = String(value).replace(/"/g, '"').replace(/'/g, ''');
|
|
65
|
+
return ` ${name}="${escaped}"`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=xmlBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xmlBuilder.js","sourceRoot":"","sources":["../../src/utils/xmlBuilder.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAUb,MAAM,eAAe,GAAgC;IACnD,mBAAmB,EAAE,GAAG;IACxB,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACJ,OAAO,CAA8B;IAEtD,YAAY,OAAO,GAAsB,EAAE;QACzC,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,GAAY;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAEO,aAAa,CAAC,GAAY,EAAE,KAAa;QAC/C,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO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
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apex-code-coverage-transformer",
|
|
3
3
|
"description": "Transform Salesforce Apex code coverage JSON for SonarQube, SonarCloud, GitHub, GitLab, Azure, and Bitbucket",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "4.13.3",
|
|
7
7
|
"@salesforce/core": "9.1.2",
|
|
8
|
-
"@salesforce/sf-plugins-core": "13.0.0"
|
|
9
|
-
"fast-xml-builder": "1.3.0"
|
|
8
|
+
"@salesforce/sf-plugins-core": "13.0.0"
|
|
10
9
|
},
|
|
11
10
|
"devDependencies": {
|
|
12
|
-
"@
|
|
11
|
+
"@actions/core": "3.0.1",
|
|
12
|
+
"@biomejs/biome": "2.5.9",
|
|
13
13
|
"@commitlint/cli": "21.2.2",
|
|
14
14
|
"@commitlint/config-conventional": "21.2.2",
|
|
15
15
|
"@salesforce/cli-plugins-testkit": "5.3.66",
|
|
16
16
|
"@salesforce/dev-config": "4.3.3",
|
|
17
|
-
"@stryker-mutator/core": "
|
|
18
|
-
"@stryker-mutator/vitest-runner": "
|
|
17
|
+
"@stryker-mutator/core": "10.0.0",
|
|
18
|
+
"@stryker-mutator/vitest-runner": "10.0.0",
|
|
19
19
|
"@types/node": "26.2.0",
|
|
20
20
|
"@vitest/coverage-v8": "4.1.10",
|
|
21
|
+
"esbuild": "0.28.1",
|
|
21
22
|
"husky": "9.1.7",
|
|
22
23
|
"knip": "6.32.2",
|
|
23
24
|
"lint-staged": "17.3.0",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
},
|
|
35
36
|
"files": [
|
|
36
37
|
"/lib",
|
|
38
|
+
"!/lib/action",
|
|
37
39
|
"/messages",
|
|
38
40
|
"/oclif.manifest.json",
|
|
39
41
|
"/oclif.lock",
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
},
|
|
86
88
|
"scripts": {
|
|
87
89
|
"build": "wireit",
|
|
90
|
+
"build:action": "wireit",
|
|
88
91
|
"clean": "wireit",
|
|
89
92
|
"clean:build": "wireit",
|
|
90
93
|
"clean:package-manager": "wireit",
|
|
@@ -96,9 +99,10 @@
|
|
|
96
99
|
"postpack": "shx rm -f oclif.manifest.json oclif.lock",
|
|
97
100
|
"prepack": "wireit",
|
|
98
101
|
"prepare": "husky",
|
|
102
|
+
"readme": "wireit",
|
|
99
103
|
"test": "wireit",
|
|
100
|
-
"test:mutation": "
|
|
101
|
-
"test:mutation:incremental": "
|
|
104
|
+
"test:mutation": "wireit",
|
|
105
|
+
"test:mutation:incremental": "wireit",
|
|
102
106
|
"test:nuts": "wireit",
|
|
103
107
|
"test:only": "wireit"
|
|
104
108
|
},
|
|
@@ -139,9 +143,24 @@
|
|
|
139
143
|
"build": {
|
|
140
144
|
"dependencies": [
|
|
141
145
|
"compile",
|
|
142
|
-
"lint"
|
|
146
|
+
"lint",
|
|
147
|
+
"build:action"
|
|
143
148
|
]
|
|
144
149
|
},
|
|
150
|
+
"build:action": {
|
|
151
|
+
"command": "esbuild src/action/index.ts --bundle --minify --platform=node --format=cjs --target=node22 --outfile=dist/action/index.cjs",
|
|
152
|
+
"files": [
|
|
153
|
+
"src/action/**/*.ts",
|
|
154
|
+
"src/transformers/**/*.ts",
|
|
155
|
+
"src/utils/**/*.ts",
|
|
156
|
+
"src/handlers/**/*.ts",
|
|
157
|
+
"tsconfig.json"
|
|
158
|
+
],
|
|
159
|
+
"output": [
|
|
160
|
+
"dist/action/**"
|
|
161
|
+
],
|
|
162
|
+
"clean": false
|
|
163
|
+
},
|
|
145
164
|
"compile": {
|
|
146
165
|
"command": "tsc -p . --pretty --incremental",
|
|
147
166
|
"files": [
|
|
@@ -211,6 +230,21 @@
|
|
|
211
230
|
],
|
|
212
231
|
"clean": false
|
|
213
232
|
},
|
|
233
|
+
"readme": {
|
|
234
|
+
"command": "oclif readme",
|
|
235
|
+
"files": [
|
|
236
|
+
"src/commands/acc-transformer/transform.ts",
|
|
237
|
+
"messages/transformer.transform.md",
|
|
238
|
+
"README.md"
|
|
239
|
+
],
|
|
240
|
+
"dependencies": [
|
|
241
|
+
"build"
|
|
242
|
+
],
|
|
243
|
+
"output": [
|
|
244
|
+
"README.md"
|
|
245
|
+
],
|
|
246
|
+
"clean": false
|
|
247
|
+
},
|
|
214
248
|
"test:compile": {
|
|
215
249
|
"command": "tsc -p \"./test\" --pretty",
|
|
216
250
|
"files": [
|
|
@@ -226,6 +260,39 @@
|
|
|
226
260
|
"lint"
|
|
227
261
|
]
|
|
228
262
|
},
|
|
263
|
+
"test:mutation": {
|
|
264
|
+
"command": "stryker run",
|
|
265
|
+
"files": [
|
|
266
|
+
"src/**/*.ts",
|
|
267
|
+
"test/**/*.ts",
|
|
268
|
+
"**/tsconfig.json",
|
|
269
|
+
"stryker.config.json",
|
|
270
|
+
"vitest.config.ts"
|
|
271
|
+
],
|
|
272
|
+
"output": [
|
|
273
|
+
"reports/mutation/**"
|
|
274
|
+
],
|
|
275
|
+
"dependencies": [
|
|
276
|
+
"lint"
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
"test:mutation:incremental": {
|
|
280
|
+
"command": "node scripts/incremental-mutation.mjs",
|
|
281
|
+
"files": [
|
|
282
|
+
"src/**/*.ts",
|
|
283
|
+
"test/**/*.ts",
|
|
284
|
+
"**/tsconfig.json",
|
|
285
|
+
"stryker.config.json",
|
|
286
|
+
"vitest.config.ts",
|
|
287
|
+
"scripts/incremental-mutation.mjs"
|
|
288
|
+
],
|
|
289
|
+
"output": [
|
|
290
|
+
"reports/mutation/**"
|
|
291
|
+
],
|
|
292
|
+
"dependencies": [
|
|
293
|
+
"lint"
|
|
294
|
+
]
|
|
295
|
+
},
|
|
229
296
|
"test:nuts": {
|
|
230
297
|
"command": "vitest run --config ./vitest.nut.config.ts && shx rm -f oclif.manifest.json oclif.lock *.tsbuildinfo",
|
|
231
298
|
"files": [
|
|
@@ -263,5 +330,8 @@
|
|
|
263
330
|
},
|
|
264
331
|
"bugs": {
|
|
265
332
|
"url": "https://github.com/mcarvin8/apex-code-coverage-transformer/issues"
|
|
333
|
+
},
|
|
334
|
+
"allowScripts": {
|
|
335
|
+
"esbuild@0.28.1": true
|
|
266
336
|
}
|
|
267
337
|
}
|