Skip to content

fix(tests): stub ResizeObserver in WorkItemDescriptionEditing suite - #730

Closed
Neonforge98 wants to merge 1 commit into
developfrom
fix/workitem-description-test-resizeobserver
Closed

fix(tests): stub ResizeObserver in WorkItemDescriptionEditing suite#730
Neonforge98 wants to merge 1 commit into
developfrom
fix/workitem-description-test-resizeobserver

Conversation

@Neonforge98

Copy link
Copy Markdown
Collaborator

Problem

The WorkItemDescriptionEditing.test.ts suite added in #722 mounts WorkItemContent, whose useElementDimensions hook constructs a ResizeObserver in a layout effect (src/hooks/ui/layout/useElementDimensions.ts:126). jsdom provides no ResizeObserver, so 6 of the 16 cases throw ReferenceError: ResizeObserver is not defined.

Because PR checks run on the merge commit with develop, this fails the Frontend job of every open PR (first seen on #728, whose diff is unrelated).

Fix

Add the same vi.stubGlobal("ResizeObserver", …) / vi.unstubAllGlobals() pair the sibling HistoryTab.test.ts suite already uses.

Verification

  • Repro on clean develop (bbc207c): npx vitest run …/WorkItemDescriptionEditing.test.ts → 6 failed / 10 passed, identical to CI.
  • After fix: whole __tests__/ dir → 14 files, 66/66 passed.

The suite added in #722 mounts WorkItemContent, whose useElementDimensions
hook constructs a ResizeObserver on layout; jsdom has none, so 6 cases
throw and every open PR's merge-run CI fails. Mirror the stubGlobal /
unstubAllGlobals pattern already used by the sibling HistoryTab suite.

Pre-commit hook ran. Total eslint: 18, total circular: 0
@Neonforge98

Copy link
Copy Markdown
Collaborator Author

Superseded by #729, which fixes the same CI breakage at the root: the runtime guard in useElementDimensions covers every current and future jsdom suite that mounts a consumer of this hook, while this PR only stubbed the one failing file. Verified #729's degradation path is real (the hook's unconditional window-resize fallback + initial measure) before closing. Deleting this branch.

@Neonforge98 Neonforge98 closed this Aug 6, 2026
@Neonforge98
Neonforge98 deleted the fix/workitem-description-test-resizeobserver branch August 6, 2026 17:07
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