3 ms·
I think auto mocking modules is the most horrible trick a testing framework can pull. So because you're too lazy to write modules with a minimum of sane depend
by camus2 12y ago
I think auto mocking modules is the most horrible trick a testing framework can pull.
So because you're too lazy to write modules with a minimum of sane dependency injection,you hack require (which is not dependency injection) to mock dependencies?
This is actually the most awfull anti pattern i've seen in javascript land yet.Unfortunatly, it's becoming the "way to go" for most developpers. Instead of making your modules pluggable and decoupled,you negates everything testing is for,you just dont write testable code.
- oldmanjay 12y agowhat is the effective difference between mocking an injected dependency and a located one?
- ericclemmons 12y agoThis isn't so bad. Before DI got popular in PHP via Symfony2, we used Zend_Registry. "require" is pretty much the same thing in this context.