Inject a per-runable pretty printer into MatchersUtil

This will allow us to add support for custom object formatters, which
will be a per-runable resource like custom matchers, by injecting them
into the pretty-printer.
This commit is contained in:
Steve Gravrock
2019-10-08 22:57:07 -07:00
committed by Steve Gravrock
parent dec67bd535
commit 1f23f1e4d2
46 changed files with 546 additions and 401 deletions

View File

@@ -32,7 +32,9 @@ describe("toThrowMatching", function() {
});
it("fails with the correct message if thrown is a falsy value", function() {
var matcher = jasmineUnderTest.matchers.toThrowMatching(),
var matcher = jasmineUnderTest.matchers.toThrowMatching({
pp: jasmineUnderTest.makePrettyPrinter()
}),
fn = function() {
throw undefined;
},
@@ -58,8 +60,10 @@ describe("toThrowMatching", function() {
});
it("fails if the argument is a function that returns false when called with the error", function() {
var matcher = jasmineUnderTest.matchers.toThrowMatching(),
predicate = function(e) { return e.message === "oh no" },
var matcher = jasmineUnderTest.matchers.toThrowMatching({
pp: jasmineUnderTest.makePrettyPrinter()
}),
predicate = function(e) { return e.message === "oh no" },
fn = function() {
throw new TypeError("nope");
},