#1883·jasmine

Add ability to use jasmine DiffBuilder in custom matchers

Author: dedwardstechCreated Feb 11, 2021Updated Feb 14, 2026
Labelsfeature requesthelp needed

When I'm building a custom matcher, I'd like to be able to use the DiffBuilder that jasmine uses to print object differences rather than either having to roll my own or install a 3rd party diff builder.

Expected Behavior

I think this could either be imported or provided via the CustomMatcherUtils.

Current Behavior

Currently the DiffBuilder does not seem to exported from Jasmine (or I missed it's export somewhere/it's not in the typescript definition file)

Possible Solution

The easiest solution would be to just export DiffBuilder from jasmine. I think a better solution would be to provide it through the custom matcher utils.

Context

I have written a custom matcher that checks to see if a property exists on an object. You can optionally pass in a value to that matcher and it will check for property equality.

When I check property equality with objects, I'd like to be able to print differences like jasmine.ToEqual prints.