diff --git a/pavelib/utils/envs.py b/pavelib/utils/envs.py index d2cdd4a77d7a..7dc9870fbdea 100644 --- a/pavelib/utils/envs.py +++ b/pavelib/utils/envs.py @@ -88,15 +88,19 @@ 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', ] @@ -104,10 +108,10 @@ class Env: 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' diff --git a/webpack.common.config.js b/webpack.common.config.js index de8b545c978b..c9b69eef4292 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -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 { @@ -153,6 +174,7 @@ module.exports = Merge.smart({ // any other way to declare that dependency. $script: 'scriptjs' }), + new DieHardPlugin(), ], module: {