Releases: rluba/hamjest
v4.1.0
v4.0.1
v4.0.0: Removal of Bluebird
This release removes Bluebird
as a dependency.
This is a breaking change because all promise-returning functions (like promiseThat
) now return native Promise
instances instead of Bluebird
instances. The former lack some utility functions like .finally()
, .spread()
, and .nodeify()
.
v3.5.0: Type fixes & simpler TypeSafeMatcher / Matcher generation
- Fixed a few minor errors in yesterday’s TypeScript type definitions.
- Added constructors to
Matcher
andTypeSafeMatcher
that allow you to specify the functions that you need to override. This lets you create custom matchers with stronger typing:
return new __.TypeSafeMatcher({
isExpectedType(value) {
return _.isString(value);
},
matchesSafely(value: string) {
return value === 'something';
},
describeTo(description: __.Description) {
description.append('a very special string');
},
describeMismatchSafely(value: string, description: __.Description) {
description.append('was ').appendValue(value).append(' instead of "something");
},
});
v3.4.0: Typescript type definitions
This release contains Typescript type definitions thanks to @webpapaya’s pull request. Much appreciated! 🙇♂️
v3.2.5
v3.2.0
v3.1.0
Just a single change:
v3.0.0
Hamjest 3.0 brings several minor breaking changes compared to Hamjest 2.x – see the list in the readme for details.
Improvements
- Much better mismatch descriptions!
- Support for indentation when building nested messages. Many matchers use this to better format their sub-matcher’s error descriptions.
- Custom formatting for DOM nodes (and DOM-like objects) in mismatch descriptions to make assertion errors involving the DOM easier to read and understand.
hasProperty
andhasProperties
now have a verbose mode – enabled with__.hasProperties({…}).verbose()
– that appends a description of the whole object after the mismatch description. Useful for debugging failing tests that receive totally unexpected object types.
- New matchers
inRange
hasExactlyOneItem
- New alias
empty
forisEmpty
to improve grammar in some use cases:__.promiseThat(promisedArray, __.willBe(__.empty()))
- Switched from Q to Bluebird for faster tests and better sugar methods.
v2.13.0
New matchers
-
returns(matcherOrValue)
can be used to test the return value of getter-style functions (#10) -
typedError(type, messageMatcherOrValue)
simplifies testing that your functions throw the right errors (#14):__.assertThat(myFunction, __.throws(__.typedError(RangeError, 'value out of range')));
New meta-matchers
matches(value)
, failsToMatch(value, mismatchDescriptionMatcherOrValue)
and
hasDescription(matcherOrValue)
simplify testing your matchers:
__. assertThat(__.containsString('value'), __.matches('some value'));
__. assertThat(__.containsString('value'), __.hasDescription('a string containing "value"'));
__. assertThat(__.containsString('value'), __.failsToMatch('something else', 'was "something else"'));
Misc
Description#appendDescriptionOf(…)
now supports simple valuesTypeSafeMatcher
describes type mismatches slightly differently to be consistent withinstanceOf