Skip to content

Commit

Permalink
switch from deep-equal to deep-eql; fixes tape-testing#434
Browse files Browse the repository at this point in the history
  • Loading branch information
mindplay-dk committed Apr 17, 2018
1 parent 7261ccc commit a59e4ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions lib/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var deepEqual = require('deep-equal');
var deepEqual = require('deep-eql');
var defined = require('defined');
var path = require('path');
var inherits = require('inherits');
Expand All @@ -10,6 +10,14 @@ var forEach = require('for-each');
var isEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
var toLowerCase = bind.call(Function.call, String.prototype.toLowerCase);

function isPrimitive(value) {
return value === null || typeof value !== 'object';
}

function loose(a, b) {
return isPrimitive(a) && isPrimitive(b) ? a == b : null;
}

module.exports = Test;

var nextTick = typeof setImmediate !== 'undefined'
Expand Down Expand Up @@ -418,7 +426,7 @@ Test.prototype.deepEqual
= Test.prototype.isEquivalent
= Test.prototype.same
= function (a, b, msg, extra) {
this._assert(deepEqual(a, b, { strict: true }), {
this._assert(deepEqual(a, b), {
message : defined(msg, 'should be equivalent'),
operator : 'deepEqual',
actual : a,
Expand All @@ -431,7 +439,7 @@ Test.prototype.deepLooseEqual
= Test.prototype.looseEqual
= Test.prototype.looseEquals
= function (a, b, msg, extra) {
this._assert(deepEqual(a, b), {
this._assert(deepEqual(a, b, { comparator: loose }), {
message : defined(msg, 'should be equivalent'),
operator : 'deepLooseEqual',
actual : a,
Expand All @@ -449,7 +457,7 @@ Test.prototype.notDeepEqual
= Test.prototype.isNotEquivalent
= Test.prototype.isInequivalent
= function (a, b, msg, extra) {
this._assert(!deepEqual(a, b, { strict: true }), {
this._assert(!deepEqual(a, b), {
message : defined(msg, 'should not be equivalent'),
operator : 'notDeepEqual',
actual : a,
Expand All @@ -462,7 +470,7 @@ Test.prototype.notDeepLooseEqual
= Test.prototype.notLooseEqual
= Test.prototype.notLooseEquals
= function (a, b, msg, extra) {
this._assert(!deepEqual(a, b), {
this._assert(!deepEqual(a, b, { comparator: loose }), {
message : defined(msg, 'should be equivalent'),
operator : 'notDeepLooseEqual',
actual : a,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "test"
},
"dependencies": {
"deep-equal": "~1.0.1",
"deep-eql": "^3.0.1",
"defined": "~1.0.0",
"for-each": "~0.3.2",
"function-bind": "~1.1.1",
Expand Down

0 comments on commit a59e4ad

Please sign in to comment.