TDD (Test Driven Development)

Session 13-01-2015

Yesterday we had another amazing session, this compac lessons help me to keep focused, motivated and excited. Sometimes a little overwhelmed
but nothing that a person can not do step by step with a little research later 🙂

We started and focused our session on the Test side of the code.

TDD (Test Driven Development)

For that we tried to use a collaborative tool called JSBIN but after some time we saw it wasn’t working as expected so we passed to the sharing screen feature on Hangout.

For the testing we used the Mocha Framework with the Expect.js that is really intuitive as saw on the example code created by AirCrewMentor.

var salute = require("./lib/salute.js"),
expect = require("expect.js");

describe("When using the salute function, it:", function () {

it("should say 'hello world'", function () {

expect(salute("hello world"))"hello world");


it("should say 'hola mundo'", function () {

expect(salute("hola mundo"))"hola mundo");


it("should say 'Hello!' by default", function () {


To install it we went with the prompt to the desired directory and run the following command npm install mocha expect.js --save-dev

this updated as well the package.json file with the following code:

"name": "mortgage-calculator",
"version": "0.0.1",
"description": "Mortgage Calculator library",
"main": "test.js",
"private": true,
"scripts": {
"test": "./node_modules/.bin/mocha test.js"
"repository": {
"type": "git",
"url": ""
"author": "AirCrew",
"license": "MIT",
"devDependencies": {
"expect.js": "0.3.1",
"mocha": "2.1.0"

Not really sure what all that specs mean (research mode:on), with the exception that the devDependencies were with the indicator that were allowed the versions specified and higher versions, but AirCrewMentor removed them because he wanted to work with an specific versions and the 'private': true that I understood that it kept this file not synced to git, but not sure.

After that we saw how the test were failing and fixing them on the go, since with the prompt and the command mocha [file] --watch side by side Sublime and the Terminal was a cool way of doing testing, we didn’t need to save to see the result. Really powerful.

In the middle of our session it came the subject about PATH, but we had to focus on the test (added to research task).

I did research on it and the DOTFILES because they are really attached, so really soon I’ll do some personalization on my own, I found this tutorial that I think it is a good point to start with my dotfiles sync at Git.

Goals for next session

  • Stablish test with Mocha for our little project “Cuanto me puedo gastar”

Optional goals

  • Start with the dofiles personalization. (by the way, it would be cool if you update yours on git, sure you changed a lot of things since 2011 😀 )

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s