node.js - Jest: 测试方法需要抛出异常

jsf

2018-04-08T15:31:39Z||2018-04-08T15:31:39Z

toThrow:

test('error', () => {
  expect(() => {
    doit('wrong parameter');
  }).toThrow();
});