Test-Driven Node.js Development with Grunt.

Mark Dalgleish
@markdalgleish

Let's create a simple Node.js module

  • Generate and test-drive a module using Grunt
  • Push it to GitHub
  • Set up continuous testing with Travis CI
  • Publish to npm

What is this Grunt thing?

$ npm install -g grunt
  • JavaScript build tool.
  • Emphasises use of re-usable plugins
  • Comes with JSHint, QUnit, Nodeunit
  • Inludes an 'init' task for scaffolding

Mind the scaffolding

Get up and running quickly with the built-in set of templates:

$ grunt init:node
$ grunt init:jquery
$ grunt init:commonjs
$ grunt init:gruntfile

Naming it is the hardest part

'Palindrode', detects if a string is a palindrome ("level", "madam", "A Toyota's a Toyota")

$ mkdir palindrode
$ cd palindrode
$ grunt init:node

Enough slides...

Can we see how it works?

Further reading.

Grunt: gruntjs.com
Article: markdalgleish.com
Short URL: bit.ly/tddgrunt