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
"No tests executed" does not always result in exit code 1 #4299
Comments
This already exists. <?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class Test extends TestCase
{
}
|
Nah, not the same case.
|
Thank you, @remicollet. |
To summarize the need, in linked project:
|
thanks |
Hmm, not sure - why would this be an error? Imagine you set up a project using a skeleton, but do not have tests at the time. Why should the build fail when there are no tests? Updating from |
The reasoning is this: PHPUnit was asked to run tests. You expect tests to be run. No tests were run. This does not match your expectation. |
It did for me - I have somewhere between 20 and 30 repositories where I have
test suites, all configured with separate Not all of these test suites have tests in every repository, which has worked fine. All of these repositories use the same or similar workflow definitions, so I can easily keep workflows - whether intended for GitHub Actions or other build tools - synchronized. With this change, I now need to go through all of the repositories making use of While subtle, I would consider this a breaking change. |
Perhaps we can introduce an option that allows failing with an error when a test suite Similar to how |
PHPUnit behaved exactly like this for a long time. Then at some point this behaviour was unintentionally changed. I was not aware of this until @remicollet brought this to my attention. I think that PHPUnit should behave as it does right now. I understand (now, thank you, @localheinz) that fixing this after it was broken for so long is a break of backward compatibility. I shall revert the change now. |
Thank you, @sebastianbergmann! I'll be happy to provide an option to fail for empty test suites - what do you think? |
That will be the topic of a ticket that I will open soon (after I have rolled back the change). |
For reference: #4313 |
And exit with an error code.
If you run
phpunit
, this means you very probably have tests.This can avoid such issue: egulias/EmailValidator#244
as for now travis stay "green" while there is obviously something wrong.
Perhaps in next 9.3 or 10.0
Perhaps with a configuration option, with default=no in next and default=yes in next++
Open for discussion.
The text was updated successfully, but these errors were encountered: