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:
committed by
Steve Gravrock
parent
dec67bd535
commit
1f23f1e4d2
@@ -10,7 +10,9 @@ describe('toBeInstanceOf', function() {
|
||||
});
|
||||
|
||||
it('passes for NaN', function() {
|
||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();
|
||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf({
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
});
|
||||
var result = matcher.compare(NaN, Number);
|
||||
expect(result).toEqual({
|
||||
pass: true,
|
||||
@@ -156,7 +158,9 @@ describe('toBeInstanceOf', function() {
|
||||
it('passes for objects with no constructor', function() {
|
||||
var object = Object.create(null);
|
||||
|
||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();
|
||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf({
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
});
|
||||
var result = matcher.compare(object, Object);
|
||||
expect(result).toEqual({
|
||||
pass: true,
|
||||
@@ -219,7 +223,9 @@ describe('toBeInstanceOf', function() {
|
||||
});
|
||||
|
||||
it('raises an error if missing an expected value', function() {
|
||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();
|
||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf({
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
});
|
||||
expect(function() {
|
||||
matcher.compare({}, undefined);
|
||||
}).toThrowError('<toBeInstanceOf> : Expected value is not a constructor function\n' +
|
||||
|
||||
Reference in New Issue
Block a user