LibJS/Tests: Add details for toBeTrue() / toBeFalse() expectation error

This commit is contained in:
Linus Groh
2021-05-13 23:34:03 +01:00
parent f28491dbe7
commit b221cad659

View File

@@ -174,13 +174,19 @@ class ExpectationError extends Error {
toBeTrue() {
this.__doMatcher(() => {
this.__expect(this.target === true);
this.__expect(
this.target === true,
() => `toBeTrue: expected target to be true, got _${String(this.target)}_`
);
});
}
toBeFalse() {
this.__doMatcher(() => {
this.__expect(this.target === false);
this.__expect(
this.target === false,
() => `toBeTrue: expected target to be false, got _${String(this.target)}_`
);
});
}