Skip to content

Migrate to jsdom#1947

Merged
hshoff merged 3 commits intomasterfrom
hshoff-jsdom
Nov 2, 2025
Merged

Migrate to jsdom#1947
hshoff merged 3 commits intomasterfrom
hshoff-jsdom

Conversation

@hshoff
Copy link
Member

@hshoff hshoff commented Nov 1, 2025

🏠 Internal

  • Replace happy-dom with jsdom (27.0.0) for better DOM compatibility
  • Add @vitest/eslint-plugin (^1.4.0) with legacy-recommended preset
  • Add vitest/globals types to test tsconfig files to fix TypeScript errors
  • Update all vitest configs to use jsdom environment
  • Fix TooltipWithBounds test for jsdom style computation

- Replace happy-dom with jsdom (^27.1.0) for better DOM compatibility
- Add @vitest/eslint-plugin (^1.4.0) with legacy-recommended preset
- Add vitest/globals types to test tsconfig files to fix TypeScript errors
- Update all vitest configs to use jsdom environment
- Fix TooltipWithBounds test for jsdom style computation
@hshoff hshoff added this to the 4.0.0 milestone Nov 1, 2025
@hshoff hshoff changed the title test: migrate to jsdom and add vitest eslint plugin Migrate to jsdom Nov 1, 2025
@hshoff hshoff requested a review from Copilot November 1, 2025 19:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the project's testing environment from happy-dom to jsdom (version 27.1.0) to improve DOM compatibility and testing reliability. The migration includes adding ESLint support for Vitest, fixing TypeScript configurations, and updating test expectations to accommodate jsdom's different style handling behavior.

Key Changes

  • Replaced happy-dom@14 with jsdom@^27.0.0 as the DOM testing environment
  • Added @vitest/eslint-plugin@^1.4.0 with the legacy-recommended preset for better test linting
  • Updated all vitest configuration files across 30+ packages to use jsdom instead of happy-dom
  • Fixed CSS padding values to use explicit decimal notation for cross-environment consistency

Reviewed Changes

Copilot reviewed 73 out of 74 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Replaced happy-dom with jsdom, added vitest ESLint plugin
.eslintrc.js Added @vitest plugin configuration for test files
yarn.lock Added jsdom and all transitive dependencies, removed happy-dom
vitest.config.ts (all packages) Changed test environment from 'happy-dom' to 'jsdom'
test/tsconfig.json (all packages) Added vitest/globals type declarations
Tooltip.tsx Changed padding shorthand to explicit decimal notation
TooltipWithBounds.test.tsx Updated test assertions to handle jsdom's style computation
Tooltip.test.tsx Updated padding expectation to explicit decimal notation
Comments suppressed due to low confidence (1)

packages/visx-tooltip/test/Tooltip.test.tsx:21

  • Using 'as any' bypasses TypeScript's type safety. Consider using a more specific type assertion like tooltip.style[key as keyof React.CSSProperties] or defining a proper type guard to ensure type safety while accessing style properties.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

Size Changes

Package Diff ESM Prev ESM CJS Prev CJS
visx-tooltip +0.0% 14.05 KB 14.05 KB 19.25 KB 19.25 KB

Compared to master. File sizes are unminified and ungzipped.

View raw build stats

Previous (master)

{
  "visx-annotation": {
    "esm": 30333,
    "lib": 40419
  },
  "visx-axis": {
    "esm": 20709,
    "lib": 25153
  },
  "visx-bounds": {
    "esm": 2662,
    "lib": 3136
  },
  "visx-brush": {
    "esm": 55826,
    "lib": 60097
  },
  "visx-chord": {
    "esm": 3301,
    "lib": 4484
  },
  "visx-clip-path": {
    "esm": 3993,
    "lib": 5491
  },
  "visx-curve": {
    "esm": 323,
    "lib": 1462
  },
  "visx-delaunay": {
    "esm": 2422,
    "lib": 3231
  },
  "visx-demo": {
    "esm": 0,
    "lib": 0
  },
  "visx-drag": {
    "esm": 12570,
    "lib": 14176
  },
  "visx-event": {
    "esm": 3815,
    "lib": 5091
  },
  "visx-geo": {
    "esm": 12930,
    "lib": 16196
  },
  "visx-glyph": {
    "esm": 13761,
    "lib": 18476
  },
  "visx-gradient": {
    "esm": 16078,
    "lib": 20593
  },
  "visx-grid": {
    "esm": 18164,
    "lib": 22188
  },
  "visx-group": {
    "esm": 1471,
    "lib": 2070
  },
  "visx-heatmap": {
    "esm": 7040,
    "lib": 8347
  },
  "visx-hierarchy": {
    "esm": 12093,
    "lib": 17820
  },
  "visx-legend": {
    "esm": 25964,
    "lib": 32892
  },
  "visx-marker": {
    "esm": 8204,
    "lib": 10332
  },
  "visx-mock-data": {
    "esm": 326036,
    "lib": 329336
  },
  "visx-network": {
    "esm": 4544,
    "lib": 6634
  },
  "visx-pattern": {
    "esm": 11689,
    "lib": 15673
  },
  "visx-point": {
    "esm": 1003,
    "lib": 1781
  },
  "visx-react-spring": {
    "esm": 13221,
    "lib": 16485
  },
  "visx-responsive": {
    "esm": 15936,
    "lib": 18296
  },
  "visx-sankey": {
    "esm": 3543,
    "lib": 4594
  },
  "visx-scale": {
    "esm": 19205,
    "lib": 30251
  },
  "visx-shape": {
    "esm": 81787,
    "lib": 102594
  },
  "visx-stats": {
    "esm": 13498,
    "lib": 15050
  },
  "visx-text": {
    "esm": 8297,
    "lib": 9794
  },
  "visx-threshold": {
    "esm": 2844,
    "lib": 3723
  },
  "visx-tooltip": {
    "esm": 14383,
    "lib": 19715
  },
  "visx-vendor": {
    "esm": 2492,
    "lib": 2702
  },
  "visx-visx": {
    "esm": 1524,
    "lib": 4155
  },
  "visx-voronoi": {
    "esm": 2137,
    "lib": 2824
  },
  "visx-wordcloud": {
    "esm": 2506,
    "lib": 3324
  },
  "visx-xychart": {
    "esm": 174768,
    "lib": 225877
  },
  "visx-zoom": {
    "esm": 16176,
    "lib": 18872
  }
}

