-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add an option to only rerun tests that have failed #16263
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
Conversation
1d8566c
to
8417e17
Compare
@G1ng3r is this ready for review or are you still making some changes? |
Hi @prolativ! I think its ready, but not sure. I need someone to approve the solution or give advise on how to improve it. Thanks |
@@ -30,6 +30,9 @@ object Properties { | |||
*/ | |||
val testsFilter: List[String] = sys.props.get("dotty.tests.filter").fold(Nil)(_.split(',').toList) | |||
|
|||
/** Run only failed tests */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this pattern starts to repeat, why don't you define a helper method propIsTrue
analogous to propIsNullOrTrue
and use it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -144,4 +152,15 @@ object TestReporter { | |||
} | |||
rep | |||
} | |||
|
|||
def lastRunFailedTests: List[String] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we make no distinction between the situation when --failed
is not enabled and when this option is on but all the tests passed in the previous run. I think we should split these cases, e.g. by returning None
in the former case and Some(Nil)
in the latter. In general, if all the tests in the previous run passed, I would expect testCompilation --failed
to run no tests and give explicit feedback that no tests were run instead of running all the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
8417e17
to
ca92351
Compare
Option.when(Properties.rerunFailed)( | ||
if (failedTestsFile.exists() && failedTestsFile.isFile) | ||
then java.nio.file.Files.readAllLines(failedTestsFile.toPath).asScala.toList | ||
else List.empty | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option.when(Properties.rerunFailed)( | |
if (failedTestsFile.exists() && failedTestsFile.isFile) | |
then java.nio.file.Files.readAllLines(failedTestsFile.toPath).asScala.toList | |
else List.empty | |
) | |
Option.when( | |
Properties.rerunFailed && | |
failedTestsFile.exists() && | |
failedTestsFile.isFile | |
)(java.nio.file.Files.readAllLines(failedTestsFile.toPath).asScala.toList) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The absence of failedTestsFile
should also mean that we need to run all the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
- testCompilation supports running only failed tests with --failed argument
ca92351
to
6dfc668
Compare
- testCompilation supports running only failed tests with --failed argument fixes scala#3798
fixes #3798