Skip to content

Conversation

konstantin-msft
Copy link
Collaborator

Clean up BroadcastChannel resources to fix hanging tests

@konstantin-msft konstantin-msft requested a review from a team as a code owner September 11, 2025 21:32
@Copilot Copilot AI review requested due to automatic review settings September 11, 2025 21:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses hanging test issues by implementing proper cleanup of BroadcastChannel resources in the test environment. The changes introduce a tracking mechanism for BroadcastChannel instances to ensure they are properly closed after tests complete.

  • Implements a BroadcastChannel tracking system to monitor active instances
  • Adds automatic cleanup hooks in test environments to prevent resource leaks
  • Removes the --forceExit flag from Jest configuration since proper cleanup eliminates the need to force test termination

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
shared-configs/jest-config/setupGlobals.cjs Integrates BroadcastChannel tracker and replaces global BroadcastChannel with tracked version
shared-configs/jest-config/BroadcastChannelTracker.js Creates shared tracking utility with cleanup functions for different test environments
lib/msal-browser/test/utils/BridgeSetup.ts Adds cleanup hooks using global cleanup functions in afterEach/afterAll
lib/msal-browser/test/app/PCANonBrowser.spec.ts Implements local BroadcastChannel tracking for Node.js environment tests
lib/msal-browser/package.json Removes --forceExit flag from Jest test command
change/@azure-msal-browser-cc7b4b74-d9b1-4614-ab89-ac8dfb792a3f.json Beachball change file documenting the patch

@AzureAD AzureAD deleted a comment from Copilot AI Sep 11, 2025
@konstantin-msft konstantin-msft enabled auto-merge (squash) September 11, 2025 21:57
@konstantin-msft konstantin-msft merged commit e89c75d into msal-v5 Sep 11, 2025
6 checks passed
@konstantin-msft konstantin-msft deleted the fix_hanging_tests branch September 11, 2025 22:27
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.

3 participants