I'm writing an Apex trigger and testing it against a Salesforce developer instance. I've been writing the code in VS Code, and deploying by running sf deploy
.
When I run sf deploy
the Test results summary tells me that all the tests are passing, but that the deployer "Salesforce Apps" exited with code 1.
I then visit "Setup > Platform Tools > Environments > Deploy > Deployment Status" and can see that the deployment failed because code coverage is only at 68%. But I can't find out where to see the detailed code-coverage report, either in VScode, through the Salesforce CLI or in the web interface.
Things I've tried without success include:
- Running
sfdx force:apex:test:run –-code-coverage –-result-format human
- it says this comment is deprecated in favour ofapex run test
. - Looking in "Setup > Platform Tools > Custom Code > Apex Test Execution" - this only shows the available classes from the last time the deploy was successful, so doesn't include code I've added since then.
- Running
sf apex run test --code-coverage
- this also only contains code from the last successful deploy, rather than the most recent code. This is true whatever value I use the--test-level
option.
I think I might be missing something in my setup, but I can't work out what it is.