{"id":17343,"library":"reakit-test-utils","title":"Reakit Test Utilities","description":"The `reakit-test-utils` package provides a set of utilities designed to facilitate testing of components built with the Reakit library, primarily using `@testing-library/react` and `@testing-library/react-hooks`. While the current version is 0.15.2, active development for the Reakit ecosystem has transitioned to the Ariakit project, with `reakit-test-utils` being effectively superseded by `@ariakit/test`. This package integrates with standard testing-library APIs to enable robust, accessibility-focused testing of UI components, emphasizing user interactions over internal implementation details. Developers should note that this specific package is no longer actively maintained under the `reakit-test-utils` name, and new projects or migrations should consider using `@ariakit/test` for ongoing support and features. Its original release cadence was irregular, marked by an 'experimental' status, leading to potential breaking changes even in minor versions before the migration to Ariakit.","status":"renamed","version":"0.15.2","language":"javascript","source_language":"en","source_url":"https://github.com/reakit/reakit/tree/master/packages/reakit-test-utils","tags":["javascript","reakit","react","system","typescript"],"install":[{"cmd":"npm install reakit-test-utils","lang":"bash","label":"npm"},{"cmd":"yarn add reakit-test-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add reakit-test-utils","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for DOM testing utilities.","package":"@testing-library/dom","optional":false},{"reason":"Peer dependency for React component testing.","package":"@testing-library/react","optional":false},{"reason":"Peer dependency for React Hooks testing.","package":"@testing-library/react-hooks","optional":false},{"reason":"Peer dependency for React rendering.","package":"react","optional":false},{"reason":"Peer dependency for React DOM operations.","package":"react-dom","optional":false}],"imports":[{"note":"Primary utility for rendering React components into the DOM for testing, often re-exporting from `@testing-library/react`. This package has been superseded by `@ariakit/test`.","wrong":"const { render } = require('reakit-test-utils')","symbol":"render","correct":"import { render } from 'reakit-test-utils'"},{"note":"Simulates DOM events. It's a named export, not a default export. For active development, consider migrating to `@ariakit/test` which offers similar utilities.","wrong":"import fireEvent from 'reakit-test-utils'","symbol":"fireEvent","correct":"import { fireEvent } from 'reakit-test-utils'"},{"note":"Ensures all updates related to a test assertion are processed before assertions run, preventing warnings in React 16.8+ testing. While `@testing-library/react` also exports `act`, using the one from `reakit-test-utils` (if re-exported) is recommended for consistency. This package is effectively abandoned; consider `@ariakit/test`.","wrong":"import { act } from '@testing-library/react'","symbol":"act","correct":"import { act } from 'reakit-test-utils'"}],"quickstart":{"code":"import * as React from 'react';\nimport { render, fireEvent, act } from 'reakit-test-utils';\n// You would also need @testing-library/jest-dom for toBeInTheDocument\n// import '@testing-library/jest-dom'; \n\nconst Counter = () => {\n  const [count, setCount] = React.useState(0);\n  return (\n    <div>\n      <button onClick={() => setCount(c => c + 1)}>Increment</button>\n      <p>Count: {count}</p>\n    </div>\n  );\n};\n\ndescribe('Counter Component', () => {\n  it('should increment the count when button is clicked', async () => {\n    const { getByText } = render(<Counter />);\n\n    const incrementButton = getByText('Increment');\n    const countDisplay = getByText('Count: 0');\n\n    expect(countDisplay).toBeInTheDocument();\n\n    await act(async () => {\n      fireEvent.click(incrementButton);\n    });\n\n    expect(getByText('Count: 1')).toBeInTheDocument();\n  });\n});","lang":"typescript","description":"Demonstrates rendering a simple React component and interacting with it using `fireEvent` and `act` to test state changes, typical for UI component testing. This example assumes a Jest and `@testing-library/jest-dom` setup."},"warnings":[{"fix":"Migrate your testing setup to use `@ariakit/test`. Install `@ariakit/test` and update import paths from `reakit-test-utils` to `@ariakit/test`. Refer to the Ariakit documentation for migration guides.","message":"The `reakit-test-utils` package has been superseded by `@ariakit/test` due to the rebranding of Reakit to Ariakit. It is no longer actively maintained under this name, and developers should migrate to `@ariakit/test` for ongoing support, features, and bug fixes.","severity":"breaking","affected_versions":"All versions"},{"fix":"For new projects or existing ones, use `@ariakit/test` which, although also marked experimental in its early stages, is the actively developed successor.","message":"This package was explicitly marked as 'experimental' in its README, indicating that it was subject to breaking changes even in minor versions. Relying on its specific API or behavior for long-term projects could lead to unexpected issues.","severity":"gotcha","affected_versions":"All 0.x versions"},{"fix":"If unable to migrate to `@ariakit/test`, you may need to use `--legacy-peer-deps` with npm 7+ or ensure your React version matches the specified ranges. However, the recommended fix is migration to `@ariakit/test` which has been updated to support newer React versions.","message":"Peer dependency ranges for `react` and `react-dom` are restricted to `^16.8.0 || ^17.0.0`. Using this package with React 18 or newer may lead to peer dependency warnings or runtime issues, as it hasn't been officially updated to support them.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure `act` is imported from `reakit-test-utils` (or `@testing-library/react` if directly using it) and that your test runner (e.g., Jest) is configured correctly. For asynchronous operations, ensure you `await act(async () => { ... })`.","cause":"Using `act` outside of a React testing environment or with an outdated test setup that doesn't correctly wrap state updates, or if React's `act` is not properly shimmed/imported.","error":"Error: `act` is not supported in the current environment."},{"fix":"Verify that `reakit-test-utils` is installed and ensure you are using named imports (e.g., `import { render } from 'reakit-test-utils'`). If you are migrating from Reakit to Ariakit, update imports to `@ariakit/test`.","cause":"Incorrect import of named exports or attempting to use CommonJS `require` syntax when the environment expects ESM, or vice-versa. Can also occur if the package is not installed or if bundler configuration is incorrect.","error":"TypeError: (0, _reakit_test_utils__WEBPACK_IMPORTED_MODULE_2__.render) is not a function"}],"ecosystem":"npm","meta_description":null}