1

I am learning Salesforce Apex development by taking a trailhead tutorial.

Tutorial: Find and Fix Bugs with Apex Replay Debugger

I followed the tutorial along and got the following error when I try to call "SFDX: Run Apex Tests" in Visual Studio Code.

Command 'SFDX: Run Apex Tests' resulted in an error (command 'sfdx.force.apex.test.run' not found)

enter image description here

enter image description here

I am able to run the tests in a terminal by the way.

enter image description here

Does anyone know how to fix this error? Thanks in advance.

My environment:

  • MacBook Pro (13-inch, M1, 2020)
  • OS: macOS Big Sur
  • Virtual Studio Code Version: 1.62.3
2
  • Did you let the sfdx extensions load? It can take 30-60 seconds after opening a project folder. After all extensions load, it should normally work.
    – sfdcfox
    Dec 2, 2021 at 1:48
  • @sfdcfox I suspect that sfdx extensions do not install or load properly. But for your questions, the "run test command" does not work after waiting for more than 5 min.
    – Xin
    Dec 2, 2021 at 2:24

1 Answer 1

1

Let me answer my own question.

Everything works fine after I added Java home setting in setting.json of VS Code.

"salesforcedx-vscode-apex.java.home": "/opt/homebrew/Cellar/openjdk@11/11.0.12/libexec/openjdk.jdk/Contents/Home",

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .