poetic / nock-vcr-recorder

A test framework agnostic vcr implementation that uses nock.
9 stars 11 forks source link

Strange behaviour using nock and nock-vcr-recorder #11

Open diegohaz opened 8 years ago

diegohaz commented 8 years ago

I'm using nock-vcr-recorder and nock on different test suites, but in the same execution. The first time nock-vcr-recorder runs (or has { mode: 'all' }), subsequent nock('...') fails. It seems like something has not been closed at the first vcr run and it doesn't allow nock to work.

diegohaz commented 8 years ago

I solve this by adding the following line before using nock:

nock.restore() && nock.isActive() || nock.activate()
diegohaz commented 8 years ago

I reopened because maybe there's a better solution to be implemented inside nock-vcr-recorder. I've also submitted an issue on nock repo: https://github.com/node-nock/nock/issues/666