Skip to content

Instantly share code, notes, and snippets.

@aifrak
Last active January 2, 2023 18:19
Show Gist options
  • Select an option

  • Save aifrak/d681499d5e8ebfdcb9e5ac4de5ba6a12 to your computer and use it in GitHub Desktop.

Select an option

Save aifrak/d681499d5e8ebfdcb9e5ac4de5ba6a12 to your computer and use it in GitHub Desktop.
Running tests in VSCode with Elixir and ElixirLS
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "mix_task",
"name": "mix test",
"request": "launch",
"task": "test",
"taskArgs": [
"--include" ,"pending"
],
"startApps": false,
"projectDir": "${workspaceRoot}${config:elixirLS.projectDir}",
"requireFiles": [
"test/**/test_helper.exs",
"test/**/*_test.exs"
]
},
{
"type": "mix_task",
"name": "mix test (single test)",
"request": "launch",
"task": "test",
"taskArgs": [
"--only", "test:test ${input:promptTestName}"
],
"startApps": false,
"projectDir": "${workspaceRoot}${config:elixirLS.projectDir}",
"requireFiles": [
"test/**/test_helper.exs",
"test/**/*_test.exs"
]
},
{
"type": "mix_task",
"name": "mix test current file",
"request": "launch",
"task": "test",
"taskArgs": [
"${relativeFile}"
],
"startApps": true,
"projectDir": "${workspaceRoot}",
"requireFiles": [
"test/**/test_helper.exs",
"${relativeFile}"
]
},
// Copied from: https://elixirforum.com/t/running-debugging-tests-in-vscode-with-elixirls/33837/7
{
"type": "mix_task",
"name": "mix test current line number",
"request": "launch",
"task": "test",
"taskArgs": [
"${relativeFile}:${lineNumber}"
],
"startApps": true,
"projectDir": "${workspaceRoot}",
"requireFiles": [
"test/**/test_helper.exs",
"${relativeFile}"
]
}
],
"inputs": [
{
"id": "promptTestName",
"type": "promptString",
"description": "Name of your test.",
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment