forcedotcom / forcedotcom/cli

Codecoverage reports must include .cls or .trigger extensions

Open
#1,813 13 comments 3 reactions 0 assignees View on GitHub
investigating
Dominant language
No language data
Stars
571
Forks
80
Avg merge
2d 15h
Merged PRs (30d)
3

Description

### Summary

Because the keys in the coverage report do not include the file extension (.cls or .trigger), when a sandbox has a class and a trigger with the same name, only the code coverage of the class, or the trigger, is added to the code coverage report. For instance, I can create a class called Lead.cls and a trigger called Lead.trigger, which would result in a coverage.json having a single entry for `Lead` as shown below:

````json
{
"no-map/Lead":{
"fnMap":{},
"branchMap":{},
"path":"no-map/Lead",
"f":{ },
"b":{},
"s":{
"1":1,
"2":1
},
"statementMap":{
"1":{
"start":{
"line":1,
"column":0
},
"end":{
"line":1,
"column":0
}
}
}
}
}
````

cobertura.xml format has the same problem.

![image](https://user-images.githubusercontent.com/55927613/202461187-19242e48-707a-4175-b8c1-e9f7de551782.png)

### Steps To Reproduce:

1 - Create a class called `Lead`
2 - Create a trigger called `Lead`
3 - Write some apex test that covers both class and trigger
4 - run sfdx deploy validation command, but configure this command to return code coverage as a json.

use the following parameters as described in this doc: https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_deploy
````
[--resultsdir RESULTSDIR]
[--coverageformatters COVERAGEFORMATTERS]
[--junit]
````

5 - open the coverage report and verify it contains a single entry called `no-map/Lead`

### Expected result

Code coverage report must include .cls or .trigger extensions

`no-map/Lead.cls`
`no-map/Lead.trigger`

### Actual result

Code coverage report does not include .cls or .trigger extensions

`no-map/Lead`

does this code coverage report belong to a class or a trigger? we can't determine it

### System Information

bash

![image](https://user-images.githubusercontent.com/55927613/202454565-9981f5ab-0513-46b8-90db-e8883ddf2305.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.