- Improves documentation around
NaN
s.
Thanks, Jacek Nowacki! - Adds another TypeScript type signature.
Thanks, Kevin Turner, Theodoros Klikas and Chris Gedrim! - Makes the
length
assertion pass the actual length to the test runner for nicer diff messages.
Thanks Hasina Herintsoa
- Tweaks
Must.prototype.be
et al. implementation to preventsource-map-support
from throwing an exception during call stack retrieval. This only happened if that module was used with Must.js for source map support.
- Adds a first draft of TypeScript definitions.
Thanks, Karl Purkhardt! - Serialize
NaN
s in objects in error messages as"[NaN]"
.
- Fixes stringifying
Symbol
s for assertion errors. - Stringifies
RegExp
s nested in objects for assertion errors. - Adds
symbol
. - Adds
properties
. - Adds
ownProperties
. - Adds preliminary support for running under strict mode (
"use strict"
).
Assertion error stack traces will contain one Must.js function at the top at the moment. This will be fixed!
- Adds custom error message to
Must
.
- Lucky version. No changes since the previous release candidate.
-
Refactors
eql
to internally use Egal.js, which was extracted from Must.js.Must.js augments
egal
to continue to allow you to assert equivalence toNaN
s and instances of classes that aren't value objects. Egal.js doesn't compare those out of the box as they're not things you want to do in production code.With the transition to Egal.js,
eql
now also supports value objects that return compound values. See Egal.js's README for details.
- Fixes the stack trace when using promises with some particular matchers.
-
Adds
must
that returns self for those of us who sometimes write it twice:demand(undefined).must.be.undefined()
-
Fixes a false positive in
eql
when an object had some keys set toundefined
. -
Adds
the
for a fluent chain. -
Changes
boolean
to not consider boxed boolean objects as booleans. -
Changes
number
to not consider boxed number objects as numbers. -
Changes
string
to not consider boxed string objects as strings. -
Changes
true
andfalse
to not consider boxed boolean objects as either true or false. -
Adds
resolve
andreject
for asserting on promises.
The former is also aliased tothen
and [eventually
] for different language styles.With Mocha, using this will look something like:
it("must pass", function() { return Promise.resolve(42).must.resolve.to.equal(42) })
Using CoMocha, it'll look like:
it("must pass", function*() { yield Promise.resolve(42).must.resolve.to.equal(42) yield Promise.resolve(42).must.then.equal(42) yield Promise.reject(42).must.reject.and.equal(42) })
-
Adds
with
for a fluent chain. -
Adds
error
to assert on errors.
Similar tothrow
, but useful for when you already have an error at hand. -
Adds
startWith
. -
Adds
endWith
. -
Adds
nan
to testNaN
.
- Adds
permutationOf
to assert that two arrays contain the same elements. Thanks, Miroslav Bajtoš!
- Works on other JavaScript engines besides V8 by not assuming
Error.captureStackTrace
. Thanks, Dmitry Starostin!
- Allows asserting
NaN
s witheql
—NaN.must.eql(NaN)
.
- Fixes
eql
to consider two equivalent boxedBoolean
,Number
orString
values eql.
Previously it only did so if both were primitive (42
) or only one was boxed (new Number(42)
).
- Adds
between
to assert that a value is between a range.
- Allows asserting and comparing circular and self-referential objects with
eql
. Objects that are self-referential in the exact same way are considered eql. - Displays circular and self-referential objects and arrays in assertion error messages properly.
- Displays object's inherited properties in assertion error messages.
-
Adds
before
as an alias ofbelow
to make comparing dates read more natural:new Date(2000, 5, 18).must.be.before(new Date(2001, 0, 1))
-
Adds
after
as an alias ofabove
to make comparing dates read more natural:new Date(2030, 5, 18).must.be.after(new Date(2013, 9, 23))
-
Allows asserting both the exception constructor and its message together in the
throw
matcher:someFunction.must.throw(RangeError, /out of bounds/)
- Sets the
eql
matcher'sAssertionError
diffable so some test runners would print out a property-by-property diff for mismatches. This helps visual comparison.
- Changes
eql
so it also compares instances of the same class recursively like it does with plain objects.
If the instance has avalueOf
function, however, its output is used as before.
- Allows asserting
property
andownProperty
on all types (such as functions, booleans etc.), not only objects. - Allows asserting
keys
andownKeys
on all types (such as functions, booleans etc.), not only objects. - Allows asserting
enumerable
andnonenumerable
properties on all types (such as functions, booleans etc.), not only objects.
- Fails gracefully if property matchers (
property
,enumerable
etc.) are used on non-objects. - Adds the
keys
matcher to test if an object has all the expected keys.
Takes inherited keys into account just like theempty
andproperty
matchers. - Adds the
ownKeys
matcher to test if an object has all the expected keys of its own.
- Fixes Must.js's own tests on Windows thanks to [Bart van der Schoor][bartvds]. [bartvds]: https://github.com/Bartvds
- First release. Must-have!