Merge branch 'cof-merge-candidate'

* Simplifies the matcher interface
* Adds support for custom object formatters
This commit is contained in:
Steve Gravrock
2020-02-12 14:23:53 -08:00
86 changed files with 3102 additions and 1041 deletions

View File

@@ -2609,4 +2609,33 @@ describe("Env integration", function() {
env.execute();
});
it("supports asymmetric equality testers that take a matchersUtil", function(done) {
var env = new jasmineUnderTest.Env();
env.it("spec using custom asymmetric equality tester", function() {
var customEqualityFn = function(a, b) {
if (a === 2 && b === "two") {
return true;
}
};
var arrayWithFirstElement = function(sample) {
return {
asymmetricMatch: function (actual, matchersUtil) {
return matchersUtil.equals(sample, actual[0]);
}
};
};
env.addCustomEqualityTester(customEqualityFn);
env.expect(["two"]).toEqual(arrayWithFirstElement(2));
});
var specExpectations = function(result) {
expect(result.status).toEqual('passed');
};
env.addReporter({ specDone: specExpectations, jasmineDone: done });
env.execute();
});
});