axios-record-replay-adapter
🎥 🎬 🍿
Sit back, relax, and enjoy automatic mocking for axios HTTP requests
Table of contents
Installation
yarn
yarn add axiosyarn add axios-record-replay-adapter --dev
npm
npm i axios --savenpm i axios-record-replay-adapter --save-dev
Setup
Ignore recordings directory
When running tests in watch mode, the recordings directory must be ignored to prevent recording files from triggering tests to re-run.
Jest
Usage
With defaults
With options
const customAxiosIntance = axios
Restore axios default adapter
axios-record-replay-adpater
returns a function to restore the default axios
adapter.
const restoreDefaultAdapater =
Advanced usage
buildRequest()
With
buildResponse()
With
buildFilenamePrefix()
With NOTE: The result of
buildRequest()
gets passed tobuildFilenamePrefix(request)
Contributing
- Fork this repository to your own GitHub account and then clone it to your local device
- Install the dependecies using
yarn
- Link the package to the global module directory:
yarn link
- Run
yarn test --watch
and start making your changes - You can use
yarn link axios-record-replay-adapter
to test your changes in a local project - Ensure any changes are documented in
CHANGELOG.md
License
MIT © Brent Mealhouse