Skip to content

TypeError undefined EnvironmentTypes.TEST on site.config.test.ts #108

@jacobo-dominguez-wgu

Description

@jacobo-dominguez-wgu

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.tsx file tries to access EnvironmentTypes.TEST, but during Jest execution, the EnvironmentTypes object 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 EnvironmentTypes export isn't available when the config file tries to use it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions