Mocha.js: Interfaces Cheat Sheet

Table of Contents

BDD

The BDD interface provides:

describe()

context()

it()

specify()

before()

after()

beforeEach()

afterEach()

TDD

The TDD interface provides: 

suite()

test()

suiteSetup()

suiteTeardown()

setup()

teardown()

Exports

The keys beforeafterbeforeEach, and afterEach are special-cased, object values are suites, and function values.

QUnit

he QUnit-inspired interface matches the “flat” look of QUnit, where the test suite title is simply defined before the test-cases. Like TDD, it uses suite() and test(), but resembling BDD, it also contains before()after()beforeEach(), and afterEach()

Require

The require interface allows you to require the describe and friend words directly using require and call them whatever you want. This interface is also useful if you want to avoid global variables in your tests.

Leave a Reply

Your email address will not be published. Required fields are marked *