Skip to content

Commit

Permalink
chore: regenerate package-lock.json after node16 upgrade
Browse files Browse the repository at this point in the history
[APER-2063]

This PR is for some cleanup after the Node 16 upgrade. The aim here is to update dependencies that will cause issues and to regenerate our `package-lock.json` file in the Credentials repo.

This PR also updates the Credentials repo to use an NPM script to run our linting tests. Previously, we used `gulp` to run our linters, but `gulp` is no longer an active project (no updates since 2019) and doesn't appear to be compatible with later version of Node/NPM.

We will stop running our (bok choy) acceptance tests suite as part of CI with these changes. They don't run successfully anymore after this upgrade and the bok choy framework has been deprecated for awhile now, there is nothing to gain by fixing them at this time.

- regenerate the `package-lock.json` file
- upgrade the `eslint-config-airbnb` and `eslint-plugin-react-hooks` dependencies
- convert linting to be kicked off by NPM script, rather than using our gulpfile
- update Makefile to call NPM script (intstead of Gulp)
- update translation files
- coverage tests in CI are failing because it can't find the firefox browser, add step to install the firefox browser
- don't run (bok choy) acceptance tests as part of our CI
- migrate from running our non-React JS tests with Firefox to Chromium (there is a known issue with headless firefox + Karma + Node16 and running tests in a containerized GitHub/GitHub Action environment). See karma-runner/karma-firefox-launcher#245.
  • Loading branch information
justinhynes committed Nov 22, 2022
1 parent f77a844 commit 24f930d
Show file tree
Hide file tree
Showing 21 changed files with 24,098 additions and 4,026 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
credentials/static/bundles/**/*.js
credentials/static/jsi18n/**/*.js
coverage
node_modules
36 changes: 17 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@ on:
branches: [ master ]

