Skip to content

Instantly share code, notes, and snippets.

View shane-reaume's full-sized avatar

Shane Reaume shane-reaume

View GitHub Profile
@shane-reaume
shane-reaume / mocha-guide-to-testing.js
Last active September 23, 2016 17:51 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()