✅ Fix React router test state leak#4751
Merged
Merged
Conversation
Reset the React plugin around wrapCreateRouter regression tests so pending onRumInit subscribers do not leak into later specs with randomized test order. The leak caused BrowserStack Firefox unit runs to fail when reactPlugin specs initialized the plugin with a minimal fake public API.
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 0aa05ff | Docs | Datadog PR Page | Give us feedback! |
BeltranBulbarellaDD
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
While investigating #4750, the BrowserStack Firefox unit job failed with
TypeError: rumPublicApi.startView is not a functioninreactPlugin.spec.ts.CI logs: https://gitlab.ddbuild.io/datadog/browser-sdk/-/jobs/1751673091
The failure was order-dependent:
wrapCreateRouterregression tests could register pending React routeronRumInitsubscribers without clearing the React plugin global state, then a later spec initialized the plugin with a minimal fake public API.Changes
Reset the React plugin before the
wrapCreateRouter — initial error forwardingregression tests and register cleanup afterward, so pending subscribers cannot leak into later randomized specs.This only affects test isolation.
Test instructions
yarn test:unit --spec packages/browser-rum-react/src/domain/reactRouter/createRouter.spec.ts --spec packages/browser-rum-react/src/domain/reactPlugin.spec.ts --seed 11837Checklist