Ben
Ben

Reputation: 911

Nock: how to assert request wasn't made

When a request is made and wasn't mocked I get an error: Error: Nock: No match for request but that doesn't fail the test. Is there a way to make sure no mocked requests were made?

Upvotes: 3

Views: 1392

Answers (1)

dontcallmedom
dontcallmedom

Reputation: 2470

You can catch the "no match" event from nock nock.emitter.on('no match', callback) and use the callback to trigger the error path in your test framework.

Upvotes: 2

Related Questions