diff --git a/.eslintrc b/.eslintrc index 58767d6d5..7a05daac8 100644 --- a/.eslintrc +++ b/.eslintrc @@ -46,7 +46,8 @@ "mockWindowLocation": "readonly", "shallowHook": "readonly", "shallowHookComponent": "readonly", - "shallowHookWrapper": "readonly" + "shallowHookWrapper": "readonly", + "skipIt": "readonly" }, "rules": { "arrow-parens": [ @@ -74,6 +75,10 @@ "import/no-named-as-default": 0, "import/no-named-as-default-member": 0, "jest/no-done-callback": 0, + "jest/no-standalone-expect": [ + 2, + { "additionalTestBlockFunctions": ["skipIt"] } + ], "jest/prefer-to-have-length": 0, "jsdoc/check-tag-names": [ 2, diff --git a/config/build.plugins.js b/config/build.plugins.js index cee330ee4..c19413022 100644 --- a/config/build.plugins.js +++ b/config/build.plugins.js @@ -6,11 +6,6 @@ const fedModulePlugin = require('@redhat-cloud-services/frontend-components-conf const { setupWebpackDotenvFilesForEnv } = require('./build.dotenv'); const { dependencies } = require('../package.json'); -const setHtmlPlugin = () => ({ - title: process.env.REACT_APP_UI_DISPLAY_NAME, - template: join(process.env._BUILD_STATIC_DIR, 'index.html') -}); - const setReplacePlugin = () => [ { pattern: /%([A-Z_]+)%/g, @@ -62,6 +57,5 @@ const setCommonPlugins = () => { module.exports = { setCommonPlugins, - setHtmlPlugin, setReplacePlugin }; diff --git a/config/jest.setupTests.js b/config/jest.setupTests.js index 74ee6503c..dd6cee87b 100644 --- a/config/jest.setupTests.js +++ b/config/jest.setupTests.js @@ -17,6 +17,17 @@ setupDotenvFilesForEnv({ env: process.env.NODE_ENV }); */ configure({ adapter: new Adapter() }); +/** + * Conditionally skip "it" test statements. + * Ex: + * skipIt(true)('should do a thing...', () => { ... }); + * + * @param {*|boolean} value Any truthy value, typically used with environment variables + * + * @returns {*|jest.It} + */ +global.skipIt = value => (value && it?.skip) || it; + /** * Emulate for component checks */ diff --git a/config/webpack.dev.config.js b/config/webpack.dev.config.js index e5af81a42..2cf8d8c84 100644 --- a/config/webpack.dev.config.js +++ b/config/webpack.dev.config.js @@ -1,5 +1,5 @@ const config = require('@redhat-cloud-services/frontend-components-config'); -const { setHtmlPlugin, setReplacePlugin, setCommonPlugins } = require('./build.plugins'); +const { setReplacePlugin, setCommonPlugins } = require('./build.plugins'); const { setupDotenvFilesForEnv } = require('./build.dotenv'); const { setDevRoutes } = require('./spandx.config'); @@ -16,7 +16,6 @@ const { config: webpackConfig, plugins } = config({ routes: setDevRoutes(), standalone: true, useProxy: false, - htmlPlugin: setHtmlPlugin(), replacePlugin: setReplacePlugin() }); diff --git a/config/webpack.prod.config.js b/config/webpack.prod.config.js index 8b8842690..2e98ccbd3 100644 --- a/config/webpack.prod.config.js +++ b/config/webpack.prod.config.js @@ -1,6 +1,6 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const config = require('@redhat-cloud-services/frontend-components-config'); -const { setHtmlPlugin, setReplacePlugin, setCommonPlugins } = require('./build.plugins'); +const { setReplacePlugin, setCommonPlugins } = require('./build.plugins'); const { setupDotenvFilesForEnv } = require('./build.dotenv'); const { @@ -12,7 +12,6 @@ const { const { config: webpackConfig, plugins } = config({ rootFolder: _BUILD_RELATIVE_DIRNAME, deployment: (/beta/.test(BETA_PREFIX) && 'beta/apps') || 'apps', - htmlPlugin: setHtmlPlugin(), replacePlugin: setReplacePlugin() }); diff --git a/config/webpack.proxy.config.js b/config/webpack.proxy.config.js index 61afda5d1..b85c7a38a 100644 --- a/config/webpack.proxy.config.js +++ b/config/webpack.proxy.config.js @@ -1,5 +1,5 @@ const config = require('@redhat-cloud-services/frontend-components-config'); -const { setHtmlPlugin, setReplacePlugin, setCommonPlugins } = require('./build.plugins'); +const { setReplacePlugin, setCommonPlugins } = require('./build.plugins'); const { setupDotenvFilesForEnv } = require('./build.dotenv'); const { setProxyRoutes } = require('./spandx.config'); @@ -28,7 +28,6 @@ const { config: webpackConfig, plugins } = config({ routes: setProxyRoutes({ DEV_PORT, BETA_PREFIX }), standalone: false, useProxy: true, - htmlPlugin: setHtmlPlugin(), replacePlugin: setReplacePlugin() }); diff --git a/package.json b/package.json index d56275df1..8c134bd40 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "test:dev": "export NODE_ENV=test; run-s test:spell test:lint test:local", "test:deps": "run-s test build", "test:integration": "jest ./tests", - "test:integration-ephemeral": "TZ=UTC jest ./tests --no-cache", + "test:integration-ephemeral": "TZ=UTC jest ./tests --no-cache --testPathIgnorePatterns ./tests/dist.test.js", "test:integration-dev": "jest --roots=./tests --watch", "test:lint": "eslint --ext=json --ext=js --ext=jsx src", "test:spell-support": "cspell ./README.md ./config/README.md ./CONTRIBUTING.md --config ./config/cspell.config.json", diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 447aeeb74..000000000 --- a/public/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - %REACT_APP_UI_DISPLAY_NAME% - - - - - - diff --git a/scripts/pre.sh b/scripts/pre.sh index 6ac6b4681..c5c1596b0 100644 --- a/scripts/pre.sh +++ b/scripts/pre.sh @@ -36,6 +36,7 @@ version() clean() { echo "Cleaning build directories, files..." + rm -rf -- ./dist rm -rf -- ./build rm -rf -- ./public/apps rm -f ./.env.production.local