Created
August 8, 2017 20:13
-
-
Save ppg/d46758f39cb172b83a834ae5007672d7 to your computer and use it in GitHub Desktop.
Demonstration of deep matching issues with errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const chai = require('chai'); | |
const expect = chai.expect; | |
const err1 = new Error('test error'); | |
const err2 = new Error('test error'); | |
it('should match exact errors', function() { | |
expect(err1).to.equal(err1); | |
}); | |
it('should NOT match exact different errors', function() { | |
expect(err1).not.to.equal(err2); | |
}); | |
it('should deep match different errors', function() { | |
expect(err1).to.deep.equal(err2); | |
}); |
Author
ppg
commented
Aug 8, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment