Skip to content

Commit

Permalink
Refs #37882 - update tests to npm8
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga committed Oct 30, 2024
1 parent e3a26fc commit 005f580
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/foreman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: use npm 8
run: npm i -g npm@8 --registry=https://registry.npmjs.org
- name: Setup NPM Cache
uses: actions/cache@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/js_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: use npm 8
run: npm i -g npm@8 --registry=https://registry.npmjs.org
- name: Generate npm dependencies package-lock
run: npm install --package-lock-only --no-audit
- name: Install npm dependencies
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/plugins_react_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: use npm 8
run: npm i -g npm@8 --registry=https://registry.npmjs.org
- name: "Set up Ruby ${{ matrix.ruby }}"
uses: ruby/setup-ruby@v1
with:
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@
"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",
"react-test-renderer": "^16.9.0",
"mini-css-extract-plugin": "^2.9.1",
"redux-mock-store": "^1.2.2",
"sass": "~1.60.0",
Expand All @@ -148,9 +147,9 @@
"stylelint": "^9.3.0",
"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",
"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",
"webpack-cli": "^5.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mockWindowLocation } from './testHelpers';
import { visit } from '../../foreman_navigation';
import { visit } from './helpers';
import {
urlBuilder,
urlWithSearch,
Expand Down
11 changes: 11 additions & 0 deletions webpack/core_test_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ jest.mock('./assets/javascripts/foreman_tools', () => ({
foremanUrl: url => url,
}));
jest.mock('./assets/javascripts/foreman_navigation');

jest.mock('./assets/javascripts/react_app/common/helpers', () => {
const helpers = jest.requireActual(
'./assets/javascripts/react_app/common/helpers'
);
return {
...helpers,
visit: jest.fn(),
reloadPage: jest.fn(),
};
});

0 comments on commit 005f580

Please sign in to comment.