'How to change stack size limit in NodeJS?

In my library (Scheme in JavaScript) I have a test that should fail because it calculates (! 1000) and it should pass when TCO (tail call optimization) is implemented. But recently NodeJS probably increased the stack size limit because the test passes which means it failed to fail.

Is there a way to make stack size smaller in NodeJS? So I don't need to increase the value of the factorial function to overflow the stack.

EDIT: note that --stack-size option discussed on GitHub may crash node. I would like to have a stack overflow error but for a smaller value than 1000.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source