You have written a node.js module lately? It has a test suite? Awesome! Time
to get yourself a nerd badge of honor:
But hang on nerdy warrior, this precious award has to be earned. So go ahead and
check out the sweetness that is Travis CI. Travis is an open
source, free to use, continuous integration server. Initially it was just
building ruby stuff, but these days it supports a ton of other languages,
including node.js.
And luckily, getting travis to run your tests on every GitHub push is really
easy as well:
Step 1: Go to Travis and login/connect with your GitHub account.
Step 2: Hover over your name on the top right, and select "Profile" from the
dropdown.
Step 3: You should see all your GitHub projects. Flip the "Off" switch to
"On" for a node.js project you want to use with travis.
Step 4: Add a .travis.yml file to your project with the following:
language: node_js
node_js:
- 0.4
- 0.6
Step 5: Make sure your package.json has something like this:
"scripts": {
"test": "make test"
},
Step 6: Git push, and watch travis building your project on the home screen!
Step 7: Assuming your tests are passing, it is time to get your badge of
honor. Adding it to your GitHub Readme.md is as simple as:
[](http://travis-ci.org//)
If you want to see an example of what this looks like, and you also happen to
be in the market for some no-bullshit testing tools, check out my new libs:
That's it. And in case you are not excited enough yet, go and check out the
Travis Docs to discover additional goodies like how to work with
databases, etc.
--fg
