Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A set of jasmine matchers that allow for more explicit test writing and better error reporting.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

The Jasmine testing framework from Pivotal Labs comes with this default set of matchers:

expect(function(){fn();}).toThrow(e);
expect(x).toBe(y);
expect(x).toBeDefined();
expect(x).toBeFalsy();
expect(x).toBeGreaterThan(y);
expect(x).toBeLessThan(y);
expect(x).toBeNull();
expect(x).toBeTruthy();
expect(x).toBeUndefined();
expect(x).toContain(y);
expect(x).toEqual(y);
expect(x).toMatch(pattern);

jasmine-matchers adds:

expect(x).toBeArray();
expect(x).toBeInstanceOf(Constructor);
expect(x).toBeNan();
expect(x).toBeOfType(type);
expect(x).toHaveLength(length);
expect(x).toHaveLengthGreaterThan(length);
expect(x).toHaveLengthSmallerThan(length);
expect(x).toHaveProperties(...properties);
expect(x).toHaveMethods(...methods);
expect(x).toHaveOwnMethods(...methods);
expect(x).toHaveOwnProperties(...properties);
expect(x).toEachHave(attr, val);
expect(x).toBeCloneOf(source);
expect(x).toNotBeCloneOf(source);
expect(x).toHavePropertieValue(attr, val);
expect(x).toIncludeObject(object);
expect(x).toMatchObject(object);
expect(x).toNotMatchObject(object); //not.toMatchObject(object);
expect(x).toNotMatch(object);
expect(x).toMatchLengthOf(object);
expect(x).toThrowInstanceOf(ExceptionType);
expect(x).toHaveBeenCalledXTimes(count);
expect(x).toContainOnce(value);
expect(x).toEndWith(value);
expect(x).toEachEndWith(value);
expect(x).toSomeEndWith(value);
Something went wrong with that request. Please try again.