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');
});