Question · JavaScript and TypeScript course · Module 11: Testing with Jest
The toThrow Matcher
How do you correctly use the toThrow matcher in Jest?
Answer options
- toThrow(expect(myFunction))
- expect(toThrow(myFunction))
- expect(myFunction()).toThrow()
- expect(() => myFunction()).toThrow()
You can check the correct answer by solving this task in the CodeWorlds game.