JSSmallTips — Creating custom matcher assertions with Jest

Creating our first custom matcher

  • pass: boolean — indicates whether there was a match or not (true or false)
  • message: function — is a function that will returns an error message in case of failure.

Talk is cheap, show me the code

Now, the usage






JavaScript enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

App Screen 1

Why you should learn JavaScript

How to focus() on Semantic UI React components using React.createRef()

How to Shrink the Size of Node_Modules in Yarn(1.* Version) Based Project

ES Classes in Ember.js

Regular Expressions Revisited

Minify HTML Webpack Plugin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ramon Prata

Ramon Prata

JavaScript enthusiast

More from Medium

How to fix app crashing when using the showFloatWindow API on Huawei devices running EMUI before…

Store Layout

InfinitumX Newsletter #3

How To: Get Creative with BidBot Lists