score:1
Accepted answer
so i am now using the following solution (automock all material-ui icons) since it looks like jest cant handle them to begin with, so no harm in just permanently automocking them:
const mockiconslist = new map();
jest.mock('@material-ui/icons', () => new proxy({__esmodule: true}, {
get: (target, prop) => {
if (prop in target)
return target[prop];
if (!mockiconslist.has(prop))
mockiconslist.set(prop, mockcomponent(`mockmaterialicon${prop}`));
return mockiconslist.get(prop);
},
}));
i am still however curious about the above issue and any information regarding it.
Source: stackoverflow.com
Related Query
- Jest require '@material-ui/icons' gives undefined
- Jest - Test gives an error TypeError: Cannot read property 'then' of undefined
- Jest testing promise in React gives TypeError: Cannot read property 'finally' of undefined
- Jest gives `Cannot find module` when importing components with absolute paths
- Is there a way I can overwrite the colour the Material UI Icons npm package provides in React?
- how to import material ui icons?i met some problems using Material ui icons
- innerText is undefined in jest test
- How to use Material UI icons in React?
- How to test form submission in React with Jest and Enzyme? Cannot read property 'preventDefault' of undefined
- google material icons loading slowly, flicker from text to icon
- Compile error using the Component Lab > Autocomplete feature for SVG Icons in Material UI
- Jest with jsdom, document is undefined inside Promise resolve
- type for material UI icons
- Next.JS & JEST - publicRuntimeConfig undefined
- React component using jQuery without require - jest unit tests
- Unable to test post methods with Jest due to error can not read mockImplementation of undefined
- material ui autoComplete with icons
- Using gulp-babel gives Uncaught ReferenceError: require is not defined
- How to use animated material ui icons in React
- Passing a NavLink to a Material UI component via the containerElement prop gives “Failed prop type” warning
- Jest - Testing modals in React gives error
- How to toggle and check a Material UI Checkbox in Enzyme / Jest Test
- React Jest test Cannot read property 'pathname' of undefined
- npx create-react-app client gives this error "Cannot read properties of undefined (reading 'isServer')"
- React: Using Material UI Icons as a button?
- React JS - React Material UI icons not working?
- Material-Table: styling is overiding all custom and Material UI styling and icons not rendering
- Jest moduleNameMapper to find files: "resolver": undefined
- React Material UI DataGrid: Cannot read property 'useRef' of undefined
- Why are these Jest tests failing? TypeError: Cannot read property 'apply' of undefined
More Query from same tag
- How to get the data from Redux store using class components in React
- Get item details react/redux hooks
- how to append formdata of array of objects having image file and title
- Issue with import statement file paths
- CRA: Extract particularly big modules into separate chunks?
- Node Koa cors is not working
- Warning: Failed prop type: The prop `todos[0].title` is marked as required in `TodoList`, but its value is `undefined`
- Promise Error mapping data from backend in React
- Array logic match for list
- How can I stop this wierd output of my lists in react
- Displaying the sub content of a particular list of item thats clicked.
- How to correctly display an array with objects (from another file) on react page?
- How to callback into React Component state from inner HTML?
- Testcafe - how do I iterate over selectors of different element types?
- Firebase gives error on database listener when signing out
- How to scroll to the top of the page after a route change, but retain the scroll position when going back?
- React Hamburger Menu unfunctional
- Why my bottom sub-component is shown on top of a page?
- ReactJS unable to get search filter (text) working
- Material ui list of select item need to be selected
- Input value is changed after moving to another tab react js hooks
- how to call reactQuery refetch in input onchange event in reactjs
- trying to read data from an endpoint and use that data to create components
- Importing svg path from another component using react.js
- ReactJS - SCRIPT1010: Expected identifier - Production build not running on IE11
- React Customize Google calendar's tooltip does't appear
- Prettier is not working at React project
- Not a constructor error when importing packages for React Typescript
- How to use react-redux in Visual Studio
- How To Get Success and Error Messages Out of passport.authenticate?