avajs/ava
View on GitHubFeature Request: A way to mark a test 'skipped' after it starts
Open
#2,010 opened on Jan 9, 2019
enhancementhelp wantedscope:assertions
Description
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