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

Document the silent reporter #2163

Merged
merged 1 commit into from
Jan 10, 2024
Merged
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
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
Loading