16

Is there a VCR testing system for node.js?

Myron Marston
  • 21,452
  • 5
  • 64
  • 63
donald
  • 23,587
  • 42
  • 142
  • 223

5 Answers5

11

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

Marcos Oliveira
  • 1,697
  • 1
  • 14
  • 13
  • 1
    Nock is the real node-equivalent of VCR; VCR.js is specific only to browser(like) environments, since it records `XMLHttpRequest` events. Thanks! – namuol Nov 12 '13 at 01:59
5

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
Community
  • 1
  • 1
Michelle Tilley
  • 157,729
  • 40
  • 374
  • 311
4

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.

Myron Marston
  • 21,452
  • 5
  • 64
  • 63
0

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

Michael Dowling
  • 5,098
  • 4
  • 32
  • 28