From 91802a7addbfd050c136ae4c2d9d8f2a7e602c93 Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Wed, 24 Jul 2019 18:08:22 +0000 Subject: [PATCH] deepFunction. Closes #140. Closes #141 --- lib/index.js | 2 +- package.json | 4 ++-- test/index.js | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index 5331195..bc42091 100755 --- a/lib/index.js +++ b/lib/index.js @@ -270,7 +270,7 @@ internals.addMethod('length', internals.length); internals.equal = function (value, options) { options = options || {}; - const settings = Hoek.applyToDefaults({ prototype: exports.settings.comparePrototypes }, options); + const settings = Hoek.applyToDefaults({ prototype: exports.settings.comparePrototypes, deepFunction: true }, options); const compare = this._flags.shallow ? (a, b) => a === b : (a, b) => Hoek.deepEqual(a, b, settings); diff --git a/package.json b/package.json index 1b44e9f..337a232 100755 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "assertion" ], "dependencies": { - "@hapi/hoek": "6.x.x" + "@hapi/hoek": "8.x.x" }, "devDependencies": { - "@hapi/lab": "18.x.x" + "@hapi/lab": "19.x.x" }, "scripts": { "test": "lab -t 100 -L", diff --git a/test/index.js b/test/index.js index dd1495b..5fb8dfc 100755 --- a/test/index.js +++ b/test/index.js @@ -1380,6 +1380,11 @@ describe('expect()', () => { Code.expect(Object.create(null)).to.not.equal({}, { prototype: true }); Code.expect(Object.create(null)).to.equal({}, { prototype: false }); Code.expect(Object.create(null)).to.equal({}); + Code.expect({ a: 1, b: 2 }).to.equal({ a: 1, b: 3 }, { skip: ['b'] }); + + const f1 = () => { }; + const f1a = () => { }; + Code.expect({ f1 }).to.equal({ f1: f1a }); } catch (err) { var exception = err;