moll / js-must

An assertion library for JavaScript and Node.js with a friendly BDD syntax (awesome.must.be.true()). It ships with many expressive matchers and is test runner and framework agnostic. Follows RFC 2119 with its use of MUST. Good stuff and well tested.
Other
336 stars 35 forks source link

Show expected and actual length for length error #59

Open GIorfindel opened 7 years ago

GIorfindel commented 7 years ago

This PR adds the actual and expected size for length errors. This is useful when an assert is performed on a large array or string without knowing the length of it.

GIorfindel commented 7 years ago

For example, AssertionError: ["a","2","ZAR","ar","ar","zt","zt","zt","zt","zt","zt","et","tr","xdf","ar","ar","zre","zer","ERZ","45"] must have length of 3 becomes AssertionError: ["a","2","ZAR","ar","ar","zt","zt","zt","zt","zt","zt","et","tr","xdf","ar","ar","zre","zer","ERZ","45"] must have length of 3. +expected, -actual : +3 -20 We don't need to count each item anymore to know the actual length of the array.