Skip to content

Commit 005f580

Browse files
committedOct 30, 2024
Refs #37882 - update tests to npm8
1 parent e3a26fc commit 005f580

File tree

6 files changed

+22
-6
lines changed

6 files changed

+22
-6
lines changed
 

‎.github/workflows/foreman.yml

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ jobs:
9393
uses: actions/setup-node@v4
9494
with:
9595
node-version: ${{ matrix.node }}
96+
- name: use npm 8
97+
run: npm i -g npm@8 --registry=https://registry.npmjs.org
9698
- name: Setup NPM Cache
9799
uses: actions/cache@v4
98100
with:

‎.github/workflows/js_tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
uses: actions/setup-node@v4
4747
with:
4848
node-version: ${{ matrix.node }}
49+
- name: use npm 8
50+
run: npm i -g npm@8 --registry=https://registry.npmjs.org
4951
- name: Generate npm dependencies package-lock
5052
run: npm install --package-lock-only --no-audit
5153
- name: Install npm dependencies

‎.github/workflows/plugins_react_tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
uses: actions/setup-node@v4
4949
with:
5050
node-version: ${{ matrix.node }}
51+
- name: use npm 8
52+
run: npm i -g npm@8 --registry=https://registry.npmjs.org
5153
- name: "Set up Ruby ${{ matrix.ruby }}"
5254
uses: ruby/setup-ruby@v1
5355
with:

‎package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@
138138
"prettier": "^1.19.1",
139139
"pretty-format": "26.6.2",
140140
"react-dnd-test-backend": "^9.4.0",
141-
"react-redux-test-utils": "^0.2.0",
142-
"react-test-renderer": "^17.0.1",
141+
"react-test-renderer": "^16.9.0",
143142
"mini-css-extract-plugin": "^2.9.1",
144143
"redux-mock-store": "^1.2.2",
145144
"sass": "~1.60.0",
@@ -148,9 +147,9 @@
148147
"stylelint": "^9.3.0",
149148
"stylelint-config-standard": "^18.0.0",
150149
"tabbable": "~5.2.0",
151-
"victory-core": "~36.8.6",
152-
"victory-legend": "~36.8.6",
153-
"victory-pie": "~36.8.6",
150+
"victory-core": "36.8.6",
151+
"victory-legend": "36.8.6",
152+
"victory-pie": "36.8.6",
154153
"webpack": "^5.75.0",
155154
"webpack-bundle-analyzer": "^4.5.0",
156155
"webpack-cli": "^5.0.1",

‎webpack/assets/javascripts/react_app/common/urlHelpers.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mockWindowLocation } from './testHelpers';
2-
import { visit } from '../../foreman_navigation';
2+
import { visit } from './helpers';
33
import {
44
urlBuilder,
55
urlWithSearch,

‎webpack/core_test_setup.js

+11
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,14 @@ jest.mock('./assets/javascripts/foreman_tools', () => ({
2626
foremanUrl: url => url,
2727
}));
2828
jest.mock('./assets/javascripts/foreman_navigation');
29+
30+
jest.mock('./assets/javascripts/react_app/common/helpers', () => {
31+
const helpers = jest.requireActual(
32+
'./assets/javascripts/react_app/common/helpers'
33+
);
34+
return {
35+
...helpers,
36+
visit: jest.fn(),
37+
reloadPage: jest.fn(),
38+
};
39+
});

0 commit comments

Comments
 (0)