I have seen that it is possible to define a task in the VSCode. But I am not sure how to define multiple tasks in the tasks.json
file.
On the Tools menu, choose Options. Open the Environment folder and then choose Task List.
Just in case it helps someone... . If you don't have/want gulp/grunt/etc... or an extra shell script to proxy out your task commands , "npm run" is there already .
this is for webpack and mocha as in "Build and Test" , Shift+Ctrl+B, Shift+Ctrl+T
.vscode/tasks.json:
{ "name": "npmTask", //... "suppressTaskName": true, "command": "npm", "isShellCommand": true, "args": [ "run" ], "tasks": [ { //Build Task "taskName": "webpack", //Run On Shift+Ctrl+B "isBuildCommand": true, //Don't run when Shift+Ctrl+T "isTestCommand": false, // Show the output window if error any "showOutput": "silent", //Npm Task Name "args": [ "webpack" ], // use 2 regex: // 1st the file, then the problem "problemMatcher": { "owner": "webpack", "severity": "error", "fileLocation": "relative", "pattern": [ { "regexp": "ERROR in (.*)", "file": 1 }, { "regexp": "\\((\\d+),(\\d+)\\):(.*)", "line": 1, "column": 2, "message": 3 } ] } }, { //Test Task "taskName": "mocha", // Don't run on Shift+Ctrl+B "isBuildCommand": false, // Run on Shift+Ctrl+T "isTestCommand": true, "showOutput": "always", "args": [ "mocha" ] } ] }
package.json:
{ ... "scripts": { "webpack": "webpack", "mocha": "/usr/bin/mocha" }, ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With