【问题标题】:Is there a way to detect an AssertionError in Ava有没有办法在 Ava 中检测 AssertionError
【发布时间】:2017-07-27 11:31:06
【问题描述】:

如果 AVA 测试失败,我想要做的是 console.log 一些东西,但我找不到任何关于如何做到这一点的文档 - 如果可能的话。

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

【问题讨论】:

    标签: ava


    【解决方案1】:

    目前无法执行此操作,但我们有一个未解决的问题:https://github.com/avajs/ava/issues/840

    【讨论】:

      猜你喜欢
      • 2013-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-20
      • 2019-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多