THIS REPO HAS BEEN DEPRECATED AND HAS BEEN ARCHIVED BY THE OWNER.
Mock http requests made using fetch based on fetch-mock
fetchMock.mock('http://example.com', 200);
const res = await fetch('http://example.com');
assert(res.ok);
fetchMock.restore();
fetch-mock requires the following to run:
- Node.js 8+ for full feature operation
- npm (normally comes with Node.js)
- Either of the following
- karma-nexmock-reporter (karma reporter)
- mocha-nexmock-reporter (mocha reporter)
- node-fetch when testing in a nodejs
- A browser that supports the
fetch
API when testing in a browser
See the fork website and example
nexmock is licensed under the MIT license. Copyright © 2019, NeuraLegion
fetch-mock is licensed under the MIT license. Copyright © 2019, Rhys Evans