Skip to content

Instantly share code, notes, and snippets.

@spikeheap
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save spikeheap/36140b1015a4b364826c to your computer and use it in GitHub Desktop.

Select an option

Save spikeheap/36140b1015a4b364826c to your computer and use it in GitHub Desktop.
Code Retreat cheat sheet

The cheat sheets in this Gist are for the Oxford Code Retreat on the 6/7/2014.

Prerequisites

  • A relatively up-to-date installation of nodejs
  • NPM package manager (bundled with newer versions of nodejs)

Getting set up

Grab the client with npm install -g coderetreat

Starting a session

Tests and code live in the same file. To get started you might use the following template:

describe("numbers", function () {
  it("should be themselves", function () {
    (getANumber()).should.be.exactly(12);
  }
}

function getANumber(){
  return 12;
}

Running tests

Run cr path/to/my/session.js. The client will watch the file for changes and print the results to the terminal. When your tests fail the details will also be printed.

Writing tests

We're using mocha and should.js, and these are included by default in your environment so you can just start hacking.

Check out the should.js page for examples of how to construct assertions.

Coming soon

Coming soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment