assert-diff
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -16,10 +16,21 @@ var assert = require('assert-plus'); | ||
AssertDiff.deepEqual = function() { | ||
AssertDiff.deepStrictEqual = function deepStrictEqual() { | ||
try { | ||
assert.deepStrictEqual.apply(assert.deepStrictEqual, arguments); | ||
} catch (e) { | ||
throw new assert.AssertionError({ | ||
message: addDiffToMessage(e.message, jdiff.diffString(e.expected, e.actual)), | ||
stackStartFunction: assert.AssertionError | ||
}) | ||
} | ||
}; | ||
AssertDiff.deepEqual = function deepEqual() { | ||
try { | ||
assert.deepEqual.apply(assert.deepEqual, arguments); | ||
} catch (e) { | ||
e.message = addDiffToMessage(e.message, jdiff.diffString(e.expected, e.actual)); | ||
delete e.expected; | ||
delete e.actual; | ||
throw e; | ||
throw new assert.AssertionError({ | ||
message: addDiffToMessage(e.message, jdiff.diffString(e.expected, e.actual)), | ||
stackStartFunction: assert.AssertionError | ||
}) | ||
} | ||
@@ -26,0 +37,0 @@ if (AssertDiff.options.strict && jdiff.diff(arguments[0], arguments[1])) { |
@@ -14,3 +14,3 @@ { | ||
"repository": "git://github.com/pihvi/assert-diff", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"main": "./lib/assert-diff.js", | ||
@@ -17,0 +17,0 @@ "license": "Apache-2.0", |
@@ -22,3 +22,3 @@ Drop-in replacement for assert to give colored diff on command-line with deepEqual. | ||
## Strict mode ## | ||
By default everything should work as with Node's deepEqual. Using strict mode is probably what you want. At least is for me. | ||
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: | ||
@@ -39,4 +39,9 @@ ```javascript | ||
### 1.2.0 Mar 11, 2017 ### | ||
- Support Node 7 | ||
- Diff shown when loggin error object | ||
- Supports diff in assert.deepStrictEqual | ||
### 1.1.1 Mar 11, 2017 ### | ||
- Support Node 7 in console log example | ||
- fix console log example to support Node 7 | ||
@@ -43,0 +48,0 @@ ### 1.1.0 Aug 19, 2016 ### |
@@ -42,2 +42,10 @@ var assert = require('./../lib/assert-diff') | ||
it('diff strict deep equal', function() { | ||
assert.deepStrictEqual({pow: '1'}, {pow: 1}) | ||
}) | ||
it('original strict deep equal', function() { | ||
assertOrig.deepStrictEqual({pow: '1'}, {pow: 1}) | ||
}) | ||
after(function() { | ||
@@ -44,0 +52,0 @@ assert.options.strict = false |
@@ -7,3 +7,3 @@ var assert = require('./../lib/assert-diff') | ||
} catch (e) { | ||
console.log('Diff assert\n', e.message, e.stack) | ||
console.log('Diff assert\n', e) | ||
} | ||
@@ -14,3 +14,15 @@ | ||
} catch (e) { | ||
console.log('\nOriginal assert:\n', e.message, e.stack) | ||
console.log('\nOriginal assert:\n', e) | ||
} | ||
try { | ||
assert.deepStrictEqual({pow: 1}, {pow: "1"}) | ||
} catch (e) { | ||
console.log('Diff assert strict\n', e) | ||
} | ||
try { | ||
assertOrig.deepStrictEqual({pow: 1}, {pow: "1"}) | ||
} catch (e) { | ||
console.log('\nOriginal assert strict:\n', e) | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29176
139
60