Fix tests (#3977)
Also, make sure that broken tests actually break the bots. And add a test to make sure that keeps happening.
This commit is contained in:
@@ -180,6 +180,7 @@ Future<Null> _exit(int code) async {
|
||||
|
||||
// Give the task / timer queue one cycle through before we hard exit.
|
||||
await Timer.run(() {
|
||||
printTrace('exiting with code $code');
|
||||
exit(code);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,8 +56,14 @@ class TestCommand extends FlutterCommand {
|
||||
Future<int> _runTests(List<String> testArgs, Directory testDirectory) async {
|
||||
Directory currentDirectory = Directory.current;
|
||||
try {
|
||||
Directory.current = testDirectory;
|
||||
return await executable.main(testArgs);
|
||||
if (testDirectory != null) {
|
||||
printTrace('switching to directory $testDirectory to run tests');
|
||||
Directory.current = testDirectory;
|
||||
}
|
||||
printTrace('running test package with arguments: $testArgs');
|
||||
await executable.main(testArgs);
|
||||
printTrace('test package returned with exit code $exitCode');
|
||||
return exitCode;
|
||||
} finally {
|
||||
Directory.current = currentDirectory;
|
||||
}
|
||||
@@ -70,9 +76,10 @@ class TestCommand extends FlutterCommand {
|
||||
if (!projectRootValidator())
|
||||
return 1;
|
||||
|
||||
Directory testDir = _currentPackageTestDir;
|
||||
Directory testDir;
|
||||
|
||||
if (testArgs.isEmpty) {
|
||||
testDir = _currentPackageTestDir;
|
||||
if (!testDir.existsSync()) {
|
||||
printError("Test directory '${testDir.path}' not found.");
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user