Skip to content

CONSOLE-5308: Centralize ResizeObserver polyfill in Jest setup for unit tests#16506

Open
cajieh wants to merge 1 commit into
openshift:mainfrom
cajieh:centralize-resizeObserver-polyfil-jest-setup
Open

CONSOLE-5308: Centralize ResizeObserver polyfill in Jest setup for unit tests#16506
cajieh wants to merge 1 commit into
openshift:mainfrom
cajieh:centralize-resizeObserver-polyfil-jest-setup

Conversation

@cajieh
Copy link
Copy Markdown
Contributor

@cajieh cajieh commented May 27, 2026

CONSOLE-5308: Centralize ResizeObserver polyfill in Jest setup for unit tests
Analysis / Root cause:
Unit test clean up

Solution description:
Centralize ResizeObserver polyfill in Jest setup for unit tests and removed from affected specs
Screenshots / screen recording:
N/A

Test setup:

Test cases:
N/A

Browser conformance:
N/A

Additional info:
N/A

Reviewers and assignees:

Summary by CodeRabbit

  • Tests
    • Added a global ResizeObserver mock that is loaded during test initialization.
    • Removed per-test ResizeObserver stubs across multiple test suites, consolidating the setup and reducing duplicated test setup.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 27, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 27, 2026

@cajieh: This pull request references CONSOLE-5308 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

CONSOLE-5308: Centralize ResizeObserver polyfill in Jest setup for unit tests
Analysis / Root cause:
Unit test clean up

Solution description:
Centralize ResizeObserver polyfill in Jest setup for unit tests and removed from affected specs
Screenshots / screen recording:
N/A

Test setup:

Test cases:
N/A

Browser conformance:
N/A

Additional info:
N/A

Reviewers and assignees:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 86f82c86-d102-44e5-8372-462f8c896ed7

📥 Commits

Reviewing files that changed from the base of the PR and between 9f956b8 and aeacc1d.

📒 Files selected for processing (8)
  • frontend/__mocks__/resizeObserver.js
  • frontend/package.json
  • frontend/packages/console-shared/src/components/form-utils/__tests__/FormFooter.spec.tsx
  • frontend/packages/dev-console/src/components/deployments/__tests__/DeploymentForm.spec.tsx
  • frontend/packages/dev-console/src/components/edit-application/__tests__/EditApplicationForm.spec.tsx
  • frontend/packages/dev-console/src/components/health-checks/__tests__/AddHealthChecks.spec.tsx
  • frontend/packages/knative-plugin/src/components/add/__tests__/EventSource.spec.tsx
  • frontend/public/components/__tests__/command-line-tools.spec.tsx
💤 Files with no reviewable changes (6)
  • frontend/packages/console-shared/src/components/form-utils/tests/FormFooter.spec.tsx
  • frontend/public/components/tests/command-line-tools.spec.tsx
  • frontend/packages/dev-console/src/components/health-checks/tests/AddHealthChecks.spec.tsx
  • frontend/packages/dev-console/src/components/edit-application/tests/EditApplicationForm.spec.tsx
  • frontend/packages/dev-console/src/components/deployments/tests/DeploymentForm.spec.tsx
  • frontend/packages/knative-plugin/src/components/add/tests/EventSource.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/package.json
  • frontend/mocks/resizeObserver.js

Walkthrough

This PR centralizes the ResizeObserver mock by adding a global mock file and registering it in Jest setupFiles, and removes duplicate test-local ResizeObserver stubs from several frontend test files.

Changes

Consolidate ResizeObserver mocking

