In my project I am successfully using render and screen from @testing-library/react, However everytime I do screen.getAllBy or screen.getByRole or anything else other than getByText I am getting such errors. One of them was,
typeerror: _react2.screen.getAllBy is not a function
This occurred upon the usage of screen.getAllBy.
My imports includes,
import React from 'react';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom;
import TestComponent from './TestComponent';
Am I missing an import or is there something wrong with my code?
it (`Testing Component`, () => {
render(<BrowserRouter><TestComponent /></BrowserRouter>
expect(screen.getAllBy('li')).toBeInTheDocument();
});
Aucun commentaire:
Enregistrer un commentaire