diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js index 68f8c277b..1c03fef12 100644 --- a/lib/chai/core/assertions.js +++ b/lib/chai/core/assertions.js @@ -44,6 +44,8 @@ module.exports = function (chai, _) { , 'with', 'that', 'which', 'at' , 'of', 'same', 'but' ].forEach(function (chain) { Assertion.addProperty(chain, function () { + var newAssertion = new Assertion(); + _.transferFlags(this, newAssertion); return this; }); }); 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');