avajs/ava

Feature Request: A way to mark a test 'skipped' after it starts

Open

#2,010 创建于 2019年1月9日

在 GitHub 查看
 (12 评论) (2 反应) (0 负责人)JavaScript (20,600 star) (1,408 fork)batch import
enhancementhelp wantedscope:assertions

描述

Description

I'm using ava to control selenium-webdriver for tests run in Firefox and Chrome. It cannot be known synchronously if the browser can be run. An example flow could be:

test('somepage.html', async t => {
  try {
    await loadPage('somepage.html');
  } catch (error) {
    t.skip();
    return;
  }
  // testing against the page here
});

In this example loadPage() will reject if the browser cannot be started, otherwise it will resolve. The goal is that the test will report skipped if the browser cannot be run.

It would probably be good if t.skip() threw an exception if any assertions have already run for that test.

Environment

Node.js v10.14.2
linux 4.19.8-200.fc28.x86_64
ava 1.0.1
npm 6.4.1

贡献者指南