Pin nwsapi to 2.2.24 to fix jsdom selector recursion - #2515
Closed
ravikiranvm wants to merge 1 commit into
Closed
ravikiranvm wants to merge 1 commit into
ravikiranvm wants to merge 1 commit into
Conversation
nwsapi 2.2.25-2.2.27 implement :modal/:popover-open/:fullscreen by
delegating to Element.matches, which under jsdom re-enters nwsapi and
recurses to a swallowed stack overflow. floating-ui calls matches(':modal')
while positioning every Radix popper, so tests that open a dropdown,
popover, select or tooltip take 7-10 s and hit the 5 s Jest timeout.
Pin to the last good release until dperini/nwsapi#214's fix is published.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Fixes OPS-4838.
Pins
nwsapi(jsdom's CSS selector engine, transitive viajest-environment-jsdom→jsdom@26) to 2.2.24 through the rootoverridesblock. Test-only dependency; no runtime code changes.Additional Notes
Why
nwsapifrom 2.2.24 to 2.2.27.:modal/:popover-open/:fullscreenby delegating toElement.matches. Under jsdom there is no native matcher, so the call re-enters nwsapi and recurses to a stack overflow that atry/catchswallows. Onematches(':modal')costs ~150 ms.isTopLayer()callsmatches(':modal')while positioning every Radix popper. Any test that opens a DropdownMenu, Popover, Select or Tooltip now takes 7–10 s and hits the 5 s Jest timeout.Test UIjob has been red onmainsince 2026-09-10 for exactly this reason. Landing the pin here fixes both via the sync.Upstream
master(715f652), not yet published to npm (latest is 2.2.27, master is2.3.0-prerelease). Remove this override once a release containing that commit ships.Alternatives considered
testTimeouton affected tests: tests still take 7–10 s each, suites run for minutes, every future popper test pays the same cost. Rejected.userEvent.setup()instances: measured 8.5–10.2 s for the same click across four user-event configurations. The time is in floating-ui, not user-event. Rejected.Element.prototype.matchesin Jest setup to return false for the display-state pseudo-classes: works (59 ms), but monkey-patches a DOM prototype in every jsdom test and hides real:open/:closedstate. The pin is smaller and sits at the root cause.Safety of the rollback
THIRD_PARTY_LICENSES.txtis unaffected since the generator only covers production deps.:autofillaliases, a:has()sibling fix and:focus-visible/:focus-withinfixes. Nothing in either repo passes these toquerySelector/matches; the only hits are Tailwind class strings jsdom never evaluates.Testing Checklist
What was run
npm installresolvesjest-environment-jsdom/node_modules/nwsapi@2.2.24; bare jsdom 26matches(':modal')now throwsunknown pseudo-classin 3 ms instead of taking 151 ms.nx test ui-components: 203 tests pass.campaign-card.test.tsx85 s → 1.8 s;nx test ui-components311 pass (14.6 s);nx test react-ui1393 pass (20.1 s).🤖 Generated with Claude Code