ShouldJS `should.equal` throws JavaScript heap out of memory

80 Views Asked by At

I've run into an issue where running mocha tests a simple check of should.equal(reactComponent, undefined) fail with FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory.

1

There are 1 best solutions below

0
Ido Ran On

I've traced the issue into should-format.js file inside should-format node module version 3.0.3.
It seems that the fact the actual parameter was a React component cause the failure when trying to format the error message.

A simple workaround is to rewrite the assert this way: (reactComponent === undefined).should.be.true();