0
我想要做的是console.log
如果在AVA测试中出现故障,但我找不到有关如何执行此操作的任何文档 - 如果可能的话。有没有办法在Ava中检测AssertionError
test.afterEach.always(t => {
if(t.hasFailure()){ //something like this
console.log(JSON.stringify(t.context.someJSON));
}
});
test('it fails', t => {
t.context.someJSON = {sample: 'object'}
t.fail('forced failure');
});