Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial implementation of a github actions reporter #1678

Merged
merged 15 commits into from Mar 30, 2022
11 changes: 7 additions & 4 deletions pkgs/test_core/lib/src/runner/reporter/github.dart
Expand Up @@ -101,6 +101,7 @@ class GithubReporter implements Reporter {
final failed = errors.isNotEmpty;

void emitMessages(List<Message> messages) {
// todo: escape some github commands? ::group::, ::endgroup::, ::error::, ...
for (var message in messages) {
_sink.writeln(message.text);
}
Expand All @@ -113,6 +114,9 @@ class GithubReporter implements Reporter {
}
}

// TODO: how to recognize (setUpAll) and (tearDownAll)?
devoncarew marked this conversation as resolved.
Show resolved Hide resolved
// And are they reported in the 'passed test' count from the engine?

final isLoadSuite = test.suite is LoadSuite;
if (isLoadSuite) {
// Don't emit any info for 'loadSuite' tests, unless they contain errors.
Expand Down Expand Up @@ -152,19 +156,18 @@ class GithubReporter implements Reporter {
_sink.writeln();

final hadFailures = _engine.failed.isNotEmpty;
String message =
'${_engine.passed.length} ${pluralize('test', _engine.passed.length)} passed';
var message = '${_engine.passed.length} '
'${pluralize('test', _engine.passed.length)} passed';
if (_engine.failed.isNotEmpty) {
message += ', ${_engine.failed.length} failed';
}
if (_engine.skipped.isNotEmpty) {
message += ', ${_engine.skipped.length} skipped';
}
message += '.';
_sink.writeln(
hadFailures
? _helper.error(message)
: '${_GithubHelper.celebrationIcon} $message',
: '$message ${_GithubHelper.celebrationIcon}',
);
}

Expand Down