Skip to content

chore(utilities): migrate tests to use @testing-library/react - #35302

Merged
Martin Hochel (Hotell) merged 6 commits into
microsoft:masterfrom
dmytrokirpa:refactor/migrate-v8-utilities-from-test-renderer-to-rtl
Oct 10, 2025
Merged

Martin Hochel (Hotell) merged 6 commits into
microsoft:masterfrom
dmytrokirpa:refactor/migrate-v8-utilities-from-test-renderer-to-rtl

Conversation

@dmytrokirpa

@dmytrokirpa Dmytro Kirpa (dmytrokirpa) commented Oct 8, 2025 •

Copy link
Copy Markdown
Contributor

Previous Behavior

V8 utilities package uses react-testing-library for tests which isn't supported by React 19

New Behavior

Updated tests to replace react-test-renderer with @testing-library/react for rendering components

Related Issue(s)

@dmytrokirpa
Dmytro Kirpa (dmytrokirpa) force-pushed the refactor/migrate-v8-utilities-from-test-renderer-to-rtl branch from 0d65bbe to cc52eb0 Compare October 8, 2025 13:52
@dmytrokirpa
Dmytro Kirpa (dmytrokirpa) marked this pull request as ready for review October 8, 2025 13:54
@dmytrokirpa
Dmytro Kirpa (dmytrokirpa) requested a review from a team as a code owner October 8, 2025 13:54
@github-actions

github-actions Bot commented Oct 8, 2025 •

Copy link
Copy Markdown

📊 Bundle size report

✅ No changes found

@github-actions

github-actions Bot commented Oct 8, 2025

Copy link
Copy Markdown

Pull request demo site: URL

@Hotell

Martin Hochel (Hotell) commented Oct 8, 2025 •

Copy link
Copy Markdown
Contributor

to get proper R19/R17 validation we need to enable RIT as well:

       "packages/react/**",
        "packages/react-hooks/**",
        "packages/react-examples/**",
        "packages/react-experiments/**",
        "packages/charts/react-charting/**",
+      "packages/utilities/**"
  • cleanup package.json scripts ( so nx can take over where applicable )
"scripts": {
    "build": "just-scripts build",
-    "clean": "just-scripts clean",
-    "code-style": "just-scripts code-style",
-    "just": "just-scripts",
-    "lint": "just-scripts lint",
-    "start-test": "just-scripts jest-watch",
-    "test": "just-scripts test",
-    "update-snapshots": "just-scripts jest -u",
    "verify-packaging": "just-scripts verify-packaging"
  }
  • tweak PR pipeline exclusion as necessary for gradual approach

@Hotell Martin Hochel (Hotell) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets unify the setup and RIT addition to have solid pattern for automation.

otherwise LGTM

Comment thread packages/utilities/src/styled.test.tsx Outdated
import * as React from 'react';
import * as renderer from 'react-test-renderer';
import { act, render } from '@testing-library/react';
import '@testing-library/jest-dom';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets follow our common setup and put this to packages/utilities/config/tests.js

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

import { Stylesheet, InjectionMode, mergeStyles } from '@fluentui/merge-styles';
import { classNamesFunction } from './classNamesFunction';
import { Customizations } from './customizations/Customizations';
import { safeCreate } from '@fluentui/test-utilities';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💪

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if we replace
image
we can remove test-utilities from this package deps 🤝

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@dmytrokirpa
Dmytro Kirpa (dmytrokirpa) requested a review from a team as a code owner October 9, 2025 07:38
@Hotell
Martin Hochel (Hotell) merged commit fe5dac9 into microsoft:master Oct 10, 2025
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.

[Feature]: v8 React 19 support

2 participants