Live data from Hacker News

Show HN: Nothing.js – A chainable mock object which always returns itself

github.com

41–43 of 43 posts

Re: Show HN: Nothing.js – A chainable mock object which always returns itself

#41
I don't think I would be comfortable with production code that swallowed access errors by providing a guard post value. I feel like that would too easily slip through in places it shouldn't. To ensure it didn't happen you would need to include explicit checks everywhere, which sort of defeats the stated purpose of the library.

However, it is a handy feature for writing tests. I wrote a similar library for testing called magical-mock based on the python library. https://www.npmjs.com/package/magical-mock

Re: Show HN: Nothing.js – A chainable mock object which always returns itself

#43

This would really benefit from adding comments in the 'how to use' code samples, or at least using standard foos and baars to make it clear what is user code and what is part of Nothing.js. For example it is not really clear if 'executeAction()' etc are part of Nothing.js. I assumed they were, but then the next sample seems to do property chain traversal transparently, without them.

Updated the readme, added a few comments, changed some names
Post reply on HN