score:15

Accepted answer

to assert a function to throw an error, you have to pass a function to the expect statement. in your case:

test('...', () => {
  expect(() => {
    render(<component />);
  }).tothrowerror();
});

Related Query

More Query from same tag