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
I encountered a TypeError: React.act is not a function while running tests with @testing-library/react. The error appears to be related to incompatibility between the @testing-library/react package and react@19.
pnpm add -D @testing-library/react @testing-library/jest-dom jest
Create a simple component:
// app/page.tsx
export default function Home() {
return
Testing
;
}
// app/page.test.tsx
import { render, screen } from '@testing-library/react';
import Home from './page';
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I encountered a TypeError: React.act is not a function while running tests with @testing-library/react. The error appears to be related to incompatibility between the @testing-library/react package and react@19.
pnpm add -D @testing-library/react @testing-library/jest-dom jest
Create a simple component:
// app/page.tsx
export default function Home() {
return
}
// app/page.test.tsx
import { render, screen } from '@testing-library/react';
import Home from './page';
describe('Home Page', () => {
it('renders the testing div', () => {
render();
const divElement = screen.getByText(/testing/i);
expect(divElement).toBeInTheDocument();
});
});
Beta Was this translation helpful? Give feedback.
All reactions