Layer / File(s) Summary
Centralized ResizeObserver mock
frontend/__mocks__/resizeObserver.js, frontend/package.json
New mock file defines global.ResizeObserver with stubbed observe, unobserve, and disconnect methods. Jest setupFiles now includes this mock so it runs during test initialization.
Remove test-local mocks
frontend/packages/console-shared/src/components/form-utils/__tests__/FormFooter.spec.tsx, frontend/packages/dev-console/src/components/deployments/__tests__/DeploymentForm.spec.tsx, frontend/packages/dev-console/src/components/edit-application/__tests__/EditApplicationForm.spec.tsx, frontend/packages/dev-console/src/components/health-checks/__tests__/AddHealthChecks.spec.tsx, frontend/packages/knative-plugin/src/components/add/__tests__/EventSource.spec.tsx, frontend/public/components/__tests__/command-line-tools.spec.tsx
Removed local global/window.ResizeObserver stub class definitions from six test files so they rely on the centralized Jest setup mock.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: centralizing the ResizeObserver polyfill in Jest setup, which is exactly what the changeset implements.
Description check ✅ Passed The description includes the required Jira prefix, analysis/root cause, and solution description, though some template sections are marked N/A rather than filled out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The custom check for Ginkgo test name stability is not applicable to this PR. The PR only modifies JavaScript/TypeScript Jest tests, not Go Ginkgo tests. The repository does not appear to use Ginkgo.
Test Structure And Quality ✅ Passed Custom check for Ginkgo test code is not applicable; PR modifies only Jest/TypeScript frontend tests and configuration, containing no Go or Ginkgo test code.
Microshift Test Compatibility ✅ Passed PR adds only frontend Jest test changes; no Ginkgo e2e tests are introduced. Custom check applies only to Ginkgo e2e tests, so it is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR contains only frontend Jest unit tests (.tsx, .js files), not Ginkgo e2e tests. The custom check applies only to Ginkgo e2e tests with multi-node/HA assumptions. No Ginkgo tests are present.
Topology-Aware Scheduling Compatibility ✅ Passed PR contains only frontend test setup changes (Jest mocks, no Kubernetes manifests or operator code), making the topology-aware scheduling check not applicable.
Ote Binary Stdout Contract ✅ Passed PR modifies only frontend Jest test setup (JS/TS files). OTE Binary Stdout Contract applies to Go binaries; this PR contains no Go code or process-level stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR modifies only frontend Jest unit tests (.spec.tsx files) and Jest configuration. No Ginkgo e2e tests present, so IPv6/disconnected network check does not apply.
No-Weak-Crypto ✅ Passed PR contains no cryptographic code; it only centralizes ResizeObserver mock in Jest setup, which is unrelated to the no-weak-crypto check.
Container-Privileges ✅ Passed PR modifies only frontend test files and Jest configuration; no container, Kubernetes manifests, or security configurations present. Check is not applicable.
No-Sensitive-Data-In-Logs ✅ Passed PR contains no logging exposing sensitive data. Changes are test infrastructure only: ResizeObserver mock class and Jest setup configuration with zero console output or sensitive information.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from rhamilto and spadgett May 27, 2026 14:25
@openshift-ci openshift-ci Bot added component/core Related to console core functionality component/dev-console Related to dev-console approved Indicates a PR has been approved by an approver from all required OWNERS files. component/knative Related to knative-plugin component/shared Related to console-shared labels May 27, 2026
@cajieh cajieh force-pushed the centralize-resizeObserver-polyfil-jest-setup branch from 9f956b8 to aeacc1d Compare May 27, 2026 19:40
@cajieh
Copy link
Copy Markdown
Contributor Author

cajieh commented May 28, 2026

/retest

@logonoff
Copy link
Copy Markdown
Member

/lgtm
/label px-approved
/label docs-approved
/verified by tests

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 28, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cajieh, logonoff

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels May 28, 2026
@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 28, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@logonoff: This PR has been marked as verified by tests.

Details

In response to this:

/lgtm
/label px-approved
/label docs-approved
/verified by tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 28, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD c38dedf and 2 for PR HEAD aeacc1d in total

@cajieh
Copy link
Copy Markdown
Contributor Author

cajieh commented May 28, 2026

/lgtm /label px-approved /label docs-approved /verified by tests

@logonoff Thank you.

@cajieh
Copy link
Copy Markdown
Contributor Author

cajieh commented May 28, 2026

/test e2e-gcp-console

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 28, 2026

@cajieh: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dev-console Related to dev-console component/knative Related to knative-plugin component/shared Related to console-shared docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants