Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

chore: transform components in jest tests #1

Open
wants to merge 5 commits into
base: ui-components-v9
Choose a base branch
from

Conversation

ArekZc
Copy link

@ArekZc ArekZc commented Feb 11, 2021

No description provided.

Copy link

@zawias-pro zawias-pro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting tens of similar errors both in TM and CM:

 FAIL  src/tags/forms/components/CustomDimensionsList/CustomDimensionsList.test.tsx
  ● CustomDimensionsList › renders Custom Dimensions

    Cannot find module '!!raw-loader!@piwikpro/ui-components-images-and-icons/lib/assets/icons/cross.svg' from 'node_modules/@piwikpro/ui-components-images-and-icons/lib/utils/methods/getSvgIcon/getSvgIcon.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
      at _default (node_modules/@piwikpro/ui-components-images-and-icons/lib/utils/methods/getSvgIcon/getSvgIcon.js:3:16)
      at Icon (node_modules/@piwikpro/ui-components-images-and-icons/lib/components/Icon/Icon.jsx:20:57)
      at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14803:18)
      at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:17482:13)

It's only the matter of tests, apps start and build without any problems. I have raw-loader installed.

@ArekZc
Copy link
Author

ArekZc commented Feb 15, 2021

I'm getting tens of similar errors both in TM and CM:

 FAIL  src/tags/forms/components/CustomDimensionsList/CustomDimensionsList.test.tsx
  ● CustomDimensionsList › renders Custom Dimensions

    Cannot find module '!!raw-loader!@piwikpro/ui-components-images-and-icons/lib/assets/icons/cross.svg' from 'node_modules/@piwikpro/ui-components-images-and-icons/lib/utils/methods/getSvgIcon/getSvgIcon.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
      at _default (node_modules/@piwikpro/ui-components-images-and-icons/lib/utils/methods/getSvgIcon/getSvgIcon.js:3:16)
      at Icon (node_modules/@piwikpro/ui-components-images-and-icons/lib/components/Icon/Icon.jsx:20:57)
      at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14803:18)
      at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:17482:13)

It's only the matter of tests, apps start and build without any problems. I have raw-loader installed.

The problem is missing mapper entry:

  moduleNameMapper: {
    '\\.css$': 'identity-obj-proxy',
    '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
      path.join(__dirname, 'jest/fileMock.js'),
  },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants