.equal(actual, expected, [message])
Asserts non-strict equality (==
) of actual
and expected
.
should.equal(3, '3', '== coerces values to strings');
Asserts non-strict equality (==
) of actual
and expected
.
should.equal(3, '3', '== coerces values to strings');
Asserts that function
will throw an error that is an instance of
constructor
, or alternately that it will throw an error with message
matching regexp
.
should.throw(fn, 'function throws a reference error');
should.throw(fn, /function throws a reference error/);
should.throw(fn, ReferenceError);
should.throw(fn, ReferenceError, 'function throws a reference error');
should.throw(fn, ReferenceError, /function throws a reference error/);
Asserts that the target is neither null
nor undefined
.
var foo = 'hi';
should.exist(foo, 'foo exists');
Asserts non-strict inequality (!=
) of actual
and expected
.
should.not.equal(3, 4, 'these numbers are not equal');
Asserts that function
will not throw an error that is an instance of
constructor
, or alternately that it will not throw an error with message
matching regexp
.
should.not.throw(fn, Error, 'function does not throw');
Asserts that the target is neither null
nor undefined
.
var bar = null;
should.not.exist(bar, 'bar does not exist');
Throw a failure.