Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Assert equality of two regexps #144

utkarshkukreti opened this Issue Mar 20, 2013 · 7 comments


None yet
3 participants

Neither normal equals, nor deepEquals assertions compare regexp correctly.

This should go into deepEquals I suppose? I'll try to submit a pull request for this.


katsgeorgeek commented Jun 4, 2013

Do you mean something like this expect(/([\/.])/g).to.deep.equal(/([\/.])/g); ?


katsgeorgeek commented Jun 4, 2013

So this works correctly.

expect(/a/).to.deep.equal(/b/) also matches for me. (I think all RegExp deeply equal each other according to chai, I forgot, it's been 3 months since I reported this.)


logicalparadox commented Jun 4, 2013

Sorry for the delay in response, and yes, you are correct... this is an open bug as we currently do not test deep equality of RegExp (and the default response is true).

Overall, the deep equal utility needs some attention as it has been almost entirely ignored since the early versions of chai. Expect to see a major rewrite of this in the very near future.


katsgeorgeek commented Jun 7, 2013

Please close this issue.

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