Skip to content

Instantly share code, notes, and snippets.

@forest
Created August 13, 2018 17:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forest/2f94cbe8d546a481aa6571e7ea0dbef9 to your computer and use it in GitHub Desktop.
Save forest/2f94cbe8d546a481aa6571e7ea0dbef9 to your computer and use it in GitHub Desktop.
Running Elixir Tests in Visual Studio Code/ElixirLS
{
"key": "alt+t",
"command": "workbench.action.tasks.runTask",
"args": "mix test"
}
{
"version": "2.0.0",
"tasks": [
{
"label": "mix test",
"type": "shell",
"command": "mix",
"args": ["test", "--color", "--trace"],
"options": {
"cwd": "${workspaceRoot}",
"requireFiles": [
"test/**/test_helper.exs",
"test/**/*_test.exs"
]
},
"problemMatcher": "$mixTestFailure"
},
{
"label": "mix test file",
"type": "shell",
"command": "mix",
"args": [
"test",
"${relativeFile}",
"--color",
"--trace"
],
"options": {
"cwd": "${workspaceRoot}",
"requireFiles": [
"test/**/test_helper.exs",
"test/**/*_test.exs"
]
},
"problemMatcher": "$mixTestFailure"
},
{
"label": "mix test focused",
"type": "shell",
"command": "mix",
"args": [
"test",
"${relativeFile}:${lineNumber}",
"--color",
"--trace"
],
"options": {
"cwd": "${workspaceRoot}",
"requireFiles": [
"test/**/test_helper.exs",
"test/**/*_test.exs"
]
},
"problemMatcher": "$mixTestFailure"
},
]
}
@sygour
Copy link

sygour commented Aug 16, 2022

To enable "rerun last task" command, you can add this to tasks:

"runOptions": {
  "reevaluateOnRerun": false
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment