Closed ferrao closed 6 years ago
That is not a valid statement. Can't do much with this information.
I'm betting on cyclic objects...
We have circular ref protection. Same as clone.
The objects are cyclic, but due to the circular ref protection this issue did not happened in lab 14.0.1
. When I upgraded to to lab 14.3.1
, with the exact same objects I got the stack overflow.
4.x.x
is the Hoek dependency on both, so I am guessing somewhere in 4.x.x something changed in Hoek.
Sorry for the lack of detail, I will find the exact Hoek version where this issue surfaced and see what I can do to help.
I need a failing test...
Got it!
The problem manifested itself doing an equal assertion on two route configuration objects.
The only thing out of the ordinary these route objects have are Joi validations, which Hoek could handle fine before, but at some point is not able to do so anymore, perhaps due to some changes in Joi itself.
You can verify this behaviour with a simple expect(Joi).to.equals(Joi);
, which now causes a stack overflow.
Failing test:
it('handles circular dependency in array', () => {
const a = { x: [] };
a.x.push(a);
const b = Hoek.clone(a);
expect(Hoek.deepEqual(a, b)).to.be.true();
});
I'm working on a fix.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
When asserting the equality with
Code.expect.equal()
I am getting onHoek.deepEqual
: