Hacker News new | past | comments | ask | show | jobs | submit login
Nock – HTTP mocking and expectations library (github.com/pgte)
63 points by tilt on March 4, 2015 | hide | past | favorite | 11 comments



I'd like to lodge a modest complaint about the name. http://doc.urbit.org/doc/nock/tut/1/


This library is a couple years old. I know Urbit is older but is Urbit's nock also as old?

edit: yes, at least 5 years old, but bloody esoteric http://moronlab.blogspot.com/2010/01/nock-maxwells-equations...


I'm sure there's lots of namespace room! And if there isn't, then too bad for Urbit.


Or too bad for pgte


I used this for a few projects a while back and loved it, and looking through the README in Master it seems like a lot has been improved:

- Delayed responses. - Delayed connections. - Custom HTTP verbs for ones that don't have convenience methods. - Nock Back

I believe recording had just been introduced when I was using the library, but Nock Back is seems like the last piece that brings it on par with the VCR lib I was used to using with Ruby / RSpec projects.

It's always nice to scroll through a project you've had a good experience with and see the README has been considerably fleshed out (in a good way).


A lot of my current projects have Test Induced Design Damage from having HTTP functionality ripped away from any other processing. This would make my methods shorter and my tests cover more as well.


I've used this library a bunch with decent success. Most recently on an API client for my current product: https://github.com/yeller/yeller_node (see https://github.com/yeller/yeller_node/blob/master/spec/integ... for the tests in question). Very happy with it so far!


If you are looking for a browser solution (ajax mocking): https://github.com/algolia/faux-jax


I have used this in the past with success. It does its job.


nock is great and we use it for testing with great success.

Also a shout out for hock which gives the same API as mock but useful for mocking external services - https://github.com/mmalecki/hock.


nock is good.. used it a few times..




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: