Is it possible to run a task from a task in VSCode?
Example json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"taskName": "Show In Chrome",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
"osx": {
"command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
},
"args": [
"${file}"
],
"type": "process",
},
{
"taskName": "Show Coverage",
// this is the task to call another task
}
]
}
What i would like to do is have the Show Coverage task look for a file in the coverage folder and then call Show In Chrome task to show it as the arguments of that file being passed. Is this possible?
It turns out the current config from the docs website isn't updated for tasks.
However if you want a task to call other tasks because it depends on them you can simply add this configuration
this will cause the task to run the previous task and then run whatever commands it has set as well.
Note: you can use multiple depends by using an array of identifiers.