0

What I want to do is console.log something if there is a failure in an AVA test but I can't find any documentation on how to do this - if its possible.

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');
});
brommersman
  • 116
  • 1
  • 4

1 Answers1

1

There's no way of doing this currently, though we have an issue open for it: https://github.com/avajs/ava/issues/840

Mark Wubben
  • 3,329
  • 1
  • 19
  • 16