Integrating Jenkins with Github, Node.js and Slack
Rahul
888

Nice read! I’ve always preferred Travis over Jenkins but some companies are stuck with the latter so this kind of article really is necessary.

I noticed a minor improvement though: when accessing the mocha command, instead of going within node_modules/mocha/bin/mocha, npm automatically creates a symlink to the package binaries under node_modules/.bin/. This works for any binary declared in package.json#bin. Moreover, these binaries are automatically populated in npm script commands (npm run <command>), thus, instead of running node_modules/mocha/bin/mocha directly from the command line, you can add an extra script command in package.json#scripts (eg: test) and run this command from the command line. This benefits both Jenkins and developer since it is now versioned, can be used in any environment and does not have to be remembered by the developer. Example:

package.json

{ 
...
"scripts": {
"start": "node app.js",
"test": "mocha"
}
...
}