I was able to fix this error by forcing jest to import the commonjs axios build by adding
"jest": {
"moduleNameMapper": {
"axios": "axios/dist/node/axios.cjs"
}
},
to my package.json
. Other solutions using transformIgnorePatterns
didn’t work for me.
More Related Contents:
- How to configure axios to use SSL certificate?
- How can I solve error gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config?
- Using Environment Variables with Vue.js
- Why is ‘type: module’ in package.json file?
- NodeJS, Axios – post file from local server to another server
- Axios (in React-native) not calling server in localhost
- Access to XMLHttpRequest at ‘…’ from origin ‘localhost:3000’ has been blocked by CORS policy
- React Proxy error: Could not proxy request /api/ from localhost:3000 to http://localhost:8000 (ECONNREFUSED)
- im new to making discord bots with node.js, i am having trouble with an error, it says that message is not defined in line 14 and 18
- E11000 duplicate key error index in mongodb mongoose
- NPM Install Error:Unexpected end of JSON input while parsing near ‘…nt-webpack-plugin”:”0’
- How to share sessions with Socket.IO 1.x and Express 4.x?
- Mongoose: findOneAndUpdate doesn’t return updated document
- React-router with BrowserRouter / browserHistory doesn’t work on refresh
- How to include route handlers in multiple files in Express? [duplicate]
- How to redirect 404 errors to a page in ExpressJS?
- socket.io and session?
- callback to handle completion of pipe
- What is the difference between res.end() and res.send()?
- Declare multiple module.exports in Node.js
- Express next function, what is it really for?
- MongoDB Node check if objectid is valid
- npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
- How do you authenticate a server to Firebase?
- How can I get the path of a module I have loaded via require that is *not* mine (i.e. in some node_module)
- How can I import an ES module in the Node.js REPL in Node 8?
- How to send a pdf file from Node/Express app to the browser
- Sinon stub function used with destructuring
- Firestore Add value to array field
- Can I access a cookie from Socket.io?