Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Jasmine Matcher instanceof for Jasmine 2.3 & ES6
/* eslint-env jasmine */
beforeEach(function() {
toBeInstanceOf: (util, customEqualityTesters) => {
return {
compare: (actual, expected) => {
const pass = (actual instanceof expected);
return {
message: `Expected ${actual} to ${pass ? 'not' : ''} be instance of ${expected}`,
Copy link

thom-nic commented Dec 4, 2015

I've found that, at least for immutable.js Records, use of expect(myObj).toBe(jasmine.any(MyRecord)) doesn't seem to work but this does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment