Skip to content
Advertisement

How to add custom matchers to jasmine globally?

I’d need a replacement for the jasmine.addMatchers function gone in version 1.3. The current API allows to add matchers to a describe block, but I’d prefer to be able to use my matchers everywhere without adding them again and again.

Is there a global way to add own matchers to jasmine 3.1.0?

Advertisement

Answer

https://github.com/JamieMason/add-matchers can be used to write matchers which work in all versions of Jasmine, as well as Jest.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement