About 50 results
Open links in new tab
  1. unit testing - Jest and HTTP mocking with nock - Stack Overflow

    Sep 9, 2021 · Jest and HTTP mocking with nock Asked 4 years, 5 months ago Modified 4 years, 5 months ago Viewed 15k times

  2. node.js - How to send multiple response using nock if there is no ...

    Mar 9, 2022 · TLDR; I'd suggest removing .persist() and setting up nock in each test with the response you want. Details The .persist() call makes that particular nock exist for multiple calls in a row. There …

  3. node.js - Error: Nock: No match for request - Stack Overflow

    Feb 8, 2018 · Nock interceptors don't persist by default. For every request nock needs an interceptor. It looks like you only setup interceptor once and expect it to work for every request. If you want your …

  4. How to use nock to intercept requests regardless of body

    Jun 5, 2019 · 1 I'm trying to use nock in my tests to intercept the request calls i'm making from the native https module in Node.js. I'm using Promise.all to make two requests to the external server. I want my …

  5. javascript - Why is nock matching request when body, time and …

    Why is nock matching request when body, time and timeout should not match? Asked 8 years, 10 months ago Modified 6 years, 11 months ago Viewed 7k times

  6. Mocking NodeJS request and response with Nock - Stack Overflow

    I'm trying to get the grasp of the tool Nock in order to mock the request and response from my code doing the calls. I'm using npm request as a simple HTTP client to request the back-end REST API, ...

  7. How to add params with GET request using nock.js

    'loadStudy' method in 'abc.js' is used to handle the below particular GET request. Hence, any GET request from a browser has a 'params' key with 'id' parameter that replaces ':id' in the URL. However, …

  8. node.js - nock is not intercepting my request - Stack Overflow

    Jun 6, 2016 · I'm trying to create some basic tests using karma server and nock. It seems like nock is not intercepting my requests at all, does anyone have idea? I can't figure out what is missing. I still …

  9. How to see if nock is matching the request or not?

    Mar 1, 2019 · Basically, nock checks all the interceptors it has active until a match is found for your request (in case you have multiple nock interceptors mocking a variety of requests). So what will be …

  10. How to fix TS nock library not intercepting my API call?

    Dec 8, 2023 · "nock": "^13.4.0", My thoughts: I think nock.disableNetConnect(); is not working sometimes... as the call is clearly going through the real endpoint in the internet. I have setup the test …