fix devices test; print on test failure (#6039)
* fix devices test; print on test failure * mock out a call to Doctor
This commit is contained in:
@@ -26,7 +26,7 @@ void testUsingContext(String description, dynamic testMethod(), {
|
||||
Timeout timeout,
|
||||
Map<Type, dynamic> overrides: const <Type, dynamic>{}
|
||||
}) {
|
||||
test(description, () {
|
||||
test(description, () async {
|
||||
AppContext testContext = new AppContext();
|
||||
|
||||
overrides.forEach((Type type, dynamic value) {
|
||||
@@ -65,7 +65,17 @@ void testUsingContext(String description, dynamic testMethod(), {
|
||||
testContext[XCode] = new XCode();
|
||||
}
|
||||
|
||||
return testContext.runInZone(testMethod);
|
||||
try {
|
||||
return await testContext.runInZone(testMethod);
|
||||
} catch (error) {
|
||||
if (testContext[Logger] is BufferLogger) {
|
||||
BufferLogger bufferLogger = testContext[Logger];
|
||||
if (bufferLogger.errorText.isNotEmpty)
|
||||
print(bufferLogger.errorText);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
}, timeout: timeout);
|
||||
}
|
||||
|
||||
@@ -99,6 +109,10 @@ class MockDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
class MockDoctor extends Doctor {
|
||||
// True for testing.
|
||||
@override
|
||||
bool get canListAnything => true;
|
||||
|
||||
// True for testing.
|
||||
@override
|
||||
bool get canLaunchAnything => true;
|
||||
|
||||
Reference in New Issue
Block a user