Running tests in VSCode

While we’re looking forward to the release of encore’s VS Code extension :smiley:, there is a simple trick to make tests runnable from the “Testing” pane using plain Go for VS Code extension.
As it is possible to set “Alternate Tools” for the Go extension and encore test has the same syntax as go test all you need is to create a simple script a script that passes the test command to encore and the rest to go binary:


if [ $1 = 'test' ]
    encore $@
    go $@

and use it in your settings.json:

"go.alternateTools": {
    "go": "~/"

Alas, I haven’t yet found the right hack to debug them, has anyone?


Thank you for sharing this!

Has anyone had success with this? Using the latest version of VSCode, I’m seeing no change to the ‘run on save’ or the inline ‘run test’ command after setting this. It still seems to use the default tools.

There is one additional step to make it work properly. The mentioned bash script has to be executable for your user, otherwise VSCode will ignore it.

Simply run chmod 744 ~/