score:1

i was finally able to get the same error as you! in this codesandbox

so the issue is in the naming of styled-component files. you name them [something].css.jsx.

and in you jest.config file tries to map them as classes or something like that, i assume it is because of the import as it ends with '.css'

...
  modulenamemapper: {
    "\\.(css|less|scss|sass)$": "identity-obj-proxy"
  },
...

there are a couple of things you can do here.

  1. change naming convention for styled-components. from[something].css.jsx to [something].styled.jsx.
  2. remove modulenamemapper
  3. remove css from modulenamemapper

my personal favorite is option 1.


Related Query

More Query from same tag