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

Fix exception when BroadcastChannel is not available in JS Runtime #7569

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

codexeon
Copy link
Collaborator

There is an exception when calling createNestablePublicClientApplication in JS Runtime due to BroadcastChannel not being available in that environment. Unfortunately, the JS Runtime test missed this because BroadcastChannel is now available in node by default.

@@ -39,6 +42,7 @@ describe("JS Runtime Nested App Auth", () => {
// Remove global properties that can be reset after test that don't have full implementations in JS Runtime
deleteGlobalProperty("crypto");
deleteGlobalProperty("TextEncoder");
deleteGlobalProperty("BroadcastChannel");
Copy link
Collaborator

Choose a reason for hiding this comment

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

To catch future issues related to globals I'd recommend creating your own jest environment that more closely approximates the JS Runtime

@codexeon codexeon force-pushed the dasau/jsruntime_broadcastchannel_fix branch from 1795cc7 to 2588ac2 Compare February 19, 2025 22:09
@codexeon codexeon force-pushed the dasau/jsruntime_broadcastchannel_fix branch from 2588ac2 to aaedddc Compare February 21, 2025 21:34
@codexeon codexeon force-pushed the dasau/jsruntime_broadcastchannel_fix branch from aaedddc to 496f047 Compare February 27, 2025 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-browser Related to msal-browser package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants