ctimmerm / axios-mock-adapter

Axios adapter that allows to easily mock requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

henriqueholtz opened this issue · comments

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

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).

@ctimmerm

With the version 1.20.0 I receive this error:

(axios version: 0.27.2)

image

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.