-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feature Request: A way to mark a test 'skipped' after it starts #2010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's an interesting use case. Calling it skip may be misleading, since the test did execute. We have Combined with #1692 you could even let some assertions fail, discard them, and then warn that the test could not be completed. @sindresorhus thoughts? |
My hope is for the final report to report to state that tests for unavailable browsers to be 'skipped'. Specifically when a specific browser cannot be run it should not report pass or fail for the associated tests. BTW I've edited my example code to show that you would |
Yes that was my understanding. I'm proposing that |
Agreed that it should be mandatory to return after calling this function. One hesitation about |
Yes I was wondering about That said, is it feasible to determine whether the test can run before you declare any tests? Once you call |
Very interesting, I didn't know it was possible to defer the first registration to ava. This might be a solution to my specific problem, though honestly something like |
I've tweaked the way my tests are declared so they do not get created until after the browser is successfully started, though this does have one drawback. An example test declaration is: page('check-text.html', async t => {
const {selenium, checkText} = t.context;
const ele = await selenium.findElement({id: 'test'});
await checkText(ele, 'This is a test!');
}); The |
I like the idea (and naming) of |
So in my use case test('test with async resolvable external dependency', async t => {
let externalSystem;
try {
externalSystem = await startExternalSystem();
} catch (error) {
t.cancel();
return;
}
// perform testing with `externalSystem`.
t.is(typeof externalSystem, 'object');
}); So the questions I have - how should ava react if Also should the promise returned by the test matter to how Sorry to bombard with questions, just trying to understand the edge cases. |
I'd say you can only cancel if you haven't run assertions: Running assertions on a canceled test causes the test to fail. Canceling a test that has run assertions causes the test to fail. We'll introduce a new reporting category for canceled tests. |
Now that assertions throw, would the |
No, I think if an assertion has already failed, then canceling has no effect. (To even be able to cancel you'd need to have caught the failed assertion error, which you're not supposed to do.) A failed assertion after a cancellation (e.g. async) should also still fail the test IMHO. |
Uh oh!
There was an error while loading. Please reload this page.
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:In this example
loadPage()
will reject if the browser cannot be started, otherwise it will resolve. The goal is that the test will reportskipped
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
The text was updated successfully, but these errors were encountered: