如何在测试中抑制FuncUnit单元错误?

Sat*_*ish 11 javascript testing unit-testing funcunit

我有一个FuncUnit测试用例,我用它打开一个网页

F.open("http://www.example.com");
Run Code Online (Sandbox Code Playgroud)

我们的页面中存在一个已知问题,即大约20次网页中的大约一次因任何原因无法加载.我想在没有加载时重试.但是在FuncUnit中,如果无法加载页面,则无法抑制错误.有没有办法在Funcunit中抑制错误信息?

man*_*mat 1

难道这样的事情对你不起作用吗?

module("test", {
  setup: function() {
    let startMeUp = () => F.open('http://www.example.com'); // unfortunately doesn't return a usable value
    let checkCondition = () => {
      // grab F(F.window), and check for a known element in the page
      return elementFound;
    };
    while(!checkCondition()) {
      // element wasn't found, so let's try it again
      startMeUp();
      // maybe set a wait here
    }
  }
});
Run Code Online (Sandbox Code Playgroud)