Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions pavelib/utils/envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,30 @@ class Env:
KARMA_BROWSER = 'FirefoxNoUpdates'

# Files used to run each of the js test suites
# TODO: Store this as a dict. Order seems to matter for some
# reason. See issue TE-415.
# TODO: We have [temporarily disabled] the three Webpack-based tests suites. They have been silently
# broken for a long time; after noticing they were broken, we added the DieHardPlugin to
# webpack.common.config.js to prevent future silent breakage, but have not yet been able to
# fix and re-enable the suites. Note that the LMS suite is all Webpack-based even though it's
# not in the name.
# Issue: https://github.com/openedx/edx-platform/issues/35956
KARMA_CONFIG_FILES = [
REPO_ROOT / 'cms/static/karma_cms.conf.js',
REPO_ROOT / 'cms/static/karma_cms_squire.conf.js',
REPO_ROOT / 'cms/static/karma_cms_webpack.conf.js',
REPO_ROOT / 'lms/static/karma_lms.conf.js',
## [temporarily disabled] REPO_ROOT / 'cms/static/karma_cms_webpack.conf.js',
## [temporarily disabled] REPO_ROOT / 'lms/static/karma_lms.conf.js',
REPO_ROOT / 'xmodule/js/karma_xmodule.conf.js',
REPO_ROOT / 'xmodule/js/karma_xmodule_webpack.conf.js',
## [temporarily disabled] REPO_ROOT / 'xmodule/js/karma_xmodule_webpack.conf.js',
REPO_ROOT / 'common/static/karma_common.conf.js',
REPO_ROOT / 'common/static/karma_common_requirejs.conf.js',
]

JS_TEST_ID_KEYS = [
'cms',
'cms-squire',
'cms-webpack',
'lms',
## [temporarily-disabled] 'cms-webpack',
## [temporarily-disabled] 'lms',
'xmodule',
'xmodule-webpack',
## [temporarily-disabled] 'xmodule-webpack',
'common',
'common-requirejs',
'jest-snapshot'
Expand Down
22 changes: 22 additions & 0 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ var defineFooter = new RegExp('(' + defineCallFooter.source + ')|('
var staticRootLms = process.env.STATIC_ROOT_LMS || './test_root/staticfiles';
var staticRootCms = process.env.STATIC_ROOT_CMS || (staticRootLms + '/studio');

class DieHardPlugin {
/* A small plugin which ensures that if Webpack fails, it causes the surrounding process to fail
* as well. This helps us prevent JavaScript CI from "false passing" upon build failures--that is,
* we want to avoid having another situation where the Webpack build breaks under Karma (our
* test runner) but Karma just lets it slide and moves on to the next test suite.
*
* One would imagine that this would be Webpack's default behavior (and maybe it is?) but,
* regardless, karma-webpack does not seem to consider Webpack build failures to be fatal errors
* without this plugin. We don't fully understand it, but this is good enough given that we plan
* to remove all JS in this repo soon (https://github.com/openedx/edx-platform/issues/31620).
*
* Inpsired by: https://github.com/codymikol/karma-webpack/issues/49#issuecomment-842682050
*/
apply(compiler) {
compiler.hooks.failed.tap('DieHardPlugin', (error) => {
console.error(error);
process.exit(1);
});
}
}

var workerConfig = function() {
try {
return {
Expand Down Expand Up @@ -153,6 +174,7 @@ module.exports = Merge.smart({
// any other way to declare that dependency.
$script: 'scriptjs'
}),
new DieHardPlugin(),
],

module: {
Expand Down