I used to run Apex tests using sfdx force:apex:test:run -r human -c command and everything was fine. But after I've created another scratch org this command no longer produces any result, it just hangs. At the same time if I go to Developer Console, I can see, that the test run was actually started and successfully finished. Are there any issues with Salesforce, my dev hub or scratch org?

UPD: These are the three latest records in the log

{ "name": "sfdx", "hostname": "<my host>", "pid": 16112, "level": 40, "msg": "[ '\\u001b[33mWARNING:\\u001b[39m',\n 'In salesforcedx v41 and earlier, the --resultformat parameter caused the apex:test:run command to wait for test results rather than finishing immediately and returning a test run ID. In salesforcedx v42 and later, the --resultformat parameter will no longer cause the command to wait. To wait for test results, include the --wait parameter.' ]", "time": "2018-11-13T04:37:25.817Z", "v": 0 }{ "name": "sfdx", "hostname": "<my host>", "pid": 14356, "log": "SourceUtil", "level": 40, "msg": "Could not delete the outputDir 'C:\\Users\\<my user>\\AppData\\Local\\Temp\\sdx_decomposition_1542085385437' due to: ENOENT: no such file or directory, stat 'C:\\Users\\<my user>\\AppData\\Local\\Temp\\sdx_decomposition_1542085385437.zip'", "time": "2018-11-13T05:03:05.458Z", "v": 0 }{ "name": "sfdx", "hostname": "<my host>", "pid": 14356, "log": "SourceUtil", "level": 40, "msg": "Could not delete the outputDir 'C:\\Users\\<my user>\\AppData\\Local\\Temp\\sdx_mdpkg_1542085385434' due to: ENOTDIR: not a directory, scandir 'C:\\Users\\<my user>\\AppData\\Local\\Temp\\sdx_mdpkg_1542085385434.zip'", "time": "2018-11-13T05:03:08.100Z", "v": 0 }

  • You'll want to check your logs in c:\users\your-name\.sfdx\sfdx.log and see if you find any errors.
    – sfdcfox
    Nov 13, 2018 at 4:52
  • Added the three log items that go right after run test command
    – Demarsch
    Nov 13, 2018 at 5:08
  • Seems the logs are pretty clear on the reason??
    – Eric
    Nov 13, 2018 at 6:06
  • Well, it seems that it actually finishes in 10 minutes or so, even though I can see the results of the test run in Developer Console in seconds after start. Also even they are pretty clear, it is unclear how to avoid it
    – Demarsch
    Nov 13, 2018 at 6:16

1 Answer 1


Could your problem be related to https://success.salesforce.com/answers?id=9063A000000t5onQAA

"What has changed with the sfdx force:apex:test:run command since November 8th 2018 sfdx force:apex:test:run has a --wait argument which defaults to 6 minutes

This has always been interpreted as "if the command doesn't return within this time limit, then TIMEOUT"

Since November 8th/9th, it appears the command waits for the default 6 minutes before running the tests."

I've since discovered the tests actually run on time. But the sfdx test command waits for the full duration of the --WAIT argument before returning the results.

This has been recognised as a bug by Salesforce, and is currently being worked on. There is no known workaround. There is no estimated time for a fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.