ctimmerm / axios-mock-adapter

Axios adapter that allows to easily mock requests
MIT License
3.42k stars 241 forks source link

Error in new version v1.21.1 -> new MockAdapter(axios) #339

Closed henriqueholtz closed 2 years ago

henriqueholtz commented 2 years ago

Error at new version: v1.21.1

Code:

import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';

var mock = new MockAdapter(axios);

My package.json:

[...]
"axios": "^0.27.2",
"axios-mock-adapter": "^1.21.1",
[...]

My project: https://github.com/SharebookBR/sharebook-frontend-next

image

ctimmerm commented 2 years ago

Can you confirm that it does work on v1.20?

The place where the error occurs hasn't changed recently and would indicate there's something wrong with your axios setup (axios.defaults being undefined).

henriqueholtz commented 2 years ago

@ctimmerm

With the version 1.20.0 I receive this error:

(axios version: 0.27.2)

image

ctimmerm commented 2 years ago

I'm pretty sure this is an error with your TypeScript setup and not with this library, so I'll close the issue for now. Please reopen it if you're able to reproduce it in a test.