sadpandajoe opened a new pull request, #34871:
URL: https://github.com/apache/superset/pull/34871

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Fixes Jest test hanging issue where tests would hang indefinitely with "Jest 
did not exit one second after the test run has completed" error.
   
     **Root Cause**: `[email protected]` (used by Ant Design v5 components:
      Select, Menu, Picker) creates MessageChannel handles for responsive 
overflow detection that remain open after test completion, causing Jest to hang.
   
     **Solution**: Mock MessageChannel as undefined in the Jest test 
environment (`spec/helpers/jsDomWithFetchAPI.ts`), forcing rc-overflow to use 
its built-in requestAnimationFrame fallback which Jest handles properly.
   
     **Why mocking is safe**:
     - MessageChannel is only used by rc-overflow for **visual overflow 
detection** (deciding when to show "More..." buttons)
     - **JSDOM cannot test visual overflow behavior** - it doesn't provide real 
layout dimensions or `getBoundingClientRect()` values
     - **We're not testing overflow functionality** - our unit tests focus on 
component logic, user interactions, and state management
     - **All functional test coverage preserved** - clicking, selecting, state 
changes, API calls still work normally
     - rc-overflow already has this fallback mechanism built-in for 
environments without MessageChannel
   
     **Impact**:
     - ✅ Fixes Jest hanging in shard 4 tests (ChartList, 
ControlPanelsContainer, SliceHeader, etc.)
     - ✅ Test environment only - no production impact
     - ✅ No loss of meaningful test coverage - visual overflow should be tested 
in E2E tests anyway
   
     **Documentation**:
     - Comprehensive code comments explaining root cause and removal conditions
     - Added "Known Issues and Workarounds" section to development documentation
   
   🤖 Generated with [Claude Code](https://claude.ai/code)
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   Before: 
   When viewing results you'll see this in the comments:
   > PASS packages/superset-ui-core/test/ui-overrides/ExtensionsRegistry.test.ts
   A worker process has failed to exit gracefully and has been force exited. 
This is likely caused by tests leaking due to improper teardown. Try running 
with --detectOpenHandles to find leaks. Active timers can also cause this, 
ensure that .unref() was called on them.
   jest-html-reporter >> Report generated 
(/app/superset-frontend/test-report.html)
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to