Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jest expect error to be thrown

test("Test description", () => {
  const t = () => {
    throw new TypeError();
  };
  expect(t).toThrow(TypeError);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jest #expect #error #thrown
ADD COMMENT
Topic
Name
4+7 =