Skip to content

Commit

Permalink
Document the silent reporter (#2163)
Browse files Browse the repository at this point in the history
Towards #2162

Unhide the silent reporter. This was originally introduced hidden
because we expected it to only be useful for our own CI infrastructure,
since a failure without any output cannot be investigated - it must be
reproduced in a separate run to even find which test case failed.

We now have an external request for failing without any output on stdio
and there is no strong reason to keep the silent reporter hidden.

Remove the support for hidden reporters entirely - it can easily be
reintroduced if we have another reporter which isn't user facing.

Expand the reporter description. Break a long description string into a
adjacent literals to avoid lines over 80 columns.
  • Loading branch information
natebosch committed Jan 10, 2024
1 parent 846d73e commit 0eddae4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions pkgs/test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 1.25.1-wip

* Document the silent reporter in CLI help output.

## 1.25.0

* Handle paths with leading `/` when spawning test isolates.
Expand Down
1 change: 1 addition & 0 deletions pkgs/test/test/runner/runner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Output:
[expanded] (default) A separate line for each update.
[github] A custom reporter for GitHub Actions (the default reporter when running on GitHub Actions).
[json] A machine-readable format (see https://dart.dev/go/test-docs/json_reporter.md).
[silent] A reporter with no output. May be useful when only the exit code is meaningful.
--file-reporter Enable an additional reporter writing test results to a file.
Should be in the form <reporter>:<filepath>, Example: "json:reports/tests.json"
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.6.1-wip

- Handle missing package configs.
* Handle missing package configs.
* Document the silent reporter in CLI help output.

## 0.6.0

Expand Down
2 changes: 1 addition & 1 deletion pkgs/test_core/lib/src/runner/configuration/args.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ final ArgParser _parser = (() {

var reporterDescriptions = <String, String>{
for (final MapEntry(:key, :value) in allReporters.entries)
if (!value.hidden) key: value.description
key: value.description
};

parser.addSeparator('Output:');
Expand Down
10 changes: 5 additions & 5 deletions pkgs/test_core/lib/src/runner/configuration/reporters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ typedef ReporterFactory = Reporter Function(Configuration, Engine, StringSink);
class ReporterDetails {
final String description;
final ReporterFactory factory;
final bool hidden;
ReporterDetails(this.description, this.factory, {this.hidden = false});
ReporterDetails(this.description, this.factory);
}

/// All reporters and their corresponding details.
Expand All @@ -48,7 +47,8 @@ final _allReporters = <String, ReporterDetails>{
printPlatform: config.suiteDefaults.runtimes.length > 1 ||
config.suiteDefaults.compilerSelections != null)),
'github': ReporterDetails(
'A custom reporter for GitHub Actions (the default reporter when running on GitHub Actions).',
'A custom reporter for GitHub Actions '
'(the default reporter when running on GitHub Actions).',
(config, engine, sink) => GithubReporter.watch(engine, sink,
printPath: config.testSelections.length > 1 ||
Directory(config.testSelections.keys.single).existsSync(),
Expand All @@ -60,8 +60,8 @@ final _allReporters = <String, ReporterDetails>{
(config, engine, sink) =>
JsonReporter.watch(engine, sink, isDebugRun: config.debug)),
'silent': ReporterDetails(
hidden: true,
'A reporter with no output.',
'A reporter with no output. '
'May be useful when only the exit code is meaningful.',
(config, engine, sink) => SilentReporter()),
};

Expand Down

0 comments on commit 0eddae4

Please sign in to comment.