feat: upgraded to node v18, added .nvmrc and updated workflows (#151)

This commit is contained in:
Bilal Qamar
2023-05-24 12:56:20 +05:00
committed by GitHub
parent d44b123815
commit 8c29abd0c8
15 changed files with 5408 additions and 29829 deletions

View File

@@ -11,17 +11,17 @@ on:
jobs:
tests:
runs-on: ubuntu-20.04
strategy:
matrix:
node: [16]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Nodejs
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
node-version: ${{ env.NODE_VER }}
- name: Install dependencies
run: npm ci

View File

@@ -10,4 +10,4 @@ on:
jobs:
version-check:
uses: edx/.github/.github/workflows/lockfileversion-check.yml@master
uses: edx/.github/.github/workflows/lockfileversion-check-v3.yml@master

View File

@@ -10,14 +10,17 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 12
node-version: ${{ env.NODE_VER }}
- name: Install dependencies
run: npm ci

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
18.15

35161
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -77,7 +77,7 @@
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
"@edx/frontend-build": "11.0.1",
"@edx/frontend-build": "12.8.27",
"@edx/reactifex": "^2.1.1",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.1.0",
@@ -91,6 +91,6 @@
"react-dev-utils": "^11.0.4",
"react-test-renderer": "^16.14.0",
"redux-mock-store": "^1.5.4",
"semantic-release": "^17.4.5"
"semantic-release": "^20.1.3"
}
}

View File

@@ -36,11 +36,9 @@ export const CourseBanner = ({ cardId }) => {
<Banner>
{formatMessage(messages.auditAccessExpired)}
{' '}
{
<Hyperlink isInline destination="">
{formatMessage(messages.findAnotherCourse)}
</Hyperlink>
}
<Hyperlink isInline destination="">
{formatMessage(messages.findAnotherCourse)}
</Hyperlink>
</Banner>
))}

View File

@@ -17,9 +17,8 @@ const cardId = 'test-card-id';
const state = new MockUseState(hooks);
const numPrograms = 27;
const { formatMessage } = useIntl();
describe('RelatedProgramsBadge hooks', () => {
const { formatMessage } = useIntl();
let out;
describe('state values', () => {
state.testGetter(state.keys.isOpen);

View File

@@ -31,7 +31,7 @@ describe('MasqueradeBar hooks', () => {
isMasqueradingPending: false,
masqueradeErrorStatus: null,
};
const createHook = (masqueradeData = {}, user) => {
const createHook = (masqueradeData = {}, user = undefined) => {
reduxHooks.useMasqueradeData.mockReturnValueOnce({
...defaultMasqueradeData,
...masqueradeData,

View File

@@ -61,8 +61,6 @@ const entitlementData = {
uuid,
};
const { formatMessage } = useIntl();
const testValue = 'test-value';
const courseId = 'test-course-id';
@@ -125,6 +123,7 @@ describe('SelectSessionModal hooks', () => {
});
describe('output', () => {
const { formatMessage } = useIntl();
describe('selectedSession', () => {
it('defaults to current courseId if enrolled', () => {
expect(out.selectedSession).toEqual(courseId);

View File

@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { useSelector, useDispatch } from 'react-redux';
import * as redux from 'data/redux';

View File

@@ -28,9 +28,7 @@ const genRequests = (request) => ({
requests: { [requestKey]: request },
});
const select = (selector, request) => (
mockUseSelector(
selector(requestKey), genRequests(request),
)
mockUseSelector(selector(requestKey), genRequests(request))
);
describe('requests selectors unit tests', () => {
test('requestStatus returns data associated with given key', () => {
@@ -38,8 +36,10 @@ describe('requests selectors unit tests', () => {
});
const testStatusSelector = (selector, matchingRequest) => {
expect(mockUseSelector(selector(requestKey), testState)).toEqual(false);
expect(mockUseSelector(selector(requestKey),
{ requests: { [requestKey]: matchingRequest } })).toEqual(true);
expect(mockUseSelector(
selector(requestKey),
{ requests: { [requestKey]: matchingRequest } },
)).toEqual(true);
};
test('isInactive returns true iff the given request is inactive', () => {
testStatusSelector(selectors.isInactive, inactiveRequest);

View File

@@ -86,8 +86,10 @@ describe('lms api methods', () => {
expect(
api.updateEmailSettings({ courseId, enable: true }),
).toEqual(
utils.post(urls.updateEmailSettings,
{ [apiKeys.courseId]: courseId, ...enableEmailsAction }),
utils.post(
urls.updateEmailSettings,
{ [apiKeys.courseId]: courseId, ...enableEmailsAction },
),
);
});
});
@@ -97,8 +99,10 @@ describe('lms api methods', () => {
expect(
api.unenrollFromCourse({ courseId }),
).toEqual(
utils.post(urls.courseUnenroll,
{ [apiKeys.courseId]: courseId, ...unenrollmentAction }),
utils.post(
urls.courseUnenroll,
{ [apiKeys.courseId]: courseId, ...unenrollmentAction },
),
);
});
});

View File

@@ -56,8 +56,10 @@ describe('course trackers', () => {
describe('upgradeButtonClickedUpsell', () => {
it('creates an event tracker for upgradeButtonClickedUpsell eventwith upsellOptions', () => {
expect(trackers.upgradeButtonClickedUpsell(courseId)).toEqual(
createEventTracker(eventNames.upgradeButtonClickedUpsell,
{ ...trackers.upsellOptions, courseId }),
createEventTracker(
eventNames.upgradeButtonClickedUpsell,
{ ...trackers.upsellOptions, courseId },
),
);
});
});

View File

@@ -22,7 +22,8 @@ describe('find courses trackers', () => {
findCoursesClicked(url);
expect(createEventTracker).toHaveBeenCalledWith(eventNames.findCoursesClicked, defaultProps);
expect(createLinkTracker).toHaveBeenCalledWith(
createEventTracker(eventNames.findCoursesClicked, defaultProps), url,
createEventTracker(eventNames.findCoursesClicked, defaultProps),
url,
);
});