Chapter 3. Customizing Matchers and Jasmine Functions

In this chapter, we will cover:

  • Writing a Jasmine test using a custom equality tester function
  • Writing Jasmine tests with Custom Matchers
  • Writing Jasmine tests for exceptions
  • Declaring Pending specs with Jasmine tests

Introduction

A matcher is used to evaluate an assertion of an object. If the expected and actual values match, the assertion passes, or else, the assertion fails. Jasmine provides a rich set of built-in matchers to test JavaScript applications. To know more about Jasmine's built-in matchers, refer to the Applying different matchers to the Jasmine test recipe in Chapter 1, Getting Started with Jasmine Framework. In addition to the built-in matchers, Jasmine also provides various functions ...

Get Jasmine Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.