diff --git a/pkgs/test/test/runner/compact_reporter_test.dart b/pkgs/test/test/runner/compact_reporter_test.dart index 842b65531..7ad63f376 100644 --- a/pkgs/test/test/runner/compact_reporter_test.dart +++ b/pkgs/test/test/runner/compact_reporter_test.dart @@ -467,6 +467,88 @@ void main() { }); }); + group('solo:', () { + test('displays non-solo skipped tests separately', () { + return _expectReport( + ''' + test('skip 1', () {}); + test('skip 2', () {}); + test('solo 3', () {}, solo: true);''', + ''' + +0: loading test.dart + +0: skip 1 + +0 ~1: skip 1 + +0 ~1: skip 2 + +0 ~2: skip 2 + +0 ~2: solo 3 + +1 ~2: solo 3 + +1 ~2: All tests passed!''', + ); + }); + + test('displays a non-solo skipped group', () { + return _expectReport( + ''' + group('skip', () { + test('test 1', () {}); + test('test 2', () {}); + test('test 3', () {}); + }); + group('solo', () { + test('test 4', () {}); + test('test 5', () {}); + test('test 6', () {}); + }, solo: true);''', + ''' + +0: loading test.dart + +0: skip + +0 ~1: skip + +0 ~1: solo test 4 + +1 ~1: solo test 4 + +1 ~1: solo test 5 + +2 ~1: solo test 5 + +2 ~1: solo test 6 + +3 ~1: solo test 6 + +3 ~1: All tests passed!''', + ); + }); + + test('runs solo tests along with successful and failing tests', () { + return _expectReport( + ''' + test('failure 1', () => throw TestFailure('oh no'), solo: true); + test('skip 1', () {}); + test('success 1', () {}, solo: true); + test('failure 2', () => throw TestFailure('oh no'), solo: true); + test('skip 2', () {}); + test('success 2', () {}, solo: true);''', + ''' + +0: loading test.dart + +0: failure 1 + +0 -1: failure 1 [E] + oh no + test.dart 6:35 main. + + + +0 -1: skip 1 + +0 ~1 -1: skip 1 + +0 ~1 -1: success 1 + +1 ~1 -1: success 1 + +1 ~1 -1: failure 2 + +1 ~1 -2: failure 2 [E] + oh no + test.dart 9:35 main. + + + +1 ~1 -2: skip 2 + +1 ~2 -2: skip 2 + +1 ~2 -2: success 2 + +2 ~2 -2: success 2 + +2 ~2 -2: Some tests failed.''', + ); + }); + }); + test('Directs users to enable stack trace chaining if disabled', () async { await _expectReport( '''test('failure 1', () => throw TestFailure('oh no'));''', diff --git a/pkgs/test/test/runner/failures_only_reporter_test.dart b/pkgs/test/test/runner/failures_only_reporter_test.dart index 2b56af47d..94aeb9e99 100644 --- a/pkgs/test/test/runner/failures_only_reporter_test.dart +++ b/pkgs/test/test/runner/failures_only_reporter_test.dart @@ -230,6 +230,57 @@ void main() { }); }); + group('solo:', () { + test('displays non-solo skipped tests separately', () { + return _expectReport( + ''' + test('skip 1', () {}); + test('skip 2', () {}); + test('solo 3', () {}, solo: true);''', + '+1 ~2: All tests passed!', + ); + }); + + test('displays a non-solo skipped group', () { + return _expectReport( + ''' + group('skip', () { + test('test 1', () {}); + test('test 2', () {}); + test('test 3', () {}); + }); + group('solo', () { + test('test 4', () {}); + test('test 5', () {}); + test('test 6', () {}); + }, solo: true);''', + '+3 ~1: All tests passed!', + ); + }); + + test('runs solo tests along with successful and failing tests', () { + return _expectReport( + ''' + test('failure 1', () => throw TestFailure('oh no'), solo: true); + test('skip 1', () {}); + test('success 1', () {}, solo: true); + test('failure 2', () => throw TestFailure('oh no'), solo: true); + test('skip 2', () {}); + test('success 2', () {}, solo: true);''', + ''' + +0 -1: failure 1 [E] + oh no + test.dart 6:35 main. + + +1 ~1 -2: failure 2 [E] + oh no + test.dart 9:35 main. + + +2 ~2 -2: Some tests failed.''', + ); + }); + }); + test('Directs users to enable stack trace chaining if disabled', () async { await _expectReport( '''test('failure 1', () => throw TestFailure('oh no'));''', diff --git a/pkgs/test_core/lib/src/runner/reporter/compact.dart b/pkgs/test_core/lib/src/runner/reporter/compact.dart index 3095ede2b..087a10f2e 100644 --- a/pkgs/test_core/lib/src/runner/reporter/compact.dart +++ b/pkgs/test_core/lib/src/runner/reporter/compact.dart @@ -11,8 +11,8 @@ import 'package:test_api/src/backend/message.dart'; // ignore: implementation_im import 'package:test_api/src/backend/state.dart'; // ignore: implementation_imports import '../../util/io.dart'; -import '../../util/pretty_print.dart'; import '../../util/pretty_print.dart' as utils; +import '../../util/pretty_print.dart'; import '../engine.dart'; import '../load_exception.dart'; import '../load_suite.dart'; @@ -228,6 +228,7 @@ class CompactReporter implements Reporter { _subscriptions.add( liveTest.onMessage.listen((message) { + if (liveTest.test.metadata.skip) return; _progressLine(_description(liveTest), truncate: false); if (!_printedNewline) _sink.writeln(''); _printedNewline = true; diff --git a/pkgs/test_core/lib/src/runner/reporter/failures_only.dart b/pkgs/test_core/lib/src/runner/reporter/failures_only.dart index 1549da52b..dc383bc20 100644 --- a/pkgs/test_core/lib/src/runner/reporter/failures_only.dart +++ b/pkgs/test_core/lib/src/runner/reporter/failures_only.dart @@ -161,6 +161,7 @@ class FailuresOnlyReporter implements Reporter { _subscriptions.add( liveTest.onMessage.listen((message) { + if (liveTest.test.metadata.skip) return; // TODO - Should this suppress output? Behave like printOnFailure? _progressLine(_description(liveTest)); var text = message.text;