Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(testing): ephemeral envs, skip dist check #937

Merged
merged 3 commits into from
May 25, 2022
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
7 changes: 6 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"mockWindowLocation": "readonly",
"shallowHook": "readonly",
"shallowHookComponent": "readonly",
"shallowHookWrapper": "readonly"
"shallowHookWrapper": "readonly",
"skipIt": "readonly"
},
"rules": {
"arrow-parens": [
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions config/build.plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -62,6 +57,5 @@ const setCommonPlugins = () => {

module.exports = {
setCommonPlugins,
setHtmlPlugin,
setReplacePlugin
};
11 changes: 11 additions & 0 deletions config/jest.setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 1 addition & 2 deletions config/webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -16,7 +16,6 @@ const { config: webpackConfig, plugins } = config({
routes: setDevRoutes(),
standalone: true,
useProxy: false,
htmlPlugin: setHtmlPlugin(),
replacePlugin: setReplacePlugin()
});

Expand Down
3 changes: 1 addition & 2 deletions config/webpack.prod.config.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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()
});

Expand Down
3 changes: 1 addition & 2 deletions config/webpack.proxy.config.js
Original file line number Diff line number Diff line change
@@ -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');

Expand Down Expand Up @@ -28,7 +28,6 @@ const { config: webpackConfig, plugins } = config({
routes: setProxyRoutes({ DEV_PORT, BETA_PREFIX }),
standalone: false,
useProxy: true,
htmlPlugin: setHtmlPlugin(),
replacePlugin: setReplacePlugin()
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 0 additions & 11 deletions public/index.html

This file was deleted.

1 change: 1 addition & 0 deletions scripts/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down