Current

{
  "visx-annotation": {
    "esm": 30333,
    "lib": 40419
  },
  "visx-axis": {
    "esm": 20709,
    "lib": 25153
  },
  "visx-bounds": {
    "esm": 2662,
    "lib": 3136
  },
  "visx-brush": {
    "esm": 55826,
    "lib": 60097
  },
  "visx-chord": {
    "esm": 3301,
    "lib": 4484
  },
  "visx-clip-path": {
    "esm": 3993,
    "lib": 5491
  },
  "visx-curve": {
    "esm": 323,
    "lib": 1462
  },
  "visx-delaunay": {
    "esm": 2422,
    "lib": 3231
  },
  "visx-demo": {
    "esm": 0,
    "lib": 0
  },
  "visx-drag": {
    "esm": 12570,
    "lib": 14176
  },
  "visx-event": {
    "esm": 3815,
    "lib": 5091
  },
  "visx-geo": {
    "esm": 12930,
    "lib": 16196
  },
  "visx-glyph": {
    "esm": 13761,
    "lib": 18476
  },
  "visx-gradient": {
    "esm": 16078,
    "lib": 20593
  },
  "visx-grid": {
    "esm": 18164,
    "lib": 22188
  },
  "visx-group": {
    "esm": 1471,
    "lib": 2070
  },
  "visx-heatmap": {
    "esm": 7040,
    "lib": 8347
  },
  "visx-hierarchy": {
    "esm": 12093,
    "lib": 17820
  },
  "visx-legend": {
    "esm": 25964,
    "lib": 32892
  },
  "visx-marker": {
    "esm": 8204,
    "lib": 10332
  },
  "visx-mock-data": {
    "esm": 326036,
    "lib": 329336
  },
  "visx-network": {
    "esm": 4544,
    "lib": 6634
  },
  "visx-pattern": {
    "esm": 11689,
    "lib": 15673
  },
  "visx-point": {
    "esm": 1003,
    "lib": 1781
  },
  "visx-react-spring": {
    "esm": 13221,
    "lib": 16485
  },
  "visx-responsive": {
    "esm": 15936,
    "lib": 18296
  },
  "visx-sankey": {
    "esm": 3543,
    "lib": 4594
  },
  "visx-scale": {
    "esm": 19205,
    "lib": 30251
  },
  "visx-shape": {
    "esm": 81787,
    "lib": 102594
  },
  "visx-stats": {
    "esm": 13498,
    "lib": 15050
  },
  "visx-text": {
    "esm": 8297,
    "lib": 9794
  },
  "visx-threshold": {
    "esm": 2844,
    "lib": 3723
  },
  "visx-tooltip": {
    "esm": 14385,
    "lib": 19717
  },
  "visx-vendor": {
    "esm": 2492,
    "lib": 2702
  },
  "visx-visx": {
    "esm": 1524,
    "lib": 4155
  },
  "visx-voronoi": {
    "esm": 2137,
    "lib": 2824
  },
  "visx-wordcloud": {
    "esm": 2506,
    "lib": 3324
  },
  "visx-xychart": {
    "esm": 174768,
    "lib": 225877
  },
  "visx-zoom": {
    "esm": 16176,
    "lib": 18872
  }
}

@hshoff
Copy link
Member Author

hshoff commented Nov 2, 2025

Pinned jsdom to 27.0.0 due to jsdom@27.0.1 introducing a breaking change. Need to upgrade node to upgrade jsdom from here.

@hshoff hshoff merged commit cdbfb7a into master Nov 2, 2025
1 check passed
@hshoff hshoff deleted the hshoff-jsdom branch November 2, 2025 14:35
@github-actions
Copy link

🎉 This PR is included in version v4.0.0-alpha.0 of the packages modified 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants