Drop-in replacement for assert to give colored diff on command-line with deepEqual.
This exists to give better diff on error when comparing objects or arrays with Mocha.
Should work on *nix shells.
Also has more asserts from https://npmjs.org/package/assert-plus
var assert = require('assert-diff')
it('diff deep equal with message', function() {
assert.deepEqual({pow: "boom", same: true, foo: 2}, {same: true, bar: 2, pow: "bang"}, "this should fail")
})
Should give you:
By default everything works as with Node's deepEqual. Using strict mode is probably what you want. At least is for me. The following example will pass with Node's deepEqual but will fail using strict mode:
var assert = require('assert-diff')
assert.options.strict = true
it('strict diff deep equal', function() {
assert.deepEqual({a: 1, b: 2}, {a: true, b: "2"}, "this should fail")
})
Should give you:
- Upgrade json-diff
- Upgrade deps
- Upgrade deps
- Fix async #26
- Upgrade deps
- Thanks @fent!
- Support async #23
- Upgrade deps
- Thanks @fent!
- Switch to webpack to enable assert(true) style
- Fix usage with assert(true) style
- Fix v. 2.0.0 by adding the built index.js
- Migrate to ES Modules #17
- Upgrade deps
- Thanks @59naga!
- Add security build and badges
- Upgrade deps
- Upgrade deps
- Upgrade json-diff to 0.5.2
- Upgrade json-diff to 0.5.1
- Add npm lock file
- Support Node 7
- Diff shown when loggin error object
- Supports diff in assert.deepStrictEqual
- fix console log example to support Node 7
- Upgrade assert-plus 0.1.5 -> 1.0.0
- Default behaviour back to non strict to be drop-in replacement for Node assert
- Support assert in constructor e.g. assert(true)
- Initial implementation
Apache 2.0