Author: Kavit

mochajs 0

Debug mocha using visual studio code

Add the fol­low­ing con­fig­u­ra­tion in your launch.json { “name”: “Run mocha”, “type”: “node”, “request”: “launch”, “pro­gram”: “${workspaceRoot}/node_modules/mocha/bin/mocha”, “sto­pO­nEn­try”: false, “args”: [ “test/**/*.js”, “–inspect”, “–debug-brk”, “–no-timeouts” ], “cwd”: “${work­space­Root}”, “run­time­Ex­e­cutable”: null, “env”: { “NODE_ENV”: “testing”…

node 0

How to run cli/unix commands from nodejs scripts?

There are two ways to do this: child_process.exec(command[, options][, call­back]) // ls.js const { exec } = require(‘child_process’); exec(‘ls –lh /usr’, (error, std­out, stderr) => { if (error) { console.error(‘exec error: ${error}‘); return; } console.log(‘stdout:…