diff --git a/src/seamless-immutable.js b/src/seamless-immutable.js index 99ed61b..4e13b3a 100644 --- a/src/seamless-immutable.js +++ b/src/seamless-immutable.js @@ -519,8 +519,8 @@ } if (stackRemaining <= 0) { throw new ImmutableError("Attempt to construct Immutable from a deeply nested object was detected." + - " Have you tried to wrap an object with circular references (e.g. React Component)?" + - " See https://github.com/rtfeldman/seamless-immutable/issues/73 for details."); + " Have you tried to wrap an object with circular references (e.g. React element)?" + + " See https://github.com/rtfeldman/seamless-immutable/wiki/Deeply-nested-object-was-detected for details."); } stackRemaining -= 1; } diff --git a/test/Immutable.spec.js b/test/Immutable.spec.js index 26049ae..56dac65 100644 --- a/test/Immutable.spec.js +++ b/test/Immutable.spec.js @@ -109,6 +109,20 @@ var getTestUtils = require("./TestUtils.js"); assert.throws(function() { Immutable(obj); }, /deeply nested/); } }); + + it("can configure stackRemaining", function() { + var mutable = {bottom: true}; + _.range(65).forEach(function() { + mutable = {prop: mutable}; + }); + + if (config.id === 'prod') { + TestUtils.assertJsonEqual(mutable, Immutable(mutable)); + } else { + assert.throws(function() { Immutable(mutable); }, /deeply nested/); + TestUtils.assertJsonEqual(mutable, Immutable(mutable, null, 66)); + } + }); }); }); });