visual studio code has a nifty, but not well documented feature: tasks.
vscode supports the notion of a task runner where you can run tasks in the IDE. as node friendly as vscode is, there isn’t very good documentation on how to setup tasks for a node-based project.
grunt and gulp are potential and popular task runners in this case, but i think that npm should be the task runner of choice for node-based projects. vscode already parses a node.js’ package.json to derive the debugger start command and npm has a facility to run commands like start and test.
a sample vscode task runner configuration for a node project would look like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
{ "command": "npm", "tasks": [ { "taskName": "test", "isTestCommand": true, "showOutput": "always" }, { "taskName": "install", "isBuildCommand": true, "showOutput": "always" } ] } |