Qunit

A quick reference for the QUnit testing library in JavaScript.

A cheatsheet by @rstacruz|Refreshed 7 months ago.Refresh|View source on Github
QUnit.module('a')
QUnit.test('ok', function (t) {
  /* ... */
})

Hooks

Hooks

Each test

// each test
QUnit.testStart(function)
QUnit.testEnd(function)
// each module
QUnit.moduleStart(function)
QUnit.moduleEnd(function)
// all
QUnit.begin(function)
QUnit.done(function)

Assertions

Assertions

t.equal(actual, expected)
t.deepEqual(actual, expected)
t.strictEqual(actual, expected)
t.propEqual(actual, expected)
t.notEqual(actual, expected)
t.expect(amount)