Skip to content

Instantly share code, notes, and snippets.

@pascalw
Created January 18, 2019 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pascalw/013a6b79658bb347ad1d3a26469c2ae1 to your computer and use it in GitHub Desktop.
Save pascalw/013a6b79658bb347ad1d3a26469c2ae1 to your computer and use it in GitHub Desktop.
VSCode Elixir umbrella app tests
#!/usr/bin/env ruby
test_file = ARGV[0]
line_no_arg = ARGV[1]
parts = test_file.scan(/.*apps\/(.*?)\/(.*)/).last
app = parts[0]
test_file_relative = parts[1]
line_no = line_no_arg ? ":#{line_no_arg}" : ""
exec("cd $(git rev-parse --show-toplevel)/apps/#{app} && mix test #{test_file_relative}#{line_no}")
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run all tests",
"type": "shell",
"command": "clear; ./script/mix-test-wrapper.rb ${relativeFile}",
"problemMatcher": [
"$mixCompileError",
"$mixCompileWarning",
"$mixTestFailure"
]
},
{
"label": "Run current test",
"type": "shell",
"command": "clear; ./script/mix-test-wrapper.rb ${relativeFile} ${lineNumber}",
"problemMatcher": [
"$mixCompileError",
"$mixCompileWarning",
"$mixTestFailure"
],
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment