You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Chai, and often use assert.deepEqual() to make sure that one object is equal to another. This works as expected, but to print out the diff, Chai uses Mocha.utils.stringify(). When there are recursive objects involved, however, the whole tests fails at this point, so I've had to use this fix in my tests:
That prevents the test from hanging, but doesn't always work as well as Mocha's stringify function.
As an example of a test that would hang, consider:
it('should fail', () => {
const a = {};
const b = {a};
a.b = b;
assert.deepEqual(b, {}); // Expected to fail, but instead the whole test suite hangs.
});
The text was updated successfully, but these errors were encountered:
Ah sorry, I never bothered testing to make sure this failed. :( It appears the issue has something to do with some more complex objects, perhaps containing getters or Proxies. Closing this for now, and will re-open if I find time to find the root cause.
I'm using
Chai
, and often useassert.deepEqual()
to make sure that one object is equal to another. This works as expected, but to print out the diff, Chai usesMocha.utils.stringify()
. When there are recursive objects involved, however, the whole tests fails at this point, so I've had to use this fix in my tests:That prevents the test from hanging, but doesn't always work as well as Mocha's stringify function.
As an example of a test that would hang, consider:
The text was updated successfully, but these errors were encountered: