You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove @testing-library/react-hooks as a peer dependency #8739
I tried to remove @testing-library/react-hooks from Kibana since we're no longer using it elastic/kibana#222350. This was replaced by renderHook from @testing-library/react.
But Kibana PR failed since it turned out that eui is using it as a peer dependecy, so @testing-library/react-hooks isn't installed with eui package.
Example error:
<head></head>
FAIL src/platform/plugins/shared/share/public/components/export_popover/export_popover.test.tsx
--
| ● Test suite failed to run
|
| Cannot find module '@testing-library/react-hooks/dom' from 'node_modules/@elastic/eui/test-env/test/rtl/render_hook.js'
|
| Require stack:
| node_modules/@elastic/eui/test-env/test/rtl/render_hook.js
| node_modules/@elastic/eui/test-env/test/rtl/index.js
| src/platform/plugins/shared/share/public/components/export_popover/export_popover.test.tsx
|
| 14 \| import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
| 15 \| import { i18nServiceMock } from '@kbn/core-i18n-browser-mocks';
| > 16 \| import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
| \| ^
| 17 \| import { toastsServiceMock } from '@kbn/core-notifications-browser-mocks/src/toasts_service.mock';
| 18 \| import { ExportMenu } from './export_popover';
| 19 \| import type { IShareContext } from '../context';
|
| at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
| at Object.<anonymous> (node_modules/@elastic/eui/test-env/test/rtl/render_hook.js:23:37)
| at Object.<anonymous> (node_modules/@elastic/eui/test-env/test/rtl/index.js:85:20)
| at Object.require (src/platform/plugins/shared/share/public/components/export_popover/export_popover.test.tsx:16:1)
I suggest EUI gets rid of this dependency in favor of renderHook from @testing-library/react as a peer dependency
It looks like Kibana is falling back to a non-React 18 version because we haven't defined the EUI specific process variable for kibana test env. Maybe EUI can figure it out from the React package version?
We actually only use @testing-library/react-hooks as a devDependency, which makes this whole thing a bit confusing. Long story short, since this hook contains internal logic, it should likely be treated as internal-only. We don't export it directly, and all usages in Kibana import it from the "hidden" @elastic/eui/lib/test/rtl/render_hook file directly.
I believe this should be fixed by our test utils library that I worked on earlier this year. Let me circle back to this and see if we could quickly release it and replace Kibana usages to fix the issue you're seeing!
👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.
👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.
Activity
Dosant commentedon Jun 4, 2025
Looking at the code,
eui/packages/eui/src/test/rtl/render_hook.ts
Lines 18 to 24 in 0596135
It looks like Kibana is falling back to a non-React 18 version because we haven't defined the EUI specific process variable for kibana test env. Maybe EUI can figure it out from the React package version?
tkajtoch commentedon Jun 5, 2025
Hi @Dosant let me look into this and get back to you.
tkajtoch commentedon Jun 12, 2025
We actually only use
@testing-library/react-hooksas adevDependency, which makes this whole thing a bit confusing. Long story short, since this hook contains internal logic, it should likely be treated as internal-only. We don't export it directly, and all usages in Kibana import it from the "hidden"@elastic/eui/lib/test/rtl/render_hookfile directly.I believe this should be fixed by our test utils library that I worked on earlier this year. Let me circle back to this and see if we could quickly release it and replace Kibana usages to fix the issue you're seeing!
github-actions commentedon Dec 9, 2025
👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.
github-actions commentedon Jun 14, 2026
👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.