From ec0d9fd495f7e4e3913cff650d48ccd136795dfd Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Thu, 5 Dec 2024 18:18:10 -0300 Subject: [PATCH 1/3] fix: Use browserslist-config We were installing browserslist-config but not declaring it. This had the effect that webpack - and likely others - were not using it. --- package-lock.json | 11 ++++++----- package.json | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1ded4fb1..3db65357 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,7 +57,7 @@ "whatwg-fetch": "^3.6.2" }, "devDependencies": { - "@edx/browserslist-config": "^1.2.0", + "@edx/browserslist-config": "^1.3.0", "@edx/react-unit-test-utils": "3.0.0", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.0.3", @@ -2048,10 +2048,11 @@ "integrity": "sha512-Dn9CtpC8fovh++Xi4NF5NJoeR9yU2yXZnV9IujxIyGd/dn0Phq5t6dzJVfupwq09mpDnzJv7egA8Znz/3ljO+w==" }, "node_modules/@edx/browserslist-config": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.2.0.tgz", - "integrity": "sha512-T1+6P52Yx7SMkmoIr4O0Q3m/DyRdrLTJbv1xVijdRLFEq1hqdafEs+Ln1423U5LSkTePb9AOkEtL1G0RZLFl1w==", - "dev": true + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.3.0.tgz", + "integrity": "sha512-qf4BHyjdsx/bVMQmfj1y/MwTZwI5+9DAOul+PJnyO+YhWSwdxtdvXqkOw1wLxqmDtqOPc5bYgDQf8zZfe+aDFA==", + "dev": true, + "license": "AGPL-3.0" }, "node_modules/@edx/eslint-config": { "version": "4.0.0", diff --git a/package.json b/package.json index 7f696989..e726170f 100755 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "type": "git", "url": "git+https://github.com/edx/frontend-app-ora-grading.git" }, + "browserslist": [ + "extends @edx/browserslist-config" + ], "scripts": { "build": "fedx-scripts webpack", "i18n_extract": "fedx-scripts formatjs extract", @@ -72,7 +75,7 @@ "whatwg-fetch": "^3.6.2" }, "devDependencies": { - "@edx/browserslist-config": "^1.2.0", + "@edx/browserslist-config": "^1.3.0", "@edx/react-unit-test-utils": "3.0.0", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.0.3", From e5a161e91efe78489f24171cf2729f29fb1baccb Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Fri, 6 Dec 2024 09:28:25 -0300 Subject: [PATCH 2/3] fix: broken download tests Declaring `browserslist` in package.json exposed a bug in the download.js tests that wasn't causing failures before (but arguably, should): one can't use arrow functions to mock constructors because calling `new` on them doesn't work. See the NOTE under: https://jestjs.io/docs/es6-class-mocks#-module-factory-function-must-return-a-function --- src/data/redux/thunkActions/download.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data/redux/thunkActions/download.test.js b/src/data/redux/thunkActions/download.test.js index c94e306a..ca6767b9 100644 --- a/src/data/redux/thunkActions/download.test.js +++ b/src/data/redux/thunkActions/download.test.js @@ -6,9 +6,9 @@ import { RequestKeys } from 'data/constants/requests'; import api from 'data/services/lms/api'; import * as download from './download'; -const mockBlobWriter = jest.fn().mockName('BlobWriter'); -const mockTextReader = jest.fn().mockName('TextReader'); -const mockBlobReader = jest.fn().mockName('BlobReader'); +const mockBlobWriter = jest.fn(); +const mockTextReader = jest.fn(); +const mockBlobReader = jest.fn(); const mockZipAdd = jest.fn(); const mockZipClose = jest.fn(); @@ -21,9 +21,9 @@ jest.mock('@zip.js/zip.js', () => { close: mockZipClose.mockImplementation(() => Promise.resolve(files)), files, })), - BlobWriter: () => mockBlobWriter, - TextReader: () => mockTextReader, - BlobReader: () => mockBlobReader, + BlobWriter: function _() { return mockBlobWriter; }, + TextReader: function _() { return mockTextReader; }, + BlobReader: function _() { return mockBlobReader; }, }; }); From 3f5df84b0692922c9da63e1b1b013397d22f1c2d Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Thu, 5 Dec 2024 18:35:48 -0300 Subject: [PATCH 3/3] chore: remove extraneous file Remove a file that was previously added by mistake. --- webpack.dev-tutor.config.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 webpack.dev-tutor.config.js diff --git a/webpack.dev-tutor.config.js b/webpack.dev-tutor.config.js deleted file mode 100755 index e69de29b..00000000