Skip to content

Commit

Permalink
added workaround for jest resolving axios >= v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nbogie committed Aug 24, 2023
1 parent 64f5f55 commit ccdd73a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ Extra features added:
"type-check": "tsc --noEmit"
```

### What's the jest / axios config in package.json?

A workaround to jest incompatibilities with axios now that the latter is packaged as ESM.

```json
"jest": {
"moduleNameMapper": {
"axios": "axios/dist/node/axios.cjs"
}
}
```

[Read more here](https://stackoverflow.com/a/74297004/669686)

## Learn more about Create-React-App

You can learn more in the [Create React App documentation](https://create-react-app.dev/).
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@
"eslint": "^8.31.0",
"eslint-plugin-react": "^7.31.11",
"prettier": "2.8.2"
},
"jest": {
"moduleNameMapper": {
"axios": "axios/dist/node/axios.cjs"
}
}
}
}

0 comments on commit ccdd73a

Please sign in to comment.