I am looking for a way to be able to specify which nock request will be called for each mocha test. The issue is that I have ~50 nock request all with the same exact url (post data differs) and it makes using skip()
and only()
in mocha a huge pain. I am thinking of using headers to differentiate. Is there a better option?
If you call nock
for the individual test you can reuse URLs for that test. If it's the same URL you can set it as a variable to save some typing too.
var url = "http://example.com";
it("should test something", function () {
nock(url).post;
});
it("should test another thing", function () {
nock(url).post;
});