Hacker News new | ask | show | jobs
by TheAceOfHearts 3827 days ago
There's also stuff like rewire [0], which lets you change required values inside modules. Although every time I've tried it, I found it created more problems than it was solving.

[0] https://www.npmjs.com/package/rewire

1 comments

Proxyquire - https://github.com/thlorenz/proxyquire - is a nicer way to solve many of the problems that people tend to use rewire for.

We use it to stub out imports in our unit tests and find it very easy.