Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions pkgs/test/test/runner/compact_reporter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.<fn>


+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.<fn>


+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'));''',
Expand Down
51 changes: 51 additions & 0 deletions pkgs/test/test/runner/failures_only_reporter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.<fn>

+1 ~1 -2: failure 2 [E]
oh no
test.dart 9:35 main.<fn>

+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'));''',
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test_core/lib/src/runner/reporter/compact.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down