如果我有一个抛出错误的函数并且我想测试那个错误,我会写这样的东西:
test('throws at something that is not a string', t => {
t.plan(1)
t.err(loadString(9))
})
但这总是导致在执行时来自函数的实际错误:
还有not ok 1 no plan found
and not ok 2 no assertions found
,这也很奇怪。我怎样才能确保它实际上没有抛出?
如果我有一个抛出错误的函数并且我想测试那个错误,我会写这样的东西:
test('throws at something that is not a string', t => {
t.plan(1)
t.err(loadString(9))
})
但这总是导致在执行时来自函数的实际错误:
还有not ok 1 no plan found
and not ok 2 no assertions found
,这也很奇怪。我怎样才能确保它实际上没有抛出?