Skip to content

2.16.0 run jest got could not find module error #7964

@mydavidzhang

Description

@mydavidzhang

Describe the bug

  • Cannot find module '@ui5/webcomponents-react-base/Device' from 'node_modules/@ui5/webcomponents-react/dist/components/AnalyticalTable/hooks/useCanUseVoiceOver.js'
  • cannot find module '@ui5/webcomponents-react-base/internal/utils' from 'node_modules/@ui5/webcomponents-react/dist/components/ActionSheet/index.js'
  • Cannot find module '@ui5/webcomponents-react-base/internal/hooks' from 'node_modules/@ui5/webcomponents-react/dist/components/AnalyticalTable/scrollbars/VerticalScrollbar.js'

So as a workaround each project need to update jest.config.js

// Workaround for UI5 WebComponents React v2.16.0 bugs
jestConfig.moduleNameMapper = {
...jestConfig.moduleNameMapper,
"@ui5/webcomponents-react-base/Device": "@ui5/webcomponents-react-base/dist/Device", // Cannot find module '@ui5/webcomponents-react-base/Device' from 'node_modules/@ui5/webcomponents-react/dist/components/AnalyticalTable/hooks/useCanUseVoiceOver.js'
"@ui5/webcomponents-react-base/internal/utils": "@ui5/webcomponents-react-base", // Cannot find module '@ui5/webcomponents-react-base/internal/utils' from 'node_modules/@ui5/webcomponents-react/dist/components/ActionSheet/index.js'
"@ui5/webcomponents-react-base/internal/hooks": "@ui5/webcomponents-react-base" // Cannot find module '@ui5/webcomponents-react-base/internal/hooks' from 'node_modules/@ui5/webcomponents-react/dist/components/AnalyticalTable/scrollbars/VerticalScrollbar.js'
};

Isolated Example

No response

Reproduction steps

  1. Upgrade to "@ui5/webcomponents": "2.16.1" (and others), and "@ui5/webcomponents-react": "2.16.0",
  2. npm run test
    Get below errors:
  • Cannot find module '@ui5/webcomponents-react-base/Device' from 'node_modules/@ui5/webcomponents-react/dist/components/AnalyticalTable/hooks/useCanUseVoiceOver.js'
  • cannot find module '@ui5/webcomponents-react-base/internal/utils' from 'node_modules/@ui5/webcomponents-react/dist/components/ActionSheet/index.js'
  • Cannot find module '@ui5/webcomponents-react-base/internal/hooks' from 'node_modules/@ui5/webcomponents-react/dist/components/AnalyticalTable/scrollbars/VerticalScrollbar.js'

Expected Behaviour

No js error and no workaround should be applied to jest.config.js

Screenshots or Videos

No response

UI5 Web Components for React Version

2.16.0

UI5 Web Components Version

2.16.1

Browser

Chrome

Operating System

No response

Additional Context

No response

Relevant log output

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SAP SFauthor actioncompatibilityIssues related to conflicts or problems with other independent projects or tools.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions