Releases: fiverr/passable
Releases · fiverr/passable
7.5.2
7.5.0
7.4.0
Allow Failing With Rejection Message On Async Tests
Rejecting with rejection message
What if your promise can reject with different messages? No problem!
You can reject the promise with your own message by passing it to the
rejection callback.
Notice that when using rejection messages we do not need to pass statement
argument to test
. This means that the statement will always be inferred
from the rejection message.
In case you do pass statement
, it will serve as a fallback message in any
case that the rejection message is not provided.
test('name', new Promise((resolve, reject) => {
fetch(`/checkUsername?name=${name}`)
.then(res => res.json)
.then(data => {
if (data.status === 'fail') {
reject(data.message); // rejects with message and marks the test as failing
} else {
resolve(); // completes. doesn't mark the test as failing
}
});
}));
7.2.0 - Add isEven and isOdd rules
[Patch] Update dev deps
7.1.1
7.1.0
7.0.0
[7.0.0] - 2019-06-11
Changed
- [Major] Lowercased library name when imported on global object.
- [Major] Renamed
validationErrors
andvalidationWarnings
output properties toerrors
andwarnings
. - [Patch] Guarantee that
.done()
callbacks only run once.
Added
- [Minor]
.after()
callback that can run after a specific field finished execution. - [Minor] New size rules (
lessThan
,greaterThan
,lessThanOrEquals
,greaterThanOrEquals
,numberEquals
,numberNotEquals
). - [Minor] New size rules (
longerThan
,shorterThan
,longerThanOrEquals
,shorterThanOrEquals
,lengthEquals
,lengthNotEquals
). - [Minor] New content rules (
equals
,notEquals
). - [Minor] Support returning promise from test callback for async tests.
- [Minor] Add cancel callback.
Removed
- [Major] Removed output properties:
hasValidationErrors
,hasValidationWarnings
. - [Major] Removed compound rules (
anyOf
,allOf
,noneOf
). - [Major] Removed general size rules (
smallerThan
,largerThan
,smallerThanOrEquals
,largerThanOrEquals
,sizeEquals
,sizeNotEquals
).