-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
When running Jest tests, the EnvironmentTypes.TEST property is undefined, causing test failures during module loading. This occurs because the test configuration file site.config.test.tsx tries to access EnvironmentTypes.TEST before the module is properly loaded by Jest. This problem happens with some specific tests, not all the unit tests faces this error.
TypeError: Cannot read properties of undefined (reading 'TEST')
9 | logoutUrl: 'http://localhost:8000/logout',
> 10 | environment: EnvironmentTypes.TEST,This workaround fixes the issue: environment: EnvironmentTypes.TEST ?? 'test', but it is needed to investigate why this is happening, this problem was observed during conversion frontend-app-account to frontend-base and while creating the new mfe for the instructor dashboard.
Some ideas on what can be happening:
- Configuration File Problem: The
site.config.test.tsxfile tries to accessEnvironmentTypes.TEST, but during Jest execution, theEnvironmentTypesobject is undefined or not properly loaded from the @openedx/frontend-base package. - Module Loading Order: Jest loads modules in a specific order, and sometimes the
EnvironmentTypesexport isn't available when the config file tries to use it.
Metadata
Metadata
Assignees
Labels
No labels