Skip to content

chore(deps): bump jsdom to 30 with test harness fixes - #1598

Merged
Soju06 merged 1 commit into
mainfrom
chore/jsdom-30-with-harness-fixes
Aug 4, 2026
Merged

chore(deps): bump jsdom to 30 with test harness fixes#1598
Soju06 merged 1 commit into
mainfrom
chore/jsdom-30-with-harness-fixes

Conversation

@Soju06

@Soju06 Soju06 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Bumps jsdom from 29.1.1 to 30.0.1 in /frontend and updates the 7 test assertions that break under jsdom 30's new CSS value pipeline.

Supersedes the blocked dependabot bump #1586 (dependabot can bump the dependency but cannot carry the harness fixes, so its CI is deterministically red — see the failure analysis on #1514). Once main is on 30.0.1, dependabot will auto-close/rebase #1586.

Why the tests break (jsdom 30 behavior changes, not app regressions)

Component inline styles are unchanged; only jsdom's serialization changed:

  1. calc() simplification — jsdom 30 simplifies calc() before serialization (matching browsers), so authored expressions no longer round-trip. This applies to the inline style itself, not just computed style: el.style.maxHeight = "calc(5 * 1.75rem)" now reads back as "calc(8.75rem)".
  2. getComputedStyle() length→px conversiontoHaveStyle routes through getComputedStyle, which now converts lengths (incl. ch) to pixel values dependent on jsdom's font metrics.

The 7 assertion updates (per the list on #1514)

All switched from toHaveStyle (computed style) to asserting the raw inline style property, which avoids depending on jsdom's font metrics:

File Before After
src/components/donut-chart.test.tsx toHaveStyle({ maxHeight: "calc(5 * 1.75rem)" }) .style.maxHeight"calc(8.75rem)"
src/features/apis/components/account-cost-donut.test.tsx toHaveStyle({ maxHeight: "calc(5 * 1.75rem + 4 * 0rem)" }) .style.maxHeight"calc(8.75rem)"
src/features/dashboard/components/account-cards.test.tsx toHaveStyle({ maxHeight: "calc(2 * 11.5rem + 1rem)" }) .style.maxHeight"calc(24rem)"
src/features/reports/components/model-distribution-donut.test.tsx toHaveStyle({ maxHeight: "calc(4 * 2rem)" }) .style.maxHeight"calc(8rem)"
src/features/reports/components/model-distribution-donut.test.tsx toHaveStyle({ minWidth: "7ch" }) ×2 .style.minWidth"7ch" (authored form preserved on inline style)
src/features/reports/components/useragent-distribution-donut.test.tsx toHaveStyle({ maxHeight: "calc(4 * 2rem)" }) .style.maxHeight"calc(8rem)"
src/features/reports/components/useragent-distribution-donut.test.tsx toHaveStyle({ minWidth: "4ch" }) ×2 .style.minWidth"4ch" (authored form preserved on inline style)

Note on the approach suggested in #1514: asserting the raw style attribute with the authored calc string (stringContaining("calc(5 * 1.75rem)")) doesn't survive jsdom 30 either — the CSSOM simplifies calc at parse time, so even getAttribute("style") reports the simplified form. The simplified expected strings are the closest stable pin; the ch assertions do keep their authored values via the inline style. Original authored expressions are preserved in comments next to each assertion.

Verification (local, bun 1.3.14 — same as CI)

Also note from #1514: jsdom 30 raises the Node.js floor to ^22.22.2 || ^24.15.0 || >=26.0.0. CI runs the suite under Bun (unaffected); local vitest under older Node will hit the engines wall.

Refs #1586, #1514

🤖 Generated with Claude Code

Bumps jsdom from 29.1.1 to 30.0.1 in /frontend, together with the 7
test-assertion updates that the dependabot bump (#1586) cannot carry.
Supersedes dependabot's blocked bump; dependabot will auto-close/rebase
once main is on 30.0.1.

jsdom 30 intentionally changed CSS serialization (see #1514 discussion):
- calc() is simplified before serialization, even for inline styles,
  so authored expressions like calc(5 * 1.75rem) now serialize as
  calc(8.75rem)
- getComputedStyle() converts length values to pixels, so ch-unit
  expectations via toHaveStyle no longer match

The affected assertions now check the raw inline style property
(element.style.X) instead of routing through getComputedStyle:
simplified calc forms for the 5 maxHeight assertions, and authored
ch values (preserved on the inline style) for the 2 minWidth ones.
Component code is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Soju06
Soju06 merged commit c7e0988 into main Aug 4, 2026
36 checks passed
@Soju06
Soju06 deleted the chore/jsdom-30-with-harness-fixes branch August 4, 2026 10:46
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.

1 participant