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

Fixes #37636 - remove "@theforeman/test" imports #10239

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
197 changes: 0 additions & 197 deletions .eslintrc

This file was deleted.

21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const lintCoreConfig = require('./script/lint/lint_core_config.js');
const lintGenericConfig = require('./script/lint/lint_generic_config.js');

const combinedConfig = {
...lintCoreConfig,
...lintGenericConfig,
rules: {
...lintCoreConfig.rules,
...lintGenericConfig.rules,
},
plugins: [
...(lintCoreConfig.plugins || []),
...(lintGenericConfig.plugins || []),
],
extends: [
...(lintCoreConfig.extends || []),
...(lintGenericConfig.extends || []),
],
};

module.exports = combinedConfig;
2 changes: 0 additions & 2 deletions .github/workflows/js_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ jobs:
run: npm ci --no-audit
- name: Run linter
run: npm run lint
- name: Run custom eslint rules Spellcheck (only warnings) and missing ouia-ids
run: npm run lint:custom
- name: Run tests
run: npm run test
- name: Publish Coveralls
Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/plugins_react_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true

env:
BUNDLE_WITHOUT: "console:development:journald:libvirt"

jobs:
setup_matrix:
name: Setup matrix
Expand Down Expand Up @@ -45,11 +48,11 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# We could update the postinstall action for foreman to look for an environment variable for plugin webpack dirs
# before kicking off the ruby script to find them, this would eliminate the ruby dep and running `npm install` in plugins.
- uses: ruby/setup-ruby@v1
- name: "Set up Ruby ${{ matrix.ruby }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Checkout Foreman
uses: actions/checkout@v4
with:
Expand All @@ -65,12 +68,29 @@ jobs:
with:
repository: ${{ matrix.plugin }}
path: ${{ github.workspace }}/projects/plugin
- name: store plugin name
run: echo "PLUGIN_NAME=$(echo ${{ matrix.plugin }} | awk -F'/' '{print $NF}')" >> "${GITHUB_ENV}"
- name: Set up plugin in Foreman
run: |
echo "gemspec name: '$PLUGIN_NAME', path: '${{ github.workspace }}/projects/plugin'" > "bundler.d/$PLUGIN_NAME.local.rb"
if [ -d $PLUGIN_NAME/gemfile.d ] ; then
cat $PLUGIN_NAME/gemfile.d/*.rb >> bundler.d/$PLUGIN_NAME.local.rb
fi
working-directory: ${{ github.workspace }}/projects/foreman
- name: Generate ${{ matrix.plugin }} npm dependencies package-lock
run: npm install --package-lock-only --no-audit --legacy-peer-deps
working-directory: ${{ github.workspace }}/projects/plugin
- name: Install ${{ matrix.plugin }} npm dependencies
run: npm ci --no-audit --legacy-peer-deps
working-directory: ${{ github.workspace }}/projects/plugin
- run: sudo apt-get update
- run: sudo apt-get -qq -y install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev libvirt-dev
- name: Install gems
run: bundle install
working-directory: ${{ github.workspace }}/projects/foreman
- name: Run plugin webpack dir to test
run: ./script/plugin_webpack_directories.rb
working-directory: ${{ github.workspace }}/projects/foreman
- name: Run ${{ matrix.plugin }} tests
run: npm test
working-directory: ${{ github.workspace }}/projects/plugin
run: npm run test:plugins $(echo ${{ matrix.plugin }} | awk -F'/' '{print $NF}')
working-directory: ${{ github.workspace }}/projects/foreman
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: [require.resolve('@theforeman/builder/babel')],
plugins: [require.resolve('babel-plugin-dynamic-import-node')],
};
1 change: 1 addition & 0 deletions package-exclude.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"EXCLUDE_NPM_PACKAGES": [
"@apollo/react-testing",
"@sheerun/mutationobserver-shim",
"@theforeman/env",
"@theforeman/eslint-plugin-foreman",
Expand Down
34 changes: 28 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"node": ">=14.0.0 <21.0.0"
},
"scripts": {
"lint": "tfm-lint",
"lint:custom": "eslint ./webpack",
"lint": "eslint ./webpack ./script",
"prelint": "node ./script/lint/link-eslint-plugin.js",
"foreman-js:link": "./script/npm_link_foreman_js.sh",
"postlint": "./script/npm_lint_plugins.js",
"test": "tfm-test",
"test": "npx jest --setupFilesAfterEnv ./global_test_setup.js ./core_test_setup.js --testPathIgnorePatterns '/node_modules/' '<rootDir>/.+fixtures.+' --config ./webpack/jest.config.js",
"test:watch": "tfm-test --watchAll",
"test:current": "tfm-test --watch",
"test:plugins": "./script/npm_test_plugin.js",
"publish-coverage": "tfm-publish-coverage",
"postinstall": "./script/npm_install_plugins.js",
"analyze": "./script/webpack-analyze"
Expand All @@ -29,28 +30,48 @@
"react-intl": "^2.8.0"
},
"devDependencies": {
"@apollo/react-testing": "^4.0.0",
"@babel/core": "^7.7.0",
"@testing-library/jest-dom": "^5.3.0",
"@testing-library/react": "^10.0.2",
"@testing-library/react-hooks": "^3.4.2",
"@theforeman/builder": "^13.1.0",
"@theforeman/eslint-plugin-foreman": "^13.1.0",
"@theforeman/eslint-plugin-rules": "^13.1.0",
"@theforeman/test": "^13.1.0",
"@theforeman/vendor-core": "^13.1.0",
"@theforeman/vendor-dev": "^13.1.0",
"@types/jest": "<27.0.0",
"argv-parse": "^1.0.1",
"axios-mock-adapter": "^1.1.7",
"babel-eslint": "^10.0.0",
"babel-jest": "^26.3.0",
"babel-loader": "^8.0.0",
"buffer": "^5.7.1",
"cheerio": "1.0.0-rc.10",
"compression-webpack-plugin": "^10.0.0",
"cross-env": "^5.2.0",
"css-loader": "^6.8.1",
"dotenv": "^5.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.3",
"eslint": "^6.7.2",
"eslint-plugin-spellcheck": "0.0.17",
"eslint-plugin-patternfly-react": "0.2.0",
"eslint-plugin-jquery": "^1.5.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react-hooks": "^2.1.1",
"graphql": "^15.5.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.4.0",
"jest-prop-type-error": "^1.1.0",
"jest-svg-transformer": "^1.0.0",
"jest-transform-graphql": "^2.1.0",
"jsx-ast-utils": "^3.3.3",
"path-browserify": "^1.0.1",
"prettier": "^1.19.1",
"pretty-format": "26.6.2",
"react-dnd-test-backend": "^9.4.0",
"react-redux-test-utils": "^0.2.0",
"react-test-renderer": "^17.0.1",
"redux-mock-store": "^1.2.2",
"sass": "~1.60.0",
"sass-loader": "^13.3.2",
Expand All @@ -59,6 +80,7 @@
"stylelint-config-standard": "^18.0.0",
"tabbable": "~5.2.0",
"victory-core": "~36.8.6",
"victory-legend": "~36.8.6",
"victory-pie": "~36.8.6",
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.5.0",
Expand Down
7 changes: 7 additions & 0 deletions script/lint/@foreman/eslint-plugin-custom/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const requireOuiaidRule = require('./require-ouiaid');

module.exports = {
rules: {
'require-ouiaid': requireOuiaidRule,
},
};
Loading
Loading