8000 [Jest Testcase] Issue in running the test case after upgrading to ui5 web components 2.8.0 · Issue #7343 · SAP/ui5-webcomponents-react · GitHub
[go: up one dir, main page]

Skip to content
[Jest Testcase] Issue in running the test case after upgrading to ui5 web components 2.8.0 #7343
@vdhyutidhara

Description

@vdhyutidhara

Bug Description

Hi Team,
I am having an issue in running the test cases.
I am using "jest": "29.5.0"
My jest config in package.json is

"jest": {
        "transformIgnorePatterns": [
            "node_modules/*\\.js$"
        ],
        "moduleNameMapper": {
            "ace-builds": "<rootDir>/node_modules/ace-builds",
            "^@ui5/webcomponents-base/jsx-runtime$": "<rootDir>/node_modules/@ui5/webcomponents-base/dist/jsx-runtime.js",
            "^@ui5/webcomponents-base/Keys.js$": "<rootDir>/node_modules/@ui5/webcomponents-base/dist/Keys.js"
        },
        "coverageReporters": [
            "json",
            "html",
            "lcov",
            "text"
        ]
    },

My jest.config.js configuration is,

module.exports = {
    roots: ['./src'],
    transform: {
        '^.+\\.tsx?$': 'ts-jest',
        '^.+\\.jsx?$': 'babel-jest'
    },
    testRegex: '(/tests/.*|(\\.|/)(test|spec))\\.tsx?$',
    moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
    testPathIgnorePatterns: ['/node_modules/', '/public/'],
    moduleNameMapper: {
        '[\\.(css|less|scss|sss|styl)$](file://.(css|less|scss|sss|styl)$)': '<rootDir>/node_modules/jest-css-modules'
    },
    globals: {
        'ts-jest': {
            tsconfig: 'tsconfig.json'
        }
    },
    testEnvironment: 'jsdom',
    verbose: true,
    setupFiles: ['<rootDir>/enzyme.config.js'],
    preset: 'ts-jest/presets/js-with-ts'
}

When I have added shim import in App.tsx:
import '@ui5/webcomponents-base/dist/ssr-dom-shim.js';
I am getting the following test failures along with frontend issues like ui5-dialog not opening, Analytical table not rendering properly, etc.
Test Error
TypeError: Cannot destructure property 'labels' of 'internals' as it is undefined.

When I have not added the above shim import in App.tsx, my frontend issues automatically resolve, but still getting the following error on running the test case
TypeError: Cannot destructure property 'labels' of 'internals' as it is undefined.

When I remove the shim import setupTest.js, I am getting the following error for all test cases:
Image

Currently, I am not facing any UI issues. I have only been facing problems in running my test cases.
Please help us to resolve the issue because we have been stuck in this for quite a long time. We need to upgrade it on high priority.

Affected Component

No response

Expected Behaviour

No response

Isolated Example

No response

Steps to Reproduce

  1. npm run test

Log Output, Stack Trace or Screenshots

No response

Priority

None

UI5 Web Components Version

2.8.0

Browser

Chrome

Operating System

Windows 11

Additional Context

No response

Organization

SAP Labs India

Declaration

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityIssues related to conflicts or problems with other independent projects or tools.released

    Type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0