Node.js: Testing with VCR

5.5k Views Asked by At

Is there a VCR testing system for node.js?

5

There are 5 best solutions below

0
On

Guzzle a similar tool, but it's bundled with the PHP library: https://github.com/guzzle/guzzle/blob/master/tests/Guzzle/Tests/Http/server.js

1
On

Node nock, which is part of the flatiron library/framework has this feature, look here

0
On

I use node-replay:

Node Replay

When API testing slows you down: record and replay HTTP responses like a boss

Things that will ruin your day when tests make HTTP requests to other services:

  • That other service has the uptime of Twitter's API
  • Network late............ ncy
  • Being-rate limited and having to wait an hour for the next test run
  • Same request returns different result each time
  • Everyone else on the network is deep in BitTorrent terittory

Things node-replay can do to make these problems go away:

  • Record API response once, replay as often as necessary
  • Stub HTTP requests (TBD)
  • Replay different responses to same request (great for testing error handling)
  • Not suck
0
On

Update (2012-02-08): VCR.js was recently released.

Not that I know of. It sounds like @derwildemomo is working on one, though.

If you find one, let me know and I'll be happy to add a link to it from VCR's readme.

0
On