epignosisx / vcr-test

Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
MIT License
2 stars 1 forks source link

Using vcr-test with supertest #1

Open kevindavee opened 2 months ago

kevindavee commented 2 months ago

Hello!

How can I use this library with supertest? I want to test my own API endpoint, and inside the API, I call a third-party provider. I want to record only the response of the third-party provider API.

   await vcr.useCassette('my-cassette', async () => {
      await supertest(server)
         .post('/my-endpoints') // <-- inside this endpoint, I call 3rd party API.
         .expect(200);
   }):

But I got a match not found because it records my own API endpoint result.

simonhard commented 1 month ago

Needed that too and patched it with a blacklist host feature, where I'd blacklist 127.0.0.1

https://github.com/epignosisx/vcr-test/pull/2