Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated frontend-build & frontend-platform major versions #256

Merged
merged 15 commits into from
May 30, 2024

Conversation

BilalQamar95
Copy link
Contributor

@BilalQamar95 BilalQamar95 commented Dec 5, 2023

Description
Major version upgrades, Updating frontend-build to v14 & frontend-platform to v8 along with respective edx packages

@BilalQamar95 BilalQamar95 force-pushed the bilalqamar95/jest-v29-upgrade branch from 0bc0937 to c405bc6 Compare December 5, 2023 11:18
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.36%. Comparing base (5cd8b00) to head (0bc0937).
Report is 30 commits behind head on master.

Current head 0bc0937 differs from pull request most recent head 506f8f7

Please upload reports for the commit 506f8f7 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #256      +/-   ##
==========================================
+ Coverage   96.23%   96.36%   +0.12%     
==========================================
  Files         184      194      +10     
  Lines        1751     1841      +90     
  Branches      308      324      +16     
==========================================
+ Hits         1685     1774      +89     
  Misses         62       62              
- Partials        4        5       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BilalQamar95 BilalQamar95 changed the title chore: bumped jest to v29 feat: updated frontend-build & frontend-platform major versions Apr 24, 2024
@deborahgu
Copy link
Member

is this work still in progress or can we go ahead and close this PR? if it's still in progress, anything we can do to help out with it?

@BilalQamar95 BilalQamar95 force-pushed the bilalqamar95/jest-v29-upgrade branch from a0483d4 to 37bb54d Compare May 16, 2024 11:43
@BilalQamar95
Copy link
Contributor Author

is this work still in progress or can we go ahead and close this PR? if it's still in progress, anything we can do to help out with it?

Yes @deborahgu this is still a work in progress, it is depending on the merger of upgrade PRs for parent MFEs to resolve dependency issues. react-unit-test-utils was updated, I'm currently waiting on frontend-plugin-framework#59 after which this PR will be updated/ready for review

@BilalQamar95 BilalQamar95 marked this pull request as ready for review May 17, 2024 11:57
@BilalQamar95 BilalQamar95 requested a review from a team as a code owner May 17, 2024 11:57
@BilalQamar95
Copy link
Contributor Author

@deborahgu this PR is now ready for review

@jsnwesson
Copy link
Contributor

I think this looks good to me, but my one concern is that 18 tests are failing locally due to three different errors:

  • TypeError: Cannot read properties of undefined (reading 'default')
    • import '@testing-library/jest-dom/extend-expect';
    • example above found in test files like App.test.jsx
  • TypeError: Cannot read properties of undefined (reading 'getConfig')
    • export const routePath = ${getConfig().PUBLIC_PATH}:courseId;
  • TypeError: Cannot read properties of undefined (reading 'notEnrolled')
    • [FilterKeys.notEnrolled]: (course) => !course.enrollment.isEnrolled,
    • example above found in test file FilterForm.test.jsx

@BilalQamar95
Copy link
Contributor Author

I think this looks good to me, but my one concern is that 18 tests are failing locally due to three different errors:

  • TypeError: Cannot read properties of undefined (reading 'default')

    • import '@testing-library/jest-dom/extend-expect';
    • example above found in test files like App.test.jsx
  • TypeError: Cannot read properties of undefined (reading 'getConfig')

    • export const routePath = ${getConfig().PUBLIC_PATH}:courseId;
  • TypeError: Cannot read properties of undefined (reading 'notEnrolled')

    • [FilterKeys.notEnrolled]: (course) => !course.enrollment.isEnrolled,
    • example above found in test file FilterForm.test.jsx

@jsnwesson I have tried running the tests locally again, and all tests are passing successfully for me. My team members have also confirmed that they are not encountering any test failures. It would be helpful if you could provide more details so we can better understand and reproduce the issue

node: v18.20.2
npm: 10.5.0
Screenshot 2024-05-21 at 4 35 05 PM

@justinhynes
Copy link
Contributor

FWIW, I am also seeing tests failing locally:
image

I pulled the latest changes, switched to the bilalqamar95/jest-v29-upgrade branch, and issued an npm ci to install dependencies. I ran tests with the npm test command.

Raw logs from local test run uploaded here:
local_logs.txt

@BilalQamar95
Copy link
Contributor Author

This is strange, I have been unable to re-produce this issue following exact same steps (same node and npm versions), my other team members also did a clean installation from this branch and ran tests without any issues. Also re-ran the CI tests just in case, all cleared.

I checked the logs. and a lot of the issues are related to TypeError: Cannot read properties of undefined (reading 'getConfig'), getConfig is imported from @edx/frontend-platform which could indicate that maybe there was an issue with the installation? @justinhynes can you please try a clean installation and see if that works?

rm -rf node_modules
npm ci 

@justinhynes
Copy link
Contributor

I'll try this now.

@justinhynes
Copy link
Contributor

justinhynes commented May 22, 2024

Unfortunately, I'm having the same issue. After deleting my node_modules/ folder, reinstalling dependencies (npm ci) and running tests (npm test), I am still having the same 19 tests fail.

🤔

@jsnwesson
Copy link
Contributor

@justinhynes well, I managed to find the problem! Once I deleted my env.config.js, all of the tests passed! Now a new concern is: why did the tests fail with the env.config.js that I had, and can we be confident that this won't be the case for our stage/production builds?

import { PLUGIN_OPERATIONS, DIRECT_PLUGIN } from "@openedx/frontend-plugin-framework";

import RecommendationsPanel from 'widgets/RecommendationsPanel';

const config = {
  pluginSlots: {
    course_list: {
      keepDefault: true,
      plugins: [
        // {
        //   op: PLUGIN_OPERATIONS.Insert,
        //   widget: {
        //     id: 'recommendations_plugin',
        //     type: DIRECT_PLUGIN,
        //     priority: 60,
        //     RenderWidget: RecommendationsPanel,
        //   },
        // },
      ],
    },
    widget_sidebar_plugin_slot: {
      keepDefault: true,
      plugins: [
        // {
        //   op: PLUGIN_OPERATIONS.Insert,
        //   widget: {
        //     id: 'recommendations_plugin',
        //     type: DIRECT_PLUGIN,
        //     priority: 60,
        //     RenderWidget: RecommendationsPanel,
        //   },
        // },
      ],
    },
  },
};

export default config;

Copy link
Contributor

@jsnwesson jsnwesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make it clear, I think this code looks good and can move forward once the package-lock conflicts are resolved.

@BilalQamar95 BilalQamar95 merged commit 17c5fd0 into master May 30, 2024
4 checks passed
@BilalQamar95 BilalQamar95 deleted the bilalqamar95/jest-v29-upgrade branch May 30, 2024 12:14
@BilalQamar95 BilalQamar95 self-assigned this Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants