apex-code-coverage-transformer 2.5.0 → 2.5.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 +7 -0
- package/README.md +6 -327
- package/lib/handlers/cloverCoverageHandler.d.ts +1 -1
- package/lib/handlers/cloverCoverageHandler.js +8 -16
- package/lib/handlers/cloverCoverageHandler.js.map +1 -1
- package/lib/handlers/coberturaCoverageHandler.d.ts +1 -1
- package/lib/handlers/coberturaCoverageHandler.js +7 -20
- package/lib/handlers/coberturaCoverageHandler.js.map +1 -1
- package/lib/handlers/getCoverageHandler.js +1 -1
- package/lib/handlers/getCoverageHandler.js.map +1 -1
- package/lib/handlers/{lcovonlyCoverageHandler.d.ts → lcovCoverageHandler.d.ts} +1 -1
- package/lib/handlers/lcovCoverageHandler.js +26 -0
- package/lib/handlers/lcovCoverageHandler.js.map +1 -0
- package/lib/handlers/sonarCoverageHandler.d.ts +1 -1
- package/lib/handlers/sonarCoverageHandler.js +10 -21
- package/lib/handlers/sonarCoverageHandler.js.map +1 -1
- package/lib/helpers/findFilePath.js +2 -0
- package/lib/helpers/findFilePath.js.map +1 -1
- package/lib/helpers/setCoveredLines.d.ts +1 -0
- package/lib/helpers/setCoveredLines.js +27 -0
- package/lib/helpers/setCoveredLines.js.map +1 -0
- package/lib/helpers/transformDeployCoverageReport.js +4 -1
- package/lib/helpers/transformDeployCoverageReport.js.map +1 -1
- package/lib/helpers/transformTestCoverageReport.js +1 -1
- package/lib/helpers/transformTestCoverageReport.js.map +1 -1
- package/lib/helpers/types.d.ts +4 -4
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/lib/handlers/lcovonlyCoverageHandler.js +0 -37
- package/lib/handlers/lcovonlyCoverageHandler.js.map +0 -1
- package/lib/helpers/setCoveredLinesClover.d.ts +0 -2
- package/lib/helpers/setCoveredLinesClover.js +0 -34
- package/lib/helpers/setCoveredLinesClover.js.map +0 -1
- package/lib/helpers/setCoveredLinesCobertura.d.ts +0 -2
- package/lib/helpers/setCoveredLinesCobertura.js +0 -34
- package/lib/helpers/setCoveredLinesCobertura.js.map +0 -1
- package/lib/helpers/setCoveredLinesLcov.d.ts +0 -2
- package/lib/helpers/setCoveredLinesLcov.js +0 -24
- package/lib/helpers/setCoveredLinesLcov.js.map +0 -1
- package/lib/helpers/setCoveredLinesSonar.d.ts +0 -2
- package/lib/helpers/setCoveredLinesSonar.js +0 -30
- package/lib/helpers/setCoveredLinesSonar.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
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.5.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.5.0...v2.5.1) (2025-01-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* set covered lines before processing format ([d96bd88](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/d96bd88b341dbb8abe49ece21252e998abae617b))
|
|
14
|
+
|
|
8
15
|
## [2.5.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.4.1...v2.5.0) (2025-01-08)
|
|
9
16
|
|
|
10
17
|
|
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ The `.apexcodecovtransformer.config.json` should look like this:
|
|
|
125
125
|
- `deployCoverageJsonPath` is required to use the hook after deployments and should be the path to the code coverage JSON created by the Salesforce CLI deployment command. Recommend using a relative path.
|
|
126
126
|
- `testCoverageJsonPath` is required to use the hook after test runs and should be the path to the code coverage JSON created by the Salesforce CLI test command. Recommend using a relative path.
|
|
127
127
|
- `outputReportPath` is optional and should be the path to the code coverage file created by this plugin. Recommend using a relative path. If this isn't provided, it will default to `coverage.[xml/info]` in the working directory.
|
|
128
|
-
- `format` is optional and should be the intended output format for the code coverage file created by this plugin. Options are "sonar", "clover", or "cobertura". If this isn't provided, it will default to "sonar".
|
|
128
|
+
- `format` is optional and should be the intended output format for the code coverage file created by this plugin. Options are "sonar", "clover", "lcovonly", or "cobertura". If this isn't provided, it will default to "sonar".
|
|
129
129
|
|
|
130
130
|
If the `.apexcodecovtransformer.config.json` file isn't found, the hook will be skipped.
|
|
131
131
|
|
|
@@ -167,333 +167,12 @@ Error (1): ENOENT: no such file or directory: {packageDirPath}
|
|
|
167
167
|
|
|
168
168
|
## Example
|
|
169
169
|
|
|
170
|
-
This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_no_file_exts.json) created during a Salesforce CLI deployment
|
|
171
|
-
|
|
172
|
-
```xml
|
|
173
|
-
<?xml version="1.0"?>
|
|
174
|
-
<coverage version="1">
|
|
175
|
-
<file path="packaged/triggers/AccountTrigger.trigger">
|
|
176
|
-
<lineToCover lineNumber="52" covered="false"/>
|
|
177
|
-
<lineToCover lineNumber="53" covered="false"/>
|
|
178
|
-
<lineToCover lineNumber="59" covered="false"/>
|
|
179
|
-
<lineToCover lineNumber="60" covered="false"/>
|
|
180
|
-
<lineToCover lineNumber="1" covered="true"/>
|
|
181
|
-
<lineToCover lineNumber="2" covered="true"/>
|
|
182
|
-
<lineToCover lineNumber="3" covered="true"/>
|
|
183
|
-
<lineToCover lineNumber="4" covered="true"/>
|
|
184
|
-
<lineToCover lineNumber="5" covered="true"/>
|
|
185
|
-
<lineToCover lineNumber="6" covered="true"/>
|
|
186
|
-
<lineToCover lineNumber="7" covered="true"/>
|
|
187
|
-
<lineToCover lineNumber="8" covered="true"/>
|
|
188
|
-
<lineToCover lineNumber="9" covered="true"/>
|
|
189
|
-
<lineToCover lineNumber="10" covered="true"/>
|
|
190
|
-
<lineToCover lineNumber="11" covered="true"/>
|
|
191
|
-
<lineToCover lineNumber="12" covered="true"/>
|
|
192
|
-
<lineToCover lineNumber="13" covered="true"/>
|
|
193
|
-
<lineToCover lineNumber="14" covered="true"/>
|
|
194
|
-
<lineToCover lineNumber="15" covered="true"/>
|
|
195
|
-
<lineToCover lineNumber="16" covered="true"/>
|
|
196
|
-
<lineToCover lineNumber="17" covered="true"/>
|
|
197
|
-
<lineToCover lineNumber="18" covered="true"/>
|
|
198
|
-
<lineToCover lineNumber="19" covered="true"/>
|
|
199
|
-
<lineToCover lineNumber="20" covered="true"/>
|
|
200
|
-
<lineToCover lineNumber="21" covered="true"/>
|
|
201
|
-
<lineToCover lineNumber="22" covered="true"/>
|
|
202
|
-
<lineToCover lineNumber="23" covered="true"/>
|
|
203
|
-
<lineToCover lineNumber="24" covered="true"/>
|
|
204
|
-
<lineToCover lineNumber="25" covered="true"/>
|
|
205
|
-
<lineToCover lineNumber="26" covered="true"/>
|
|
206
|
-
<lineToCover lineNumber="27" covered="true"/>
|
|
207
|
-
</file>
|
|
208
|
-
<file path="force-app/main/default/classes/AccountProfile.cls">
|
|
209
|
-
<lineToCover lineNumber="52" covered="false"/>
|
|
210
|
-
<lineToCover lineNumber="53" covered="false"/>
|
|
211
|
-
<lineToCover lineNumber="59" covered="false"/>
|
|
212
|
-
<lineToCover lineNumber="60" covered="false"/>
|
|
213
|
-
<lineToCover lineNumber="54" covered="true"/>
|
|
214
|
-
<lineToCover lineNumber="55" covered="true"/>
|
|
215
|
-
<lineToCover lineNumber="56" covered="true"/>
|
|
216
|
-
<lineToCover lineNumber="57" covered="true"/>
|
|
217
|
-
<lineToCover lineNumber="58" covered="true"/>
|
|
218
|
-
<lineToCover lineNumber="61" covered="true"/>
|
|
219
|
-
<lineToCover lineNumber="62" covered="true"/>
|
|
220
|
-
<lineToCover lineNumber="63" covered="true"/>
|
|
221
|
-
<lineToCover lineNumber="64" covered="true"/>
|
|
222
|
-
<lineToCover lineNumber="65" covered="true"/>
|
|
223
|
-
<lineToCover lineNumber="66" covered="true"/>
|
|
224
|
-
<lineToCover lineNumber="67" covered="true"/>
|
|
225
|
-
<lineToCover lineNumber="68" covered="true"/>
|
|
226
|
-
<lineToCover lineNumber="69" covered="true"/>
|
|
227
|
-
<lineToCover lineNumber="70" covered="true"/>
|
|
228
|
-
<lineToCover lineNumber="71" covered="true"/>
|
|
229
|
-
<lineToCover lineNumber="72" covered="true"/>
|
|
230
|
-
<lineToCover lineNumber="1" covered="true"/>
|
|
231
|
-
<lineToCover lineNumber="2" covered="true"/>
|
|
232
|
-
<lineToCover lineNumber="3" covered="true"/>
|
|
233
|
-
<lineToCover lineNumber="4" covered="true"/>
|
|
234
|
-
<lineToCover lineNumber="5" covered="true"/>
|
|
235
|
-
<lineToCover lineNumber="6" covered="true"/>
|
|
236
|
-
<lineToCover lineNumber="7" covered="true"/>
|
|
237
|
-
<lineToCover lineNumber="8" covered="true"/>
|
|
238
|
-
<lineToCover lineNumber="9" covered="true"/>
|
|
239
|
-
<lineToCover lineNumber="10" covered="true"/>
|
|
240
|
-
</file>
|
|
241
|
-
</coverage>
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
and this format for Cobertura:
|
|
245
|
-
|
|
246
|
-
```xml
|
|
247
|
-
<?xml version="1.0" ?>
|
|
248
|
-
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
|
249
|
-
<coverage lines-valid="62" lines-covered="54" line-rate="0.871" branches-valid="0" branches-covered="0" branch-rate="1" timestamp="1736198880235" complexity="0" version="0.1">
|
|
250
|
-
<sources>
|
|
251
|
-
<source>.</source>
|
|
252
|
-
</sources>
|
|
253
|
-
<packages>
|
|
254
|
-
<package name="main" line-rate="0.871" branch-rate="1">
|
|
255
|
-
<classes>
|
|
256
|
-
<class name="AccountTrigger" filename="packaged/triggers/AccountTrigger.trigger" line-rate="0.8710" branch-rate="1">
|
|
257
|
-
<methods/>
|
|
258
|
-
<lines>
|
|
259
|
-
<line number="52" hits="0" branch="false"/>
|
|
260
|
-
<line number="53" hits="0" branch="false"/>
|
|
261
|
-
<line number="59" hits="0" branch="false"/>
|
|
262
|
-
<line number="60" hits="0" branch="false"/>
|
|
263
|
-
<line number="1" hits="1" branch="false"/>
|
|
264
|
-
<line number="2" hits="1" branch="false"/>
|
|
265
|
-
<line number="3" hits="1" branch="false"/>
|
|
266
|
-
<line number="4" hits="1" branch="false"/>
|
|
267
|
-
<line number="5" hits="1" branch="false"/>
|
|
268
|
-
<line number="6" hits="1" branch="false"/>
|
|
269
|
-
<line number="7" hits="1" branch="false"/>
|
|
270
|
-
<line number="8" hits="1" branch="false"/>
|
|
271
|
-
<line number="9" hits="1" branch="false"/>
|
|
272
|
-
<line number="10" hits="1" branch="false"/>
|
|
273
|
-
<line number="11" hits="1" branch="false"/>
|
|
274
|
-
<line number="12" hits="1" branch="false"/>
|
|
275
|
-
<line number="13" hits="1" branch="false"/>
|
|
276
|
-
<line number="14" hits="1" branch="false"/>
|
|
277
|
-
<line number="15" hits="1" branch="false"/>
|
|
278
|
-
<line number="16" hits="1" branch="false"/>
|
|
279
|
-
<line number="17" hits="1" branch="false"/>
|
|
280
|
-
<line number="18" hits="1" branch="false"/>
|
|
281
|
-
<line number="19" hits="1" branch="false"/>
|
|
282
|
-
<line number="20" hits="1" branch="false"/>
|
|
283
|
-
<line number="21" hits="1" branch="false"/>
|
|
284
|
-
<line number="22" hits="1" branch="false"/>
|
|
285
|
-
<line number="23" hits="1" branch="false"/>
|
|
286
|
-
<line number="24" hits="1" branch="false"/>
|
|
287
|
-
<line number="25" hits="1" branch="false"/>
|
|
288
|
-
<line number="26" hits="1" branch="false"/>
|
|
289
|
-
<line number="27" hits="1" branch="false"/>
|
|
290
|
-
</lines>
|
|
291
|
-
</class>
|
|
292
|
-
<class name="AccountProfile" filename="force-app/main/default/classes/AccountProfile.cls" line-rate="0.8710" branch-rate="1">
|
|
293
|
-
<methods/>
|
|
294
|
-
<lines>
|
|
295
|
-
<line number="52" hits="0" branch="false"/>
|
|
296
|
-
<line number="53" hits="0" branch="false"/>
|
|
297
|
-
<line number="59" hits="0" branch="false"/>
|
|
298
|
-
<line number="60" hits="0" branch="false"/>
|
|
299
|
-
<line number="54" hits="1" branch="false"/>
|
|
300
|
-
<line number="55" hits="1" branch="false"/>
|
|
301
|
-
<line number="56" hits="1" branch="false"/>
|
|
302
|
-
<line number="57" hits="1" branch="false"/>
|
|
303
|
-
<line number="58" hits="1" branch="false"/>
|
|
304
|
-
<line number="61" hits="1" branch="false"/>
|
|
305
|
-
<line number="62" hits="1" branch="false"/>
|
|
306
|
-
<line number="63" hits="1" branch="false"/>
|
|
307
|
-
<line number="64" hits="1" branch="false"/>
|
|
308
|
-
<line number="65" hits="1" branch="false"/>
|
|
309
|
-
<line number="66" hits="1" branch="false"/>
|
|
310
|
-
<line number="67" hits="1" branch="false"/>
|
|
311
|
-
<line number="68" hits="1" branch="false"/>
|
|
312
|
-
<line number="69" hits="1" branch="false"/>
|
|
313
|
-
<line number="70" hits="1" branch="false"/>
|
|
314
|
-
<line number="71" hits="1" branch="false"/>
|
|
315
|
-
<line number="72" hits="1" branch="false"/>
|
|
316
|
-
<line number="1" hits="1" branch="false"/>
|
|
317
|
-
<line number="2" hits="1" branch="false"/>
|
|
318
|
-
<line number="3" hits="1" branch="false"/>
|
|
319
|
-
<line number="4" hits="1" branch="false"/>
|
|
320
|
-
<line number="5" hits="1" branch="false"/>
|
|
321
|
-
<line number="6" hits="1" branch="false"/>
|
|
322
|
-
<line number="7" hits="1" branch="false"/>
|
|
323
|
-
<line number="8" hits="1" branch="false"/>
|
|
324
|
-
<line number="9" hits="1" branch="false"/>
|
|
325
|
-
<line number="10" hits="1" branch="false"/>
|
|
326
|
-
</lines>
|
|
327
|
-
</class>
|
|
328
|
-
</classes>
|
|
329
|
-
</package>
|
|
330
|
-
</packages>
|
|
331
|
-
</coverage>
|
|
332
|
-
```
|
|
170
|
+
This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_no_file_exts.json) created during a Salesforce CLI deployment can be transformed into:
|
|
333
171
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
<coverage generated="1736198880331" clover="3.2.0">
|
|
339
|
-
<project timestamp="1736198880331" name="All files">
|
|
340
|
-
<metrics statements="62" coveredstatements="54" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="62" coveredelements="54" complexity="0" loc="62" ncloc="62" packages="1" files="2" classes="2"/>
|
|
341
|
-
<file name="AccountTrigger" path="packaged/triggers/AccountTrigger.trigger">
|
|
342
|
-
<metrics statements="31" coveredstatements="27" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
343
|
-
<line num="52" count="0" type="stmt"/>
|
|
344
|
-
<line num="53" count="0" type="stmt"/>
|
|
345
|
-
<line num="59" count="0" type="stmt"/>
|
|
346
|
-
<line num="60" count="0" type="stmt"/>
|
|
347
|
-
<line num="1" count="1" type="stmt"/>
|
|
348
|
-
<line num="2" count="1" type="stmt"/>
|
|
349
|
-
<line num="3" count="1" type="stmt"/>
|
|
350
|
-
<line num="4" count="1" type="stmt"/>
|
|
351
|
-
<line num="5" count="1" type="stmt"/>
|
|
352
|
-
<line num="6" count="1" type="stmt"/>
|
|
353
|
-
<line num="7" count="1" type="stmt"/>
|
|
354
|
-
<line num="8" count="1" type="stmt"/>
|
|
355
|
-
<line num="9" count="1" type="stmt"/>
|
|
356
|
-
<line num="10" count="1" type="stmt"/>
|
|
357
|
-
<line num="11" count="1" type="stmt"/>
|
|
358
|
-
<line num="12" count="1" type="stmt"/>
|
|
359
|
-
<line num="13" count="1" type="stmt"/>
|
|
360
|
-
<line num="14" count="1" type="stmt"/>
|
|
361
|
-
<line num="15" count="1" type="stmt"/>
|
|
362
|
-
<line num="16" count="1" type="stmt"/>
|
|
363
|
-
<line num="17" count="1" type="stmt"/>
|
|
364
|
-
<line num="18" count="1" type="stmt"/>
|
|
365
|
-
<line num="19" count="1" type="stmt"/>
|
|
366
|
-
<line num="20" count="1" type="stmt"/>
|
|
367
|
-
<line num="21" count="1" type="stmt"/>
|
|
368
|
-
<line num="22" count="1" type="stmt"/>
|
|
369
|
-
<line num="23" count="1" type="stmt"/>
|
|
370
|
-
<line num="24" count="1" type="stmt"/>
|
|
371
|
-
<line num="25" count="1" type="stmt"/>
|
|
372
|
-
<line num="26" count="1" type="stmt"/>
|
|
373
|
-
<line num="27" count="1" type="stmt"/>
|
|
374
|
-
</file>
|
|
375
|
-
<file name="AccountProfile" path="force-app/main/default/classes/AccountProfile.cls">
|
|
376
|
-
<metrics statements="31" coveredstatements="27" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
377
|
-
<line num="52" count="0" type="stmt"/>
|
|
378
|
-
<line num="53" count="0" type="stmt"/>
|
|
379
|
-
<line num="59" count="0" type="stmt"/>
|
|
380
|
-
<line num="60" count="0" type="stmt"/>
|
|
381
|
-
<line num="54" count="1" type="stmt"/>
|
|
382
|
-
<line num="55" count="1" type="stmt"/>
|
|
383
|
-
<line num="56" count="1" type="stmt"/>
|
|
384
|
-
<line num="57" count="1" type="stmt"/>
|
|
385
|
-
<line num="58" count="1" type="stmt"/>
|
|
386
|
-
<line num="61" count="1" type="stmt"/>
|
|
387
|
-
<line num="62" count="1" type="stmt"/>
|
|
388
|
-
<line num="63" count="1" type="stmt"/>
|
|
389
|
-
<line num="64" count="1" type="stmt"/>
|
|
390
|
-
<line num="65" count="1" type="stmt"/>
|
|
391
|
-
<line num="66" count="1" type="stmt"/>
|
|
392
|
-
<line num="67" count="1" type="stmt"/>
|
|
393
|
-
<line num="68" count="1" type="stmt"/>
|
|
394
|
-
<line num="69" count="1" type="stmt"/>
|
|
395
|
-
<line num="70" count="1" type="stmt"/>
|
|
396
|
-
<line num="71" count="1" type="stmt"/>
|
|
397
|
-
<line num="72" count="1" type="stmt"/>
|
|
398
|
-
<line num="1" count="1" type="stmt"/>
|
|
399
|
-
<line num="2" count="1" type="stmt"/>
|
|
400
|
-
<line num="3" count="1" type="stmt"/>
|
|
401
|
-
<line num="4" count="1" type="stmt"/>
|
|
402
|
-
<line num="5" count="1" type="stmt"/>
|
|
403
|
-
<line num="6" count="1" type="stmt"/>
|
|
404
|
-
<line num="7" count="1" type="stmt"/>
|
|
405
|
-
<line num="8" count="1" type="stmt"/>
|
|
406
|
-
<line num="9" count="1" type="stmt"/>
|
|
407
|
-
<line num="10" count="1" type="stmt"/>
|
|
408
|
-
</file>
|
|
409
|
-
</project>
|
|
410
|
-
</coverage>
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
and this format for LCovOnly:
|
|
414
|
-
|
|
415
|
-
```info
|
|
416
|
-
TN:
|
|
417
|
-
SF:packaged/triggers/AccountTrigger.trigger
|
|
418
|
-
FNF:0
|
|
419
|
-
FNH:0
|
|
420
|
-
DA:52,0
|
|
421
|
-
DA:53,0
|
|
422
|
-
DA:59,0
|
|
423
|
-
DA:60,0
|
|
424
|
-
DA:1,1
|
|
425
|
-
DA:2,1
|
|
426
|
-
DA:3,1
|
|
427
|
-
DA:4,1
|
|
428
|
-
DA:5,1
|
|
429
|
-
DA:6,1
|
|
430
|
-
DA:7,1
|
|
431
|
-
DA:8,1
|
|
432
|
-
DA:9,1
|
|
433
|
-
DA:10,1
|
|
434
|
-
DA:11,1
|
|
435
|
-
DA:12,1
|
|
436
|
-
DA:13,1
|
|
437
|
-
DA:14,1
|
|
438
|
-
DA:15,1
|
|
439
|
-
DA:16,1
|
|
440
|
-
DA:17,1
|
|
441
|
-
DA:18,1
|
|
442
|
-
DA:19,1
|
|
443
|
-
DA:20,1
|
|
444
|
-
DA:21,1
|
|
445
|
-
DA:22,1
|
|
446
|
-
DA:23,1
|
|
447
|
-
DA:24,1
|
|
448
|
-
DA:25,1
|
|
449
|
-
DA:26,1
|
|
450
|
-
DA:27,1
|
|
451
|
-
LF:31
|
|
452
|
-
LH:27
|
|
453
|
-
BRF:0
|
|
454
|
-
BRH:0
|
|
455
|
-
end_of_record
|
|
456
|
-
TN:
|
|
457
|
-
SF:force-app/main/default/classes/AccountProfile.cls
|
|
458
|
-
FNF:0
|
|
459
|
-
FNH:0
|
|
460
|
-
DA:52,0
|
|
461
|
-
DA:53,0
|
|
462
|
-
DA:59,0
|
|
463
|
-
DA:60,0
|
|
464
|
-
DA:54,1
|
|
465
|
-
DA:55,1
|
|
466
|
-
DA:56,1
|
|
467
|
-
DA:57,1
|
|
468
|
-
DA:58,1
|
|
469
|
-
DA:61,1
|
|
470
|
-
DA:62,1
|
|
471
|
-
DA:63,1
|
|
472
|
-
DA:64,1
|
|
473
|
-
DA:65,1
|
|
474
|
-
DA:66,1
|
|
475
|
-
DA:67,1
|
|
476
|
-
DA:68,1
|
|
477
|
-
DA:69,1
|
|
478
|
-
DA:70,1
|
|
479
|
-
DA:71,1
|
|
480
|
-
DA:72,1
|
|
481
|
-
DA:1,1
|
|
482
|
-
DA:2,1
|
|
483
|
-
DA:3,1
|
|
484
|
-
DA:4,1
|
|
485
|
-
DA:5,1
|
|
486
|
-
DA:6,1
|
|
487
|
-
DA:7,1
|
|
488
|
-
DA:8,1
|
|
489
|
-
DA:9,1
|
|
490
|
-
DA:10,1
|
|
491
|
-
LF:31
|
|
492
|
-
LH:27
|
|
493
|
-
BRF:0
|
|
494
|
-
BRH:0
|
|
495
|
-
end_of_record
|
|
496
|
-
```
|
|
172
|
+
- [SonarQube format](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_baseline_sonar.xml)
|
|
173
|
+
- [Cobertura format](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_baseline_cobertura.xml)
|
|
174
|
+
- [Clover format](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_baseline_clover.xml)
|
|
175
|
+
- [LCovOnly format](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_baseline_lcov.info)
|
|
497
176
|
|
|
498
177
|
## Issues
|
|
499
178
|
|
|
@@ -2,6 +2,6 @@ import { CloverCoverageObject, CoverageHandler } from '../helpers/types.js';
|
|
|
2
2
|
export declare class CloverCoverageHandler implements CoverageHandler {
|
|
3
3
|
private readonly coverageObj;
|
|
4
4
|
constructor();
|
|
5
|
-
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]
|
|
5
|
+
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]): void;
|
|
6
6
|
finalize(): CloverCoverageObject;
|
|
7
7
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import { setCoveredLinesClover } from '../helpers/setCoveredLinesClover.js';
|
|
3
|
-
import { normalizePathToUnix } from '../helpers/normalizePathToUnix.js';
|
|
4
2
|
export class CloverCoverageHandler {
|
|
5
3
|
coverageObj;
|
|
6
4
|
constructor() {
|
|
@@ -32,10 +30,10 @@ export class CloverCoverageHandler {
|
|
|
32
30
|
},
|
|
33
31
|
};
|
|
34
32
|
}
|
|
35
|
-
|
|
33
|
+
processFile(filePath, fileName, lines, uncoveredLines, coveredLines) {
|
|
36
34
|
const fileObj = {
|
|
37
35
|
'@name': fileName,
|
|
38
|
-
'@path':
|
|
36
|
+
'@path': filePath,
|
|
39
37
|
metrics: {
|
|
40
38
|
'@statements': uncoveredLines.length + coveredLines.length,
|
|
41
39
|
'@coveredstatements': coveredLines.length,
|
|
@@ -46,18 +44,12 @@ export class CloverCoverageHandler {
|
|
|
46
44
|
},
|
|
47
45
|
line: [],
|
|
48
46
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else if (reportType === 'deploy') {
|
|
59
|
-
fileObj.line = [...uncoveredLines.map((lineNumber) => ({ '@num': lineNumber, '@count': 0, '@type': 'stmt' }))];
|
|
60
|
-
await setCoveredLinesClover(coveredLines, uncoveredLines, repoRoot, filePath, fileObj);
|
|
47
|
+
for (const [lineNumber, isCovered] of Object.entries(lines)) {
|
|
48
|
+
fileObj.line.push({
|
|
49
|
+
'@num': Number(lineNumber),
|
|
50
|
+
'@count': isCovered === 1 ? 1 : 0,
|
|
51
|
+
'@type': 'stmt',
|
|
52
|
+
});
|
|
61
53
|
}
|
|
62
54
|
this.coverageObj.coverage.project.file.push(fileObj);
|
|
63
55
|
const projectMetrics = this.coverageObj.coverage.project.metrics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloverCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/cloverCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"cloverCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/cloverCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,MAAM,OAAO,qBAAqB;IACf,WAAW,CAAuB;IAEnD;QACE,IAAI,CAAC,WAAW,GAAG;YACjB,QAAQ,EAAE;gBACR,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,SAAS,EAAE,OAAO;gBAClB,OAAO,EAAE;oBACP,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;oBACxB,OAAO,EAAE,WAAW;oBACpB,OAAO,EAAE;wBACP,aAAa,EAAE,CAAC;wBAChB,oBAAoB,EAAE,CAAC;wBACvB,eAAe,EAAE,CAAC;wBAClB,sBAAsB,EAAE,CAAC;wBACzB,UAAU,EAAE,CAAC;wBACb,iBAAiB,EAAE,CAAC;wBACpB,WAAW,EAAE,CAAC;wBACd,kBAAkB,EAAE,CAAC;wBACrB,aAAa,EAAE,CAAC;wBAChB,MAAM,EAAE,CAAC;wBACT,QAAQ,EAAE,CAAC;wBACX,WAAW,EAAE,CAAC;wBACd,QAAQ,EAAE,CAAC;wBACX,UAAU,EAAE,CAAC;qBACd;oBACD,IAAI,EAAE,EAAE;iBACT;aACF;SACF,CAAC;IACJ,CAAC;IAEM,WAAW,CAChB,QAAgB,EAChB,QAAgB,EAChB,K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C;QAC9B,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAChC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;QACtE,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IAC1E,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -3,6 +3,6 @@ export declare class CoberturaCoverageHandler implements CoverageHandler {
|
|
|
3
3
|
private readonly coverageObj;
|
|
4
4
|
private packageObj;
|
|
5
5
|
constructor();
|
|
6
|
-
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]
|
|
6
|
+
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]): void;
|
|
7
7
|
finalize(): CoberturaCoverageObject;
|
|
8
8
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import { setCoveredLinesCobertura } from '../helpers/setCoveredLinesCobertura.js';
|
|
3
|
-
import { normalizePathToUnix } from '../helpers/normalizePathToUnix.js';
|
|
4
2
|
export class CoberturaCoverageHandler {
|
|
5
3
|
coverageObj;
|
|
6
4
|
packageObj;
|
|
@@ -28,10 +26,10 @@ export class CoberturaCoverageHandler {
|
|
|
28
26
|
};
|
|
29
27
|
this.coverageObj.coverage.packages.package.push(this.packageObj);
|
|
30
28
|
}
|
|
31
|
-
|
|
29
|
+
processFile(filePath, fileName, lines, uncoveredLines, coveredLines) {
|
|
32
30
|
const classObj = {
|
|
33
31
|
'@name': fileName,
|
|
34
|
-
'@filename':
|
|
32
|
+
'@filename': filePath,
|
|
35
33
|
'@line-rate': '0',
|
|
36
34
|
'@branch-rate': '1',
|
|
37
35
|
methods: {},
|
|
@@ -39,23 +37,12 @@ export class CoberturaCoverageHandler {
|
|
|
39
37
|
};
|
|
40
38
|
const totalLines = uncoveredLines.length + coveredLines.length;
|
|
41
39
|
const coveredLineCount = coveredLines.length;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'@number': Number(lineNumber),
|
|
47
|
-
'@hits': isCovered === 1 ? 1 : 0,
|
|
48
|
-
'@branch': 'false',
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else if (reportType === 'deploy') {
|
|
53
|
-
classObj.lines.line = uncoveredLines.map((lineNumber) => ({
|
|
54
|
-
'@number': lineNumber,
|
|
55
|
-
'@hits': 0,
|
|
40
|
+
for (const [lineNumber, isCovered] of Object.entries(lines)) {
|
|
41
|
+
classObj.lines.line.push({
|
|
42
|
+
'@number': Number(lineNumber),
|
|
43
|
+
'@hits': isCovered === 1 ? 1 : 0,
|
|
56
44
|
'@branch': 'false',
|
|
57
|
-
})
|
|
58
|
-
await setCoveredLinesCobertura(coveredLines, uncoveredLines, repoRoot, filePath, classObj);
|
|
45
|
+
});
|
|
59
46
|
}
|
|
60
47
|
// Calculate and set the line rate for this class
|
|
61
48
|
if (totalLines > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coberturaCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/coberturaCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"coberturaCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/coberturaCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,MAAM,OAAO,wBAAwB;IAClB,WAAW,CAA0B;IAC9C,UAAU,CAAmB;IAErC;QACE,IAAI,CAAC,WAAW,GAAG;YACjB,QAAQ,EAAE;gBACR,cAAc,EAAE,CAAC;gBACjB,gBAAgB,EAAE,CAAC;gBACnB,YAAY,EAAE,CAAC;gBACf,iBAAiB,EAAE,CAAC;gBACpB,mBAAmB,EAAE,CAAC;gB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gBAChC,SAAS,EAAE,OAAO;aACnB,CAAC,CAAC;QACL,CAAC;QAED,iDAAiD;QACjD,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,CAAC,gBAAgB,GAAG,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5D,QAAQ,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,UAAU,CAAC;QACxD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,CAAC;QAEhE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,MAAM,CACpC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACrG,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QAExE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { CloverCoverageHandler } from './cloverCoverageHandler.js';
|
|
3
3
|
import { CoberturaCoverageHandler } from './coberturaCoverageHandler.js';
|
|
4
4
|
import { SonarCoverageHandler } from './sonarCoverageHandler.js';
|
|
5
|
-
import { LcovCoverageHandler } from './
|
|
5
|
+
import { LcovCoverageHandler } from './lcovCoverageHandler.js';
|
|
6
6
|
export function getCoverageHandler(format) {
|
|
7
7
|
const handlers = {
|
|
8
8
|
sonar: new SonarCoverageHandler(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/getCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/getCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,QAAQ,GAAoC;QAChD,KAAK,EAAE,IAAI,oBAAoB,EAAE;QACjC,SAAS,EAAE,IAAI,wBAAwB,EAAE;QACzC,MAAM,EAAE,IAAI,qBAAqB,EAAE;QACnC,QAAQ,EAAE,IAAI,mBAAmB,EAAE;KACpC,CAAC;IAEF,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { CoverageHandler, LcovCoverageObject } from '../helpers/types.js';
|
|
|
2
2
|
export declare class LcovCoverageHandler implements CoverageHandler {
|
|
3
3
|
private readonly coverageObj;
|
|
4
4
|
constructor();
|
|
5
|
-
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]
|
|
5
|
+
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]): void;
|
|
6
6
|
finalize(): LcovCoverageObject;
|
|
7
7
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
export class LcovCoverageHandler {
|
|
3
|
+
coverageObj;
|
|
4
|
+
constructor() {
|
|
5
|
+
this.coverageObj = { files: [] };
|
|
6
|
+
}
|
|
7
|
+
processFile(filePath, fileName, lines, uncoveredLines, coveredLines) {
|
|
8
|
+
const lcovFile = {
|
|
9
|
+
sourceFile: filePath,
|
|
10
|
+
lines: [],
|
|
11
|
+
totalLines: uncoveredLines.length + coveredLines.length,
|
|
12
|
+
coveredLines: coveredLines.length,
|
|
13
|
+
};
|
|
14
|
+
for (const [lineNumber, isCovered] of Object.entries(lines)) {
|
|
15
|
+
lcovFile.lines.push({
|
|
16
|
+
lineNumber: Number(lineNumber),
|
|
17
|
+
hitCount: isCovered === 1 ? 1 : 0,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
this.coverageObj.files.push(lcovFile);
|
|
21
|
+
}
|
|
22
|
+
finalize() {
|
|
23
|
+
return this.coverageObj;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=lcovCoverageHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcovCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/lcovCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,MAAM,OAAO,mBAAmB;IACb,WAAW,CAAqB;IAEjD;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACnC,CAAC;IAEM,WAAW,CAChB,QAAgB,EAChB,QAAgB,EAChB,KAA6B,EAC7B,cAAwB,EACxB,YAAsB;QAEtB,MAAM,QAAQ,GAAa;YACzB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,EAAE;YACT,UAAU,EAAE,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM;YACvD,YAAY,EAAE,YAAY,CAAC,MAAM;SAClC,CAAC;QAEF,KAAK,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;gBAClB,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC;gBAC9B,QAAQ,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAClC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -2,6 +2,6 @@ import { SonarCoverageObject, CoverageHandler } from '../helpers/types.js';
|
|
|
2
2
|
export declare class SonarCoverageHandler implements CoverageHandler {
|
|
3
3
|
private readonly coverageObj;
|
|
4
4
|
constructor();
|
|
5
|
-
processFile(filePath: string, _fileName: string, lines: Record<string, number
|
|
5
|
+
processFile(filePath: string, _fileName: string, lines: Record<string, number>): void;
|
|
6
6
|
finalize(): SonarCoverageObject;
|
|
7
7
|
}
|
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import { setCoveredLinesSonar } from '../helpers/setCoveredLinesSonar.js';
|
|
3
|
-
import { normalizePathToUnix } from '../helpers/normalizePathToUnix.js';
|
|
4
2
|
export class SonarCoverageHandler {
|
|
5
3
|
coverageObj;
|
|
6
4
|
constructor() {
|
|
7
5
|
this.coverageObj = { coverage: { '@version': '1', file: [] } };
|
|
8
6
|
}
|
|
9
|
-
|
|
7
|
+
processFile(filePath, _fileName, lines) {
|
|
10
8
|
const fileObj = {
|
|
11
|
-
'@path':
|
|
9
|
+
'@path': filePath,
|
|
12
10
|
lineToCover: [],
|
|
13
11
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else if (reportType === 'deploy') {
|
|
26
|
-
fileObj.lineToCover = uncoveredLines.map((lineNumber) => ({
|
|
27
|
-
'@lineNumber': lineNumber,
|
|
28
|
-
'@covered': 'false',
|
|
29
|
-
}));
|
|
30
|
-
await setCoveredLinesSonar(coveredLines, uncoveredLines, repoRoot, filePath, fileObj);
|
|
12
|
+
for (const lineNumberString in lines) {
|
|
13
|
+
if (!Object.hasOwn(lines, lineNumberString))
|
|
14
|
+
continue;
|
|
15
|
+
const covered = lines[lineNumberString] === 1 ? 'true' : 'false';
|
|
16
|
+
fileObj.lineToCover.push({
|
|
17
|
+
'@lineNumber': Number(lineNumberString),
|
|
18
|
+
'@covered': covered,
|
|
19
|
+
});
|
|
31
20
|
}
|
|
32
21
|
this.coverageObj.coverage.file.push(fileObj);
|
|
33
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sonarCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/sonarCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"sonarCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/sonarCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,MAAM,OAAO,oBAAoB;IACd,WAAW,CAAsB;IAElD;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC;IACjE,CAAC;IAEM,WAAW,CAChB,QAAgB,EAChB,SAAiB,EACjB,KAA6B;QAE7B,MAAM,OAAO,GAAe;YAC1B,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,EAAE;SAChB,CAAC;QACF,KAAK,MAAM,gBAAgB,IAAI,KAAK,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC;gBAAE,SAAS;YACtD,MAAM,OAAO,GAAG,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;YACjE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;gBACvB,aAAa,EAAE,MAAM,CAAC,gBAAgB,CAAC;gBACvC,UAAU,EAAE,OAAO;aACpB,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
/* eslint-disable no-await-in-loop */
|
|
3
3
|
import { readdir, stat } from 'node:fs/promises';
|
|
4
4
|
import { join, relative } from 'node:path';
|
|
5
|
+
import { normalizePathToUnix } from './normalizePathToUnix.js';
|
|
5
6
|
export async function findFilePath(fileName, packageDirectories, repoRoot) {
|
|
6
7
|
let relativeFilePath;
|
|
7
8
|
for (const directory of packageDirectories) {
|
|
8
9
|
relativeFilePath = await findFilePathinDirectory(fileName, directory, repoRoot);
|
|
9
10
|
if (relativeFilePath !== undefined) {
|
|
11
|
+
relativeFilePath = normalizePathToUnix(relativeFilePath);
|
|
10
12
|
break;
|
|
11
13
|
}
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findFilePath.js","sourceRoot":"","sources":["../../src/helpers/findFilePath.ts"],"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ines: Record<string, number>): Promise<Record<string, number>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { getTotalLines } from './getTotalLines.js';
|
|
4
|
+
export async function renumberLines(filePath, repoRoot, lines) {
|
|
5
|
+
const totalLines = await getTotalLines(join(repoRoot, filePath));
|
|
6
|
+
const updatedLines = {};
|
|
7
|
+
const usedLines = new Set();
|
|
8
|
+
for (const [line, status] of Object.entries(lines)) {
|
|
9
|
+
const lineNumber = parseInt(line, 10);
|
|
10
|
+
if (status === 1 && lineNumber > totalLines) {
|
|
11
|
+
// Find the first valid line number not already used
|
|
12
|
+
for (let randomLine = 1; randomLine <= totalLines; randomLine++) {
|
|
13
|
+
if (!usedLines.has(randomLine)) {
|
|
14
|
+
updatedLines[randomLine.toString()] = status;
|
|
15
|
+
usedLines.add(randomLine);
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
updatedLines[line] = status;
|
|
22
|
+
usedLines.add(lineNumber);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return updatedLines;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=setCoveredLines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setCoveredLines.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLines.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,QAAgB,EAChB,KAA6B;IAE7B,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,MAAM,YAAY,GAA2B,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IAEpC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAEtC,IAAI,MAAM,KAAK,CAAC,IAAI,UAAU,GAAG,UAAU,EAAE,CAAC;YAC5C,oDAAoD;YACpD,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,IAAI,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;gBAChE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC/B,YAAY,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC;oBAC7C,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;oBAC1B,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;YAC5B,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { getCoverageHandler } from '../handlers/getCoverageHandler.js';
|
|
|
4
4
|
import { getPackageDirectories } from './getPackageDirectories.js';
|
|
5
5
|
import { findFilePath } from './findFilePath.js';
|
|
6
6
|
import { generateReport } from './generateReport.js';
|
|
7
|
+
import { renumberLines } from './setCoveredLines.js';
|
|
7
8
|
export async function transformDeployCoverageReport(data, format) {
|
|
8
9
|
const warnings = [];
|
|
9
10
|
let filesProcessed = 0;
|
|
@@ -25,7 +26,9 @@ export async function transformDeployCoverageReport(data, format) {
|
|
|
25
26
|
const coveredLines = Object.keys(fileInfo.s)
|
|
26
27
|
.filter((lineNumber) => fileInfo.s[lineNumber] === 1)
|
|
27
28
|
.map(Number);
|
|
28
|
-
await
|
|
29
|
+
const updatedLines = await renumberLines(relativeFilePath, repoRoot, fileInfo.s);
|
|
30
|
+
fileInfo.s = updatedLines; // Safe reassignment outside the function
|
|
31
|
+
handler.processFile(relativeFilePath, formattedFileName, fileInfo.s, uncoveredLines, coveredLines);
|
|
29
32
|
filesProcessed++;
|
|
30
33
|
}
|
|
31
34
|
const coverageObj = handler.finalize();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDeployCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformDeployCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,IAAwB,EACxB,MAAc;IAEd,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,MAAM,qBAAqB,EAAE,CAAC;IACvE,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3C,KAAK,MAAM,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC;YAAE,SAAS;QAE7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC/D,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,iBAAiB,EAAE,kBAAk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CAAC;QACF,cAAc,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IACvC,MAAM,GAAG,GAAG,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAEhD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -30,7 +30,7 @@ export async function transformTestCoverageReport(testCoverageData, format) {
|
|
|
30
30
|
const coveredLines = Object.entries(lines)
|
|
31
31
|
.filter(([, isCovered]) => isCovered === 1)
|
|
32
32
|
.map(([lineNumber]) => Number(lineNumber));
|
|
33
|
-
|
|
33
|
+
handler.processFile(relativeFilePath, formattedFileName, lines, uncoveredLines, coveredLines);
|
|
34
34
|
filesProcessed++;
|
|
35
35
|
}
|
|
36
36
|
const coverageObj = handler.finalize();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformTestCoverageReport.js","sourceRoot":"","sources":["../../src/helpers/transformTestCoverageReport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,gBAAoC,EACpC,MAAc;IAEd,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,MAAM,qBAAqB,EAAE,CAAC;IACvE,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,YAAY,GAAG,gBAAgB,CAAC;IACpC,IAAI,CA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M,CAAC,OAAO,CAAC,KAAK,CAAC;aACzC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;aACvC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAE7C,OAAO,CAAC,WAAW,CACjB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,EACL,cAAc,EACd,YAAY,CACb,CAAC;QAEF,cAAc,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IACvC,MAAM,GAAG,GAAG,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAEhD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAC3C,CAAC"}
|
package/lib/helpers/types.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export type CloverFile = {
|
|
|
114
114
|
};
|
|
115
115
|
line: CloverLine[];
|
|
116
116
|
};
|
|
117
|
-
|
|
117
|
+
type CloverProjectMetrics = {
|
|
118
118
|
'@statements': number;
|
|
119
119
|
'@coveredstatements': number;
|
|
120
120
|
'@conditionals': number;
|
|
@@ -130,7 +130,7 @@ export type CloverProjectMetrics = {
|
|
|
130
130
|
'@files': number;
|
|
131
131
|
'@classes': number;
|
|
132
132
|
};
|
|
133
|
-
|
|
133
|
+
type CloverProject = {
|
|
134
134
|
'@timestamp': number;
|
|
135
135
|
'@name': string;
|
|
136
136
|
metrics: CloverProjectMetrics;
|
|
@@ -144,10 +144,10 @@ export type CloverCoverageObject = {
|
|
|
144
144
|
};
|
|
145
145
|
};
|
|
146
146
|
export type CoverageHandler = {
|
|
147
|
-
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]
|
|
147
|
+
processFile(filePath: string, fileName: string, lines: Record<string, number>, uncoveredLines: number[], coveredLines: number[]): void;
|
|
148
148
|
finalize(): SonarCoverageObject | CoberturaCoverageObject | CloverCoverageObject | LcovCoverageObject;
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
type LcovLine = {
|
|
151
151
|
lineNumber: number;
|
|
152
152
|
hitCount: number;
|
|
153
153
|
};
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apex-code-coverage-transformer",
|
|
3
3
|
"description": "Transforms the Apex code coverage JSON created during Salesforce deployments and test runs into SonarQube, Clover, LCovOnly, or Cobertura format.",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4.0.37",
|
|
7
7
|
"@salesforce/core": "^8.8.0",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
import { setCoveredLinesLcov } from '../helpers/setCoveredLinesLcov.js';
|
|
3
|
-
import { normalizePathToUnix } from '../helpers/normalizePathToUnix.js';
|
|
4
|
-
export class LcovCoverageHandler {
|
|
5
|
-
coverageObj;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.coverageObj = { files: [] };
|
|
8
|
-
}
|
|
9
|
-
async processFile(filePath, fileName, lines, uncoveredLines, coveredLines, repoRoot, reportType) {
|
|
10
|
-
const lcovFile = {
|
|
11
|
-
sourceFile: normalizePathToUnix(filePath),
|
|
12
|
-
lines: [],
|
|
13
|
-
totalLines: uncoveredLines.length + coveredLines.length,
|
|
14
|
-
coveredLines: coveredLines.length,
|
|
15
|
-
};
|
|
16
|
-
if (reportType === 'test') {
|
|
17
|
-
for (const [lineNumber, isCovered] of Object.entries(lines)) {
|
|
18
|
-
lcovFile.lines.push({
|
|
19
|
-
lineNumber: Number(lineNumber),
|
|
20
|
-
hitCount: isCovered === 1 ? 1 : 0,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else if (reportType === 'deploy') {
|
|
25
|
-
lcovFile.lines = uncoveredLines.map((lineNumber) => ({
|
|
26
|
-
lineNumber: Number(lineNumber),
|
|
27
|
-
hitCount: 0,
|
|
28
|
-
}));
|
|
29
|
-
await setCoveredLinesLcov(coveredLines, uncoveredLines, repoRoot, filePath, lcovFile);
|
|
30
|
-
}
|
|
31
|
-
this.coverageObj.files.push(lcovFile);
|
|
32
|
-
}
|
|
33
|
-
finalize() {
|
|
34
|
-
return this.coverageObj;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=lcovonlyCoverageHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lcovonlyCoverageHandler.js","sourceRoot":"","sources":["../../src/handlers/lcovonlyCoverageHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,MAAM,OAAO,mBAAmB;IACb,WAAW,CAAqB;IAEjD;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,WAAW,CACtB,QAAgB,EAChB,QAAgB,EAChB,KAA6B,EAC7B,cAAwB,EACxB,YAAsB,EACtB,QAAgB,EAChB,UAA6B;QAE7B,MAAM,QAAQ,GAAa;YACzB,UAAU,EAAE,mBAAmB,CAAC,QAAQ,CAAC;YACzC,KAAK,EAAE,EAAE;YACT,UAAU,EAAE,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM;YACvD,YAAY,EAAE,YAAY,CAAC,MAAM;SAClC,CAAC;QAEF,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;YAC1B,KAAK,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5D,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;oBAClB,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC;oBAC9B,QAAQ,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAClC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,QAAQ,CAAC,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBACnD,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC;gBAC9B,QAAQ,EAAE,CAAC;aACZ,CAAC,CAAC,CAAC;YACJ,MAAM,mBAAmB,CAAC,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACxF,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { getTotalLines } from './getTotalLines.js';
|
|
4
|
-
export async function setCoveredLinesClover(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
|
|
5
|
-
const randomLines = [];
|
|
6
|
-
const totalLines = await getTotalLines(join(repoRoot, filePath));
|
|
7
|
-
for (const coveredLine of coveredLines) {
|
|
8
|
-
if (coveredLine > totalLines) {
|
|
9
|
-
for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
|
|
10
|
-
if (!uncoveredLines.includes(randomLineNumber) &&
|
|
11
|
-
!coveredLines.includes(randomLineNumber) &&
|
|
12
|
-
!randomLines.includes(randomLineNumber)) {
|
|
13
|
-
const randomLine = {
|
|
14
|
-
'@num': randomLineNumber,
|
|
15
|
-
'@count': 1,
|
|
16
|
-
'@type': 'stmt',
|
|
17
|
-
};
|
|
18
|
-
fileObj.line.push(randomLine);
|
|
19
|
-
randomLines.push(randomLineNumber);
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
const coveredLineObj = {
|
|
26
|
-
'@num': coveredLine,
|
|
27
|
-
'@count': 1,
|
|
28
|
-
'@type': 'stmt',
|
|
29
|
-
};
|
|
30
|
-
fileObj.line.push(coveredLineObj);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=setCoveredLinesClover.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setCoveredLinesClover.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesClover.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,OAAmB;IAEnB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjE,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,MAAM,UAAU,GAAe;wBAC7B,MAAM,EAAE,gBAAgB;wBACxB,QAAQ,EAAE,CAAC;wBACX,OAAO,EAAE,MAAM;qBAChB,CAAC;oBACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAC9B,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,cAAc,GAAe;gBACjC,MAAM,EAAE,WAAW;gBACnB,QAAQ,EAAE,CAAC;gBACX,OAAO,EAAE,MAAM;aAChB,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { getTotalLines } from './getTotalLines.js';
|
|
4
|
-
export async function setCoveredLinesCobertura(coveredLines, uncoveredLines, repoRoot, filePath, classObj) {
|
|
5
|
-
const randomLines = [];
|
|
6
|
-
const totalLines = await getTotalLines(join(repoRoot, filePath));
|
|
7
|
-
for (const coveredLine of coveredLines) {
|
|
8
|
-
if (coveredLine > totalLines) {
|
|
9
|
-
for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
|
|
10
|
-
if (!uncoveredLines.includes(randomLineNumber) &&
|
|
11
|
-
!coveredLines.includes(randomLineNumber) &&
|
|
12
|
-
!randomLines.includes(randomLineNumber)) {
|
|
13
|
-
const randomLine = {
|
|
14
|
-
'@number': randomLineNumber,
|
|
15
|
-
'@hits': 1,
|
|
16
|
-
'@branch': 'false',
|
|
17
|
-
};
|
|
18
|
-
classObj.lines.line.push(randomLine);
|
|
19
|
-
randomLines.push(randomLineNumber);
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
const coveredLineObj = {
|
|
26
|
-
'@number': coveredLine,
|
|
27
|
-
'@hits': 1,
|
|
28
|
-
'@branch': 'false',
|
|
29
|
-
};
|
|
30
|
-
classObj.lines.line.push(coveredLineObj);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=setCoveredLinesCobertura.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setCoveredLinesCobertura.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesCobertura.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,QAAwB;IAExB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjE,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,MAAM,UAAU,GAAkB;wBAChC,SAAS,EAAE,gBAAgB;wBAC3B,OAAO,EAAE,CAAC;wBACV,SAAS,EAAE,OAAO;qBACnB,CAAC;oBACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACrC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,cAAc,GAAkB;gBACpC,SAAS,EAAE,WAAW;gBACtB,OAAO,EAAE,CAAC;gBACV,SAAS,EAAE,OAAO;aACnB,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { getTotalLines } from './getTotalLines.js';
|
|
4
|
-
export async function setCoveredLinesLcov(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
|
|
5
|
-
const randomLines = [];
|
|
6
|
-
const totalLines = await getTotalLines(join(repoRoot, filePath));
|
|
7
|
-
for (const coveredLine of coveredLines) {
|
|
8
|
-
if (coveredLine > totalLines) {
|
|
9
|
-
for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
|
|
10
|
-
if (!uncoveredLines.includes(randomLineNumber) &&
|
|
11
|
-
!coveredLines.includes(randomLineNumber) &&
|
|
12
|
-
!randomLines.includes(randomLineNumber)) {
|
|
13
|
-
fileObj.lines.push({ lineNumber: randomLineNumber, hitCount: 1 });
|
|
14
|
-
randomLines.push(randomLineNumber);
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
fileObj.lines.push({ lineNumber: coveredLine, hitCount: 1 });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=setCoveredLinesLcov.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setCoveredLinesLcov.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesLcov.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,OAAiB;IAEjB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjE,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,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;oBAClE,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { getTotalLines } from './getTotalLines.js';
|
|
4
|
-
export async function setCoveredLinesSonar(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
|
|
5
|
-
const randomLines = [];
|
|
6
|
-
const totalLines = await getTotalLines(join(repoRoot, filePath));
|
|
7
|
-
for (const coveredLine of coveredLines) {
|
|
8
|
-
if (coveredLine > totalLines) {
|
|
9
|
-
for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
|
|
10
|
-
if (!uncoveredLines.includes(randomLineNumber) &&
|
|
11
|
-
!coveredLines.includes(randomLineNumber) &&
|
|
12
|
-
!randomLines.includes(randomLineNumber)) {
|
|
13
|
-
fileObj.lineToCover.push({
|
|
14
|
-
'@lineNumber': randomLineNumber,
|
|
15
|
-
'@covered': 'true',
|
|
16
|
-
});
|
|
17
|
-
randomLines.push(randomLineNumber);
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
fileObj.lineToCover.push({
|
|
24
|
-
'@lineNumber': coveredLine,
|
|
25
|
-
'@covered': 'true',
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=setCoveredLinesSonar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setCoveredLinesSonar.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesSonar.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM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