diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js index 68f8c277b..6c3b9c534 100644 --- a/lib/chai/core/assertions.js +++ b/lib/chai/core/assertions.js @@ -43,9 +43,7 @@ module.exports = function (chai, _) { , 'is', 'and', 'has', 'have' , 'with', 'that', 'which', 'at' , 'of', 'same', 'but' ].forEach(function (chain) { - Assertion.addProperty(chain, function () { - return this; - }); + Assertion.addProperty(chain); }); /** diff --git a/lib/chai/utils/addProperty.js b/lib/chai/utils/addProperty.js index fd3b732ca..64e69ba32 100644 --- a/lib/chai/utils/addProperty.js +++ b/lib/chai/utils/addProperty.js @@ -35,6 +35,8 @@ var transferFlags = require('./transferFlags'); */ module.exports = function (ctx, name, getter) { + getter = getter === undefined ? new Function() : getter; + Object.defineProperty(ctx, name, { get: function addProperty() { var old_ssfi = flag(this, 'ssfi');