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.


Related Query

More Query from same tag