-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using yakbak instead of nock for testing #13
Comments
Very interesting, @mwolson! :) I don't have experience personally with yakback, but I do like the benefits you're listing. Sounds like it would be an improvement, and I don't think we're married to nock right now. That said, I do like how the current nock implementation has the response easily-visible in plaintext, whereas the yakbak example provided seems to base64encode the response: For example: Regardless, I'd be interested in seeing a proof-of-concept PR to see how it works! @mwolson if you want to investigate this upgrade, we'll probably want to branch off |
@ijpiantanida has an open pull request for yakbak which makes the fixtures human-readable: flickr/yakbak#18 . |
Likewise, not married to nock - especially since matching on query string params is annoyingly tricky. Would love to see a spike if you're interested @mwolson? |
Yakbak is described here: http://code.flickr.net/2016/04/25/introducing-yakbak-record-and-playback-http-interactions-in-nodejs/
It has the following benefits over nock:
automatic recording of requests that we don't have fixtures for
ability to wipe the fixtures directory and then run the tests once to regenerate all of them for an API change
can plug in multiple yakbak instances as middleware into a single express (or other framework) mock server, using routing on the URL path to determine which service mocks to provide. If you include a scenario name as the first level of that routing, and assign those fixtures to a distinct directory based on scenario name and service, it aids in quickly deleting and regenerating fixtures on an API change
The text was updated successfully, but these errors were encountered: