Index: lib/src/runner/reporter/no_io_compact.dart |
diff --git a/lib/src/runner/reporter/no_io_compact.dart b/lib/src/runner/reporter/no_io_compact.dart |
index 8732110054173ad7baf17a39a46b45a563cf22ae..add3b3669eca144d2b01071c14f7a1d5872521ae 100644 |
--- a/lib/src/runner/reporter/no_io_compact.dart |
+++ b/lib/src/runner/reporter/no_io_compact.dart |
@@ -32,6 +32,10 @@ class NoIoCompactReporter { |
/// or not outputting to a terminal. |
final String _red; |
+ /// The terminal escape for yellow text, or the empty string if this is |
+ /// Windows or not outputting to a terminal. |
+ final String _yellow; |
+ |
/// The terminal escape for removing test coloring, or the empty string if |
/// this is Windows or not outputting to a terminal. |
final String _noColor; |
@@ -51,12 +55,18 @@ class NoIoCompactReporter { |
/// The set of tests that have completed and been marked as passing. |
final _passed = new Set<LiveTest>(); |
+ /// The set of tests that have completed and been marked as skipped. |
+ final _skipped = new Set<LiveTest>(); |
+ |
/// The set of tests that have completed and been marked as failing or error. |
final _failed = new Set<LiveTest>(); |
/// The size of [_passed] last time a progress notification was printed. |
int _lastProgressPassed; |
+ /// The size of [_skipped] last time a progress notification was printed. |
+ int _lastProgressSkipped; |
+ |
/// The size of [_failed] last time a progress notification was printed. |
int _lastProgressFailed; |
@@ -74,17 +84,28 @@ class NoIoCompactReporter { |
_engine = new Engine(suites), |
_green = color ? '\u001b[32m' : '', |
_red = color ? '\u001b[31m' : '', |
+ _yellow = color ? '\u001b[33m' : '', |
_noColor = color ? '\u001b[0m' : '' { |
_engine.onTestStarted.listen((liveTest) { |
liveTest.onStateChange.listen((state) { |
if (state.status != Status.complete) return; |
- if (state.result == Result.success) { |
- _passed.add(liveTest); |
- } else { |
+ |
+ if (state.result != Result.success) { |
_passed.remove(liveTest); |
_failed.add(liveTest); |
+ } else if (liveTest.test.metadata.skip) { |
+ _skipped.add(liveTest); |
+ } else { |
+ _passed.add(liveTest); |
} |
+ |
_progressLine(_description(liveTest)); |
+ |
+ if (liveTest.test.metadata.skip && |
+ liveTest.test.metadata.skipReason != null) { |
+ print(indent('${_yellow}Skip: ${liveTest.test.metadata.skipReason}' |
+ '$_noColor')); |
+ } |
}); |
liveTest.onError.listen((error) { |
@@ -119,10 +140,12 @@ class NoIoCompactReporter { |
_stopwatch.start(); |
return _engine.run().then((success) { |
- if (success) { |
- _progressLine("All tests passed!"); |
- } else { |
+ if (!success) { |
_progressLine('Some tests failed.', color: _red); |
+ } else if (_passed.isEmpty) { |
+ _progressLine("All tests skipped."); |
+ } else { |
+ _progressLine("All tests passed!"); |
} |
return success; |
@@ -141,12 +164,14 @@ class NoIoCompactReporter { |
void _progressLine(String message, {String color}) { |
// Print nothing if nothing has changed since the last progress line. |
if (_passed.length == _lastProgressPassed && |
+ _skipped.length == _lastProgressSkipped && |
_failed.length == _lastProgressFailed && |
message == _lastProgressMessage) { |
return; |
} |
_lastProgressPassed = _passed.length; |
+ _lastProgressSkipped = _skipped.length; |
_lastProgressFailed = _failed.length; |
_lastProgressMessage = message; |
@@ -161,6 +186,13 @@ class NoIoCompactReporter { |
buffer.write(_passed.length); |
buffer.write(_noColor); |
+ if (_skipped.isNotEmpty) { |
+ buffer.write(_yellow); |
+ buffer.write(' ~'); |
+ buffer.write(_skipped.length); |
+ buffer.write(_noColor); |
+ } |
+ |
if (_failed.isNotEmpty) { |
buffer.write(_red); |
buffer.write(' -'); |