Last active
November 21, 2022 09:06
-
-
Save whazzmaster/b9071c2706cc588293a73ec3b6613d20 to your computer and use it in GitHub Desktop.
Test tasks for Visual Studio Code and Elixir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "cmd+t cmd+t", | |
"command": "workbench.action.tasks.runTask", | |
"args": "Run All Tests" | |
}, | |
{ | |
"key": "f5", | |
"command": "workbench.action.tasks.runTask", | |
"args": "Run Focused Test" | |
}, | |
{ | |
"key": "f4", | |
"command": "workbench.action.tasks.runTask", | |
"args": "Set Focused Test" | |
}, | |
{ | |
"key": "f6", | |
"command": "workbench.action.tasks.runTask", | |
"args": "Debug Focused Test" | |
}, | |
{ | |
"key": "cmd+t cmd+f", | |
"command": "workbench.action.tasks.runTask", | |
"args": "Test Current File" | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [{ | |
"label": "Build", | |
"command": "mix", | |
"group": "build", | |
"args": [ | |
"compile" | |
], | |
"problemMatcher": [ | |
"$mixCompileError", | |
"$mixCompileWarning" | |
], | |
"presentation": { | |
"echo": true, | |
"reveal": "always", | |
"focus": false, | |
"panel": "shared" | |
} | |
}, | |
{ | |
"label": "Run All Tests", | |
"command": "mix test", | |
"type": "shell", | |
"group": "test", | |
"problemMatcher": [ | |
"$mixCompileError", | |
"$mixCompileWarning", | |
"$mixTestFailure" | |
], | |
"presentation": { | |
"echo": true, | |
"reveal": "always", | |
"focus": false, | |
"panel": "shared" | |
} | |
}, | |
{ | |
"label": "Set Focused Test", | |
"group": "test", | |
"type": "shell", | |
"command": "echo -n ${relativeFile}:${lineNumber} > ${workspaceRoot}/.vscode/TEST_FOCUS", | |
"presentation": { | |
"echo": true, | |
"reveal": "always", | |
"focus": false, | |
"panel": "shared" | |
} | |
}, | |
{ | |
"label": "Clear Focused Test", | |
"group": "test", | |
"type": "shell", | |
"command": "rm ${workspaceRoot}/.vscode/TEST_FOCUS", | |
"presentation": { | |
"echo": true, | |
"reveal": "never", | |
"focus": false, | |
"panel": "shared" | |
} | |
}, | |
{ | |
"label": "Run Focused Test", | |
"command": "mix test $(cat ${workspaceRoot}/.vscode/TEST_FOCUS)", | |
"type": "shell", | |
"group": "test", | |
"problemMatcher": [ | |
"$mixCompileError", | |
"$mixCompileWarning", | |
"$mixTestFailure" | |
], | |
"presentation": { | |
"echo": true, | |
"reveal": "always", | |
"focus": false, | |
"panel": "shared" | |
} | |
}, | |
{ | |
"label": "Debug Focused Test", | |
"command": "iex -S mix test $(cat ${workspaceRoot}/.vscode/TEST_FOCUS)", | |
"type": "shell", | |
"group": "test", | |
"problemMatcher": [ | |
"$mixCompileError", | |
"$mixCompileWarning", | |
"$mixTestFailure" | |
], | |
"presentation": { | |
"echo": true, | |
"reveal": "always", | |
"focus": true, | |
"panel": "new" | |
} | |
}, | |
{ | |
"label": "Test Current File", | |
"command": "mix test ${relativeFile}", | |
"group": "test", | |
"type": "shell", | |
"problemMatcher": [ | |
"$mixCompileError", | |
"$mixCompileWarning", | |
"$mixTestFailure" | |
], | |
"presentation": { | |
"echo": true, | |
"reveal": "always", | |
"focus": false, | |
"panel": "shared" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Great compilation of tasks, I've found this snippet super useful :-)
By the way, do you where the references
$mixCompileError
, etc. come from? I can't seem to track them down and VS Code doesn't like them - it says:Error: Invalid problemMatcher reference: $mixCompileError
.I did check the official
vscode-elixir
repository out: https://github.com/fr1zle/vscode-elixir#problem-reporting, but it doesn't give any context on where they come from, so I'm not really sure how to make it work.