Comments (7)
Hi @amtrack,
I spoke to my team today and received confirmation that this is working as designed. I spent some time to study the code and run tests on it in dreamhouse-lwc - thank you for pointing me to the getAggregateCodeCoverage()
function - and discovered this is not an easy fix. This is how the code coverage currently works:
After the Apex test run completes, the results are passed into formatAsyncResults()
in asyncTests.ts
. If you ran the tests with the --code-coverage
flag, the check in Line 258 is True, and the code for formatting code coverage is run. If you run the Apex tests with the "Store Only Aggregated Code Coverage" box checked in the Apex Test Execution page, the perClassCovMap
is set to an empty map, which means coveredApexClassIdSet
is an empty set, as the values are populated to coveredApexClassIdSet
during the calculation of per class code coverage. coveredApexClassIdSet
is passed as parameter into getAggregateCodeCoverage()
. In Line 107, we have the if (apexClassIdSet.size === 0) {
validation, which returns empty code coverage results if apexClassIdSet
is empty, which is True in this case. That's why the "Apex Code Coverage by Class" section of the Apex test results doesn't have a table.
The Apex classes listed in the "Apex Code Coverage by Class" table are the classes that are covered by the Apex tests in the current test run. That set is identified by the calculation of per class code coverage and cannot be inferred otherwise from the Apex test run. One alternative is to list all Apex classes present in the org in that table, since the "Store Only Aggregated Code Coverage" setting is designed to be used for large test runs, which often refers to all the Apex test classes in a given org. However, that would limit the results from when that setting is checked to only make sense in one use case.
Our team does agree that while the feature is working as originally designed, it's not intuitive, and thus we are currently investigating this issue to understand the alternatives for displaying useful information in the "Apex Code Coverage by Class" table. In the meantime, please continue to use your workaround, and we will keep you updated with our findings. Thank you for your patience.
from salesforcedx-vscode.
This issue has been linked to a new work item: W-15783639
from salesforcedx-vscode.
Hi @amtrack, Thank you for filing this issue. Yes, this is a bug, and I was able to reproduce it in my environment with a large project containing 4000 Apex classes and 4000 Apex test classes and the dreamhouse-lwc sample project. As my team member @peternhale responded to your previous issue, we have work in our backlog for handling large Apex test runs, and we will work on this bug as part of that effort.
Thank you for your patience. We'll keep you updated when we have more progress on resolving your issue.
from salesforcedx-vscode.
@daphne-sfdc Just to double-check, this ticket here isn't related to large codebases, it is only related to the Test Execution setting "Store Only Aggregated Code Coverage".
The reproduction has only 2 ApexClasses, 1 is a test class.
I think this could be a quick fix.
10:41:26.843] DEBUG (sf:elapsedTime): CodeCoverage.getAggregateCodeCoverage - enter
[10:41:26.843] DEBUG (sf:elapsedTime): CodeCoverage.getAggregateCodeCoverage - exit
elapsedTime: 0.176333
Maybe the getAggregateCodeCoverage
is called without apex class ids and returns immediately with an empty response: https://github.com/forcedotcom/salesforcedx-apex/blob/b3ede186ad57af393ef2d200bdadaebe2ada3c84/src/tests/codeCoverage.ts#L102
from salesforcedx-vscode.
Related Issues (20)
- Very slow
- The test class runs very slowly HOT 6
- Error when the command npm i @salesforce/lwc-dev-server HOT 3
- LWC LightningComponentBundle is not working for target in vs code HOT 13
- SFDX retrieve /deploy commands failing with run after installing latest CLI version and VS Code Extension HOT 18
- UI not matching CLI HOT 9
- Not getting Autocomplete of Aura Component HOT 12
- Sandbox authentication from vs code HOT 6
- Important Update: Changes to our deprecation plans
- Retrieve source results are two times bigger because of "xml" shifted to next line (see picture inside) HOT 5
- When using Rename Symbol (F2) with variable that contains number "sumOfLast3Months" only "Months" is shown in rename field. HOT 3
- `sf apex get test` throws heap out of memory HOT 6
- Error when installing plugin -- @oclif/[email protected]: Package no longer supported. HOT 5
- VF Language Server - textDocument/documentHighlight failed HOT 8
- Error: The string "" is not a valid JSON string HOT 2
- Org Browser - Incorrectly loading standard salesforce Custom Applications HOT 2
- Internal error wit Replay Debugger HOT 3
- `<style>` tag breaks VF Language Server HOT 1
- Debug test(s) failed to run HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from salesforcedx-vscode.