axios-mock-adapter
axios-mock-adapter copied to clipboard
Axios adapter that allows to easily mock requests
versions: - node: 16.14.0 - adios-mock-adapter: 1.21.2 The history of request's config seems to be overwrite if it belongs to the same request. Here is the demo code: I create...
This PR exposes a method to delay the mocks response, adds types, and tests.
Closes #365 The expected bundle size seems very constraining, and I did not find a way to reduce it below 3Kb without impacting readability or doing deeper reconf/refactoring. Also, I...
### Changelog - ♻️ Migrate internal handler to an object - 🎁 Migrate handlers and history to a flat array. That way one only needs to check the history array...
```tsx import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; const instance = axios.create({ adapter: config => { console.log('no run'); return axios({ ...config, adapter: undefined }); }, }); const mock =...
"axios": "^1.7.7", "axios-mock-adapter": "^2.0.0", The axios version type is AxiosStatic, not AxiosInstance
TypeScript error when axios instance is created from an import that uses `axios >=1.6.0`'s ESM types
## Overview With `[email protected]`, `[email protected]`, `[email protected]`, using `MockAdapter` causes TypeScript to error about type differences between `axios` when imported via our ESM code and the types imported by `axios-mock-adapter`. The...
Is it possible to mock a lack of a response? I'd like to test Axios error handling when a request is made but the server does not respond. If I...
Not sure if this is now somewhat expected behaviour for V2 but I had a few tests where in the before each id use an onAny, and then in the...