Get Improved Code Coverage Results for Your Apex Tests
Where: This change applies to Lightning Experience, Salesforce Classic, and all versions of the Salesforce app in all editions.
How: The code coverage results are now scoped to the tests in a given test run. For example, if you run TestClassA and TestClassB, and TestClassA executes code only in ClassA and TestClassB executes only ClassB. The code coverage result for the first run includes only ClassA, and the second run includes only ClassB.
To enable this new behavior, set the environment variable SFDX_IMPROVED_CODE_COVERAGE to true. When you run the force:apex:test:run and force:apex:test:report CLI commands after enabling the new behavior, you’ll notice changes in your code coverage numbers. The new numbers reflect a more accurate code coverage result.