Assertions

To define additional assertion methods, refer to the QUnit.assert extension page.

Some of these methods are comparable to the assert methods one might find in xUnit-style frameworks such as SUnit, JUnit, RUnit, or PHPUnit.

assert.async()

Instruct QUnit to wait for an asynchronous operation.

assert.closeTo()

Compare that a number is equal within a given tolerance.

assert.deepEqual()

A recursive and strict comparison.

assert.equal()

A non-strict comparison.

assert.expect()

Specify how many assertions are expected in a test.

assert.false()

A strict boolean false comparison.

assert.notDeepEqual()

An inverted deep equal comparison.

assert.notEqual()

A loose inequality comparison.

assert.notOk()

Check if the first argument is falsy.

assert.notPropContains()

Check that an object does not contain certain properties.

assert.notPropEqual()

Compare an object's own properties for inequality.

assert.notStrictEqual()

A strict comparison, checking for inequality.

assert.ok()

Check if the first argument is truthy.

assert.propContains()

Check that an object contains certain properties.

assert.propEqual()

Compare an object's own properties.

assert.pushResult()

Report the result of a custom assertion.

assert.rejects()

Test if the provided promise rejects.

assert.step()

Record a step for later verification.

assert.strictEqual()

A strict type and value comparison.

assert.throws()

Test if a callback throws an exception.

assert.timeout()

How long to wait for async operations.

assert.true()

A strict boolean true comparison.

assert.verifySteps()

Verify the exact order of steps.