jobs:
acceptance_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: x64
- name: Install Dependencies
run: make requirements
- name: Run Tests
run: |
make static
make accept
quality_and_translations_tests:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -50,7 +35,7 @@ jobs:
matrix:
python-version: ["py38"]
django-version: ["django32"]
node-version: [ 16 ]
node-version: [ 16.14.0 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand All @@ -63,10 +48,10 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: make requirements
- name: Install Firefox
- name: Install Chromium
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y firefox xvfb
sudo apt-get install --no-install-recommends -y chromium-browser xvfb
- name: Run Tests
env:
TOXENV: ${{ matrix.django-version }}
Expand All @@ -76,17 +61,30 @@ jobs:
code_coverage:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["py38"]
django-version: ["django32"]
node-version: [ 16.14.0 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: x64
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: make requirements
- name: Install Chromium
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y chromium-browser xvfb
- name: Run Tests (required for code cov)
env:
TOXENV: django32
TOXENV: ${{ matrix.django-version }}
run: |
make static
make tests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ format_check: ## check that code is formatted correctly
black --check .

quality-js: ## Run JavaScript linter
$(NODE_BIN)/gulp lint
npm run lint

### Testing commands ###

Expand Down
Binary file modified credentials/conf/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions credentials/conf/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2022-07-20 19:49+0000\n"
"PO-Revision-Date: 2022-07-20 19:49:31.869314\n"
"POT-Creation-Date: 2022-11-22 08:35-0500\n"
"PO-Revision-Date: 2022-11-22 13:35:02.798112\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <[email protected]>\n"
"Language: en\n"
Expand Down
Binary file modified credentials/conf/locale/en/LC_MESSAGES/djangojs.mo
Binary file not shown.
13 changes: 7 additions & 6 deletions credentials/conf/locale/en/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2022-07-20 19:49+0000\n"
"PO-Revision-Date: 2022-07-20 19:49:31.866067\n"
"POT-Creation-Date: 2022-11-22 08:35-0500\n"
"PO-Revision-Date: 2022-11-22 13:35:02.804422\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <[email protected]>\n"
"Language: en\n"
Expand Down Expand Up @@ -46,6 +46,7 @@ msgid "You are currently viewing as: {user}"
msgstr ""

#: static/components/MasqueradeBanner.jsx
#: static/components/specs/MasqueradeBanner.test.jsx
msgid "Masquerading failed"
msgstr ""

Expand All @@ -59,6 +60,10 @@ msgstr ""
msgid "Earned"
msgstr ""

#: static/components/ProgramRecord.jsx
msgid "Not Earned"
msgstr ""

#: static/components/ProgramRecord.jsx
msgid "Back to My Records"
msgstr ""
Expand Down Expand Up @@ -111,10 +116,6 @@ msgstr ""
msgid "Completed"
msgstr ""

#: static/components/ProgramRecord.jsx
msgid "Not Earned"
msgstr ""

#: static/components/ProgramRecord.jsx static/components/RecordsList.jsx
msgid "Partially Completed"
msgstr ""
Expand Down
Binary file modified credentials/conf/locale/eo/LC_MESSAGES/django.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions credentials/conf/locale/eo/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2022-07-20 19:49+0000\n"
"PO-Revision-Date: 2022-07-20 19:49:31.869314\n"
"POT-Creation-Date: 2022-11-22 08:35-0500\n"
"PO-Revision-Date: 2022-11-22 13:35:02.798112\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <[email protected]>\n"
"Language: eo\n"
Expand Down
Binary file modified credentials/conf/locale/eo/LC_MESSAGES/djangojs.mo
Binary file not shown.
13 changes: 7 additions & 6 deletions credentials/conf/locale/eo/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2022-07-20 19:49+0000\n"
"PO-Revision-Date: 2022-07-20 19:49:31.866067\n"
"POT-Creation-Date: 2022-11-22 08:35-0500\n"
"PO-Revision-Date: 2022-11-22 13:35:02.804422\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <[email protected]>\n"
"Language: eo\n"
Expand Down Expand Up @@ -47,6 +47,7 @@ msgstr ""
"Ýöü äré çürréntlý vïéwïng äs: {user} Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тє#"

#: static/components/MasqueradeBanner.jsx
#: static/components/specs/MasqueradeBanner.test.jsx
msgid "Masquerading failed"
msgstr "Mäsqüérädïng fäïléd Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт,#"

Expand All @@ -62,6 +63,10 @@ msgstr ""
msgid "Earned"
msgstr "Éärnéd Ⱡ'σяєм ιρѕυ#"

#: static/components/ProgramRecord.jsx
msgid "Not Earned"
msgstr "Nöt Éärnéd Ⱡ'σяєм ιρѕυм ∂σłσ#"

#: static/components/ProgramRecord.jsx
msgid "Back to My Records"
msgstr "Bäçk tö Mý Réçörds Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт#"
Expand Down Expand Up @@ -123,10 +128,6 @@ msgstr "{type} Prögräm Réçörd Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α
msgid "Completed"
msgstr "Çömplétéd Ⱡ'σяєм ιρѕυм ∂σł#"

#: static/components/ProgramRecord.jsx
msgid "Not Earned"
msgstr "Nöt Éärnéd Ⱡ'σяєм ιρѕυм ∂σłσ#"

#: static/components/ProgramRecord.jsx static/components/RecordsList.jsx
msgid "Partially Completed"
msgstr "Pärtïällý Çömplétéd Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт,#"
Expand Down
Binary file modified credentials/conf/locale/rtl/LC_MESSAGES/django.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions credentials/conf/locale/rtl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2022-07-20 19:49+0000\n"
"PO-Revision-Date: 2022-07-20 19:49:31.869314\n"
"POT-Creation-Date: 2022-11-22 08:35-0500\n"
"PO-Revision-Date: 2022-11-22 13:35:02.798112\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <[email protected]>\n"
"Language: rtl\n"
Expand Down
Binary file modified credentials/conf/locale/rtl/LC_MESSAGES/djangojs.mo
Binary file not shown.
13 changes: 7 additions & 6 deletions credentials/conf/locale/rtl/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2022-07-20 19:49+0000\n"
"PO-Revision-Date: 2022-07-20 19:49:31.866067\n"
"POT-Creation-Date: 2022-11-22 08:35-0500\n"
"PO-Revision-Date: 2022-11-22 13:35:02.804422\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <[email protected]>\n"
"Language: rtl\n"
Expand Down Expand Up @@ -46,6 +46,7 @@ msgid "You are currently viewing as: {user}"
msgstr "Ɏøn ɐɹǝ ɔnɹɹǝnʇlʎ ʌᴉǝʍᴉnƃ ɐs: {user}"

#: static/components/MasqueradeBanner.jsx
#: static/components/specs/MasqueradeBanner.test.jsx
msgid "Masquerading failed"
msgstr "Mɐsbnǝɹɐdᴉnƃ ɟɐᴉlǝd"

Expand All @@ -61,6 +62,10 @@ msgstr ""
msgid "Earned"
msgstr "Ɇɐɹnǝd"

#: static/components/ProgramRecord.jsx
msgid "Not Earned"
msgstr "Nøʇ Ɇɐɹnǝd"

#: static/components/ProgramRecord.jsx
msgid "Back to My Records"
msgstr "Ƀɐɔʞ ʇø Mʎ Ɍǝɔøɹds"
Expand Down Expand Up @@ -117,10 +122,6 @@ msgstr "{type} Ᵽɹøƃɹɐɯ Ɍǝɔøɹd"
msgid "Completed"
msgstr "Ȼøɯdlǝʇǝd"

#: static/components/ProgramRecord.jsx
msgid "Not Earned"
msgstr "Nøʇ Ɇɐɹnǝd"

#: static/components/ProgramRecord.jsx static/components/RecordsList.jsx
msgid "Partially Completed"
msgstr "Ᵽɐɹʇᴉɐllʎ Ȼøɯdlǝʇǝd"
Expand Down
1 change: 1 addition & 0 deletions credentials/static/components/ProgramIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// TODO: We should be able to remove this as part of https://github.com/openedx/credentials/issues/1722
/* eslint-disable react/function-component-definition */
import React from 'react';
import PropTypes from 'prop-types';

Expand Down
29 changes: 19 additions & 10 deletions credentials/static/components/ProgramRecord.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,14 @@ class ProgramRecord extends React.Component {
// Send all requeests and update success and failure statuses
// Disabling eslint error since make_translations fails when using backticks
// eslint-disable-next-line prefer-template
axios.all(orgs.map(org => axios.post('/records/programs/' + uuid + '/send',
{ username: this.props.learner.username, pathway_id: this.creditPathways[org].id },
headers)
axios.all(orgs.map(org => axios.post(
'/records/programs/' + uuid + '/send',
{
username: this.props.learner.username,
pathway_id: this.creditPathways[org].id,
},
headers,
)
.then((response) => {
if (response.status >= 200 && response.status < 300) {
successOrgs.push(org);
Expand Down Expand Up @@ -302,6 +307,7 @@ class ProgramRecord extends React.Component {
/>
</div>
)}
{/* eslint-disable react/no-unstable-nested-components */}
<Alert
variant="info"
show={this.state.sendRecordLoadingAlertOpen}
Expand All @@ -319,8 +325,10 @@ class ProgramRecord extends React.Component {
>
<Alert.Heading>{ gettext('We were unable to send your program record.') }</Alert.Heading>
<span className="alert-body">
{StringUtils.interpolate(gettext('We were unable to send your record to {orgs}. You can attempt to send this record again. Contact support if this issue persists.'),
{ orgs: StringUtils.formatStringList(this.state.sendRecordFailureOrgs) })}
{StringUtils.interpolate(
gettext('We were unable to send your record to {orgs}. You can attempt to send this record again. Contact support if this issue persists.'),
{ orgs: StringUtils.formatStringList(this.state.sendRecordFailureOrgs) },
)}
</span>
</Alert>
<Alert
Expand All @@ -331,8 +339,10 @@ class ProgramRecord extends React.Component {
>
<Alert.Heading>{ gettext('You have successfully shared your Learner Record') }</Alert.Heading>
<span className="alert-body">
{StringUtils.interpolate(gettext('You have sent your record to {orgs}. Next, ensure you understand their application process.'),
{ orgs: StringUtils.formatStringList(this.state.sendRecordSuccessOrgs) })}
{StringUtils.interpolate(
gettext('You have sent your record to {orgs}. Next, ensure you understand their application process.'),
{ orgs: StringUtils.formatStringList(this.state.sendRecordSuccessOrgs) },
)}
</span>
</Alert>
<article className="program-record">
Expand All @@ -355,9 +365,8 @@ class ProgramRecord extends React.Component {
}
<span className="updated">
{ StringUtils.interpolate(
gettext('Last Updated {date}'), {
date: this.formatDate(program.last_updated),
},
gettext('Last Updated {date}'),
{ date: this.formatDate(program.last_updated) },
)}
</span>
</div>
Expand Down
1 change: 1 addition & 0 deletions credentials/static/components/RecordsHelp.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// TODO: We should be able to remove this as part of https://github.com/openedx/credentials/issues/1722
/* eslint-disable react/function-component-definition */
import React from 'react';
import PropTypes from 'prop-types';
import StringUtils from './Utils';
Expand Down
9 changes: 5 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const webpackConfig = require('./webpack.config.js');
delete webpackConfig.entry;

process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function (config) {
config.set({

Expand Down Expand Up @@ -35,9 +37,9 @@ module.exports = function (config) {

// enabled plugins
plugins: [
'karma-chrome-launcher',
'karma-jasmine-jquery-2',
'karma-jasmine',
'karma-firefox-launcher',
'karma-coverage',
'karma-spec-reporter',
'karma-webpack',
Expand Down Expand Up @@ -74,11 +76,10 @@ module.exports = function (config) {
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['FirefoxHeadless'],

// browsers: ['FirefoxHeadless'],
browsers: ['ChromiumHeadless'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
Expand Down
Loading

0 comments on commit 24f930d

Please sign in to comment.