Skip to content
Advertisement

Repeating nock responses indefinitely

The mocking framework Nock.js removes responses after answering them. There is a feature to repeat a response n times, but is there something I can do if I want it to respond to a certain request with the same response every time it is called?

Advertisement

Answer

You can use nock(url).get(path).times(Infinity).

Advertisement