describe('Test a function', () => { it('should throw an error', () => { try { myFunction(); fail('No error was thrown'); } catch (error) { console.log(error); } }); });
describe('Test a function', () => { it('should throw an error', () => { expect(() => myFunction()).toThrow(); }); });
describe('Test a function', () => { it('should throw a TypeError', () => { expect(() => myFunction()).toThrowError(TypeError); }); });