-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
--fail-fast keeps running other test files #1158
Comments
You can reproduce this issue by creating import test from 'ava'
test(t => t.fail()) and import test from 'ava'
test(t => t.pass()) Then |
I also noticed this while working on issue #1134 today. Here is a screenshot of me trying to run two different files both with a failing test somewhere in the middle. When things are as small as these examples it does not seem like much of a problem. But if you are running a huge test suite for a complex application. Then allowing Ava to keep running tests kind of defeats the purpose of --fail-fast in my opinion. So to keep the --fail-fast option working as intended, i would say shutdown any running processes. But i don´t know what problems that might cause since you talk about preventing cleanup:
|
My thoughts:
Only then, exit. |
Test files with failing tests are terminated quickly (but not immediately, in a synchronous, blocking sense). So I'm leaning towards forcefully stopping all other test processes and not logging any further output once a test has failed. |
How is this reasonable? This should perhaps be a feature, if you find it useful, but not There should be a feature to fail on the first failing test, yet, let the run finish gracefully, like I described. And it should be the more approachable, defaulty, recommended option. Is how I see it. |
That seems unnecessarily complicated. The way I see it you'd use |
It will probably not help that state created by your tests is preserved because that would be state created by tests other than the one which actually failed. Confusing, I think. |
The state of the failing test would be preserved amongst potentially that of others. |
The state of the failing test is the only one we'd be interested in. The others' could be confusing and a hassle to manually clean up. That's why I propose: let them finish and clean up after themselves. No new tests will start. Just the ones already running. |
Ah, so finish the currently running, non-failing tests, including their We wouldn't be able to run the |
Don't run new test files after: * A timeout has occurred * A test has failed * Running the test file itself caused an error Refs #1158.
#1693 ensures As part of #1684 I'll make sure we stop reporting subsequent test results once a test fails, while still letting the currently active tests run to completion. |
Don't run new test files after: * A timeout has occurred * A test has failed * Running the test file itself caused an error Refs #1158.
Fixes #1684. Fixes #1416. Refs #1158. Properly support serial hooks. Hooks are divided into the following categories: * before * beforeEach * afterEach * afterEach.always * after * after.always For each category all hooks are run in the order they're declared in. This is different from tests, where serial tests are run before concurrent ones. By default hooks run concurrently. However a serial hook is not run before all preceding concurrent hooks have completed. Serial hooks are never run concurrently. Always hooks are now always run, even if --fail-fast is enabled. Internally, TestCollection, Sequence and Concurrent have been removed. This has led to a major refactor of Runner, and some smaller breaking changes and bug fixes: * Unnecessary validations have been removed * Macros can be used with hooks * A macro is recognized even if no additional arguments are given, so it can modify the test (or hook) title * --match now also matches todo tests * Skipped and todo tests are shown first in the output * --fail-fast prevents subsequent tests from running as long as the failure occurs in a serial test
Fixes #1684. Fixes #1416. Refs #1158. Properly support serial hooks. Hooks are divided into the following categories: * before * beforeEach * afterEach * afterEach.always * after * after.always For each category all hooks are run in the order they're declared in. This is different from tests, where serial tests are run before concurrent ones. By default hooks run concurrently. However a serial hook is not run before all preceding concurrent hooks have completed. Serial hooks are never run concurrently. Always hooks are now always run, even if --fail-fast is enabled. Internally, TestCollection, Sequence and Concurrent have been removed. This has led to a major refactor of Runner, and some smaller breaking changes and bug fixes: * Unnecessary validations have been removed * Macros can be used with hooks * A macro is recognized even if no additional arguments are given, so it can modify the test (or hook) title * --match now also matches todo tests * Skipped and todo tests are shown first in the output * --fail-fast prevents subsequent tests from running as long as the failure occurs in a serial test
Fixes #1684. Fixes #1416. Refs #1158. Properly support serial hooks. Hooks are divided into the following categories: * before * beforeEach * afterEach * afterEach.always * after * after.always For each category all hooks are run in the order they're declared in. This is different from tests, where serial tests are run before concurrent ones. By default hooks run concurrently. However a serial hook is not run before all preceding concurrent hooks have completed. Serial hooks are never run concurrently. Always hooks are now always run, even if --fail-fast is enabled. Internally, TestCollection, Sequence and Concurrent have been removed. This has led to a major refactor of Runner, and some smaller breaking changes and bug fixes: * Unnecessary validations have been removed * Macros can be used with hooks * A macro is recognized even if no additional arguments are given, so it can modify the test (or hook) title * --match now also matches todo tests * Skipped and todo tests are shown first in the output * --fail-fast prevents subsequent tests from running as long as the failure occurs in a serial test
OK so what I ended up doing is that workers won't run other serial tests, or (as long as the error occurs early enough) concurrent tests. Tests that have started are run to completion, including hooks, and shown in the test output. If a test fails in one worker AVA will try and interrupt other workers. |
If a failure occurs in one worker, attempt to interrupt other workers. This only works as long as the other worker has not yet started running concurrent tests. Fixes #1158.
If a failure occurs in one worker, attempt to interrupt other workers. This only works as long as the other worker has not yet started running concurrent tests. Fixes #1158.
Don't run new test files after: * A timeout has occurred * A test has failed * Running the test file itself caused an error Refs #1158.
Fixes #1684. Fixes #1416. Refs #1158. Properly support serial hooks. Hooks are divided into the following categories: * before * beforeEach * afterEach * afterEach.always * after * after.always For each category all hooks are run in the order they're declared in. This is different from tests, where serial tests are run before concurrent ones. By default hooks run concurrently. However a serial hook is not run before all preceding concurrent hooks have completed. Serial hooks are never run concurrently. Always hooks are now always run, even if --fail-fast is enabled. Internally, TestCollection, Sequence and Concurrent have been removed. This has led to a major refactor of Runner, and some smaller breaking changes and bug fixes: * Unnecessary validations have been removed * Macros can be used with hooks * A macro is recognized even if no additional arguments are given, so it can modify the test (or hook) title * --match now also matches todo tests * Skipped and todo tests are shown first in the output * --fail-fast prevents subsequent tests from running as long as the failure occurs in a serial test
The test process that encounters the error simply exits if
--fail-fast
is enabled. Since each file runs in its own process, no other tests from that file are reported after the first failure is encountered.However, other test processes run to completion. I'm not sure whether to:
ava
won't exitWhen running with limited concurrency we'll also run into this scenario, so we should implement the same behavior. Additionally we mustn't launch new test processes.
Any thoughts on what to do with processes that are already running?
The text was updated successfully, but these errors were encountered: