Skip to content

Fix and re-enable tests for legacy Webpack-built JS #35956

@kdmccormick

Description

@kdmccormick

Background

We have 8 legacy Javascript unit test suites in edx-platform: 7 run by Karma, and 1 run by Jest. Each of the 7 run by Karma uses a different config file. The best way to understand them is probably to look at this package.json snippet, which will merge in part of #35159.

{
  "...": "...",
  "scripts": {
    "...": "...",
    "test": "npm run test-cms && npm run test-lms && npm run test-xmodule && npm run test-common && npm run test-jest",
    "test-kind-vanilla": "npm run test-cms-vanilla && npm run test-xmodule-vanilla && npm run test-common-vanilla",
    "test-kind-require": "npm run test-cms-require && npm run test-common-require",
    "test-kind-webpack": "npm run test-cms-webpack && npm run test-lms-webpack && npm run test-xmodule-webpack",
    "test-cms": "npm run test-cms-vanilla && npm run test-cms-require && npm run test-cms-webpack",
    "test-cms-vanilla": "npm run test-suite -- cms/static/karma_cms.conf.js",
    "test-cms-require": "npm run test-suite -- cms/static/karma_cms_squire.conf.js",
    "test-cms-webpack": "npm run test-suite -- cms/static/karma_cms_webpack.conf.js",
    "test-lms": "npm run test-lms-webpack",
    "test-lms-webpack": "npm run test-suite -- lms/static/karma_lms.conf.js",
    "test-xmodule": "npm run test-xmodule-vanilla && npm run test-xmodule-webpack",
    "test-xmodule-vanilla": "npm run test-suite -- xmodule/js/karma_xmodule.conf.js",
    "test-xmodule-webpack": "npm run test-suite -- xmodule/js/karma_xmodule_webpack.conf.js",
    "test-common": "npm run test-common-vanilla && npm run test-common-require",
    "test-common-vanilla": "npm run test-suite -- common/static/karma_common.conf.js",
    "test-common-require": "npm run test-suite -- common/static/karma_common_requirejs.conf.js",
    "test-suite": "${NODE_WRAPPER:-xvfb-run --auto-servernum} node --max_old_space_size=4096 node_modules/.bin/karma start --single-run=true --capture-timeout=60000 --browsers=FirefoxNoUpdates",
    "test-jest": "jest"
  }
  "...": "..."
}

Essentially, there are three "kinds" of Karma test suites: three that test "vanilla" javascript, two that test RequireJS-based javascript, and three that test Webpack-based javascript. The Webpack-based ones have been quietly failing to build for an indeterminate amount of time, as explained here: #35955

We have since updated our Webpack config so that build failures under Karma would correctly signal the CI check to fail, but in order to do so, we've had to temporarily disable the three Webpack-based test suites.

UPDATE OCTOBER 2025: WIth #36595 merged, the test-xmodule-webpack suite is now fixed, but the test-lms-webpack and test-cms-webpack tests are still broken.

Tasks

  • Re-enable the three Webpack-based test suites
    • test-xmodule-webpack
    • test-lms-webpack
    • test-cms-webpack
  • Fix the Webpack build for these suites
  • Fix or delete any unit tests that have regressed since the last time they were run in CI
    • Fix or delete? --> This is all deprecated code, so we do not want to spend too much time investing in its testing. If it is not obvious how to fix the unit test, then consider removing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code healthProactive technical investment via refactorings, removals, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions