openedx / openedx/openedx-platform
Fix and re-enable tests for legacy Webpack-built JS
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.2k
- Forks
- 4.4k
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 42
Description
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 https://github.com/openedx/edx-platform/pull/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: https://github.com/openedx/edx-platform/pull/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 https://github.com/openedx/edx-platform/pull/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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the package.json test scripts and the named Karma configs: lms/static/karma_lms.conf.js and cms/static/karma_cms_webpack.conf.js. Review the Webpack build failures described in PR 35955, then run the affected test suites. Done means test-lms-webpack and test-cms-webpack build and run successfully, with regressed tests fixed or removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, webpack
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100