Is there an equivalent to webmock or vcr for client side code? ... Or is it possible to use webmock with client side code already?
Asked
Active
Viewed 1,825 times
3 Answers
3
You can use sinon's FakeXMLHttpRequest, or nock.

Milovan Zogovic
- 1,541
- 2
- 16
- 24
-
1+1 for nock. It has all of the features of webmock, and does recording too. – elkelk Jul 10 '14 at 18:04
0
Nowadays, try Mockttp.
It can mock requests for both Node & browser, it uses real requests thereby giving you far more accurate results than Nock et al, and it can either mock as a fake server (reconfiguring your target URLs) or an intercepting proxy (making requests to the real URLs, and intercepting some/all of them).
It's also got good support for running tests in parallel, which global-mocking libraries can't do, and lots of other nice modern features.

Tim Perry
- 11,766
- 1
- 57
- 85