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
Merged
6 changes: 5 additions & 1 deletion pkgs/test/CHANGELOG.md
@@ -1,4 +1,8 @@
## 1.20.3-dev
## 1.21.0-dev

* Add a `github` reporter option for use with GitHub Actions.
* Make the `github` test reporter the default when we detect we're running on
GitHub Actions.

## 1.20.2

Expand Down
19 changes: 19 additions & 0 deletions pkgs/test/README.md
Expand Up @@ -3,6 +3,8 @@
* [Writing Tests](#writing-tests)
* [Running Tests](#running-tests)
* [Sharding Tests](#sharding-tests)
* [Shuffling Tests](#shuffling-tests)
* [Selecting a Test Reporter](#selecting-a-test-reporter)
* [Collecting Code Coverage](#collecting-code-coverage)
* [Restricting Tests to Certain Platforms](#restricting-tests-to-certain-platforms)
* [Platform Selectors](#platform-selectors)
Expand Down Expand Up @@ -209,6 +211,7 @@ the invocation to the `test` function, and are considered a match if
on platform implementations.

### Sharding Tests

Tests can also be sharded with the `--total-shards` and `--shard-index` arguments,
allowing you to split up your test suites and run them separately. For example,
if you wanted to run 3 shards of your test suite, you could run them as follows:
Expand All @@ -233,6 +236,22 @@ dart test --test-randomize-ordering-seed=random
Setting `--test-randomize-ordering-seed=0` will have the same effect as not
specifying it at all, meaning the test order will remain as-is.

### Selecting a Test Reporter

You can adjust the output format of test results using the `--reporter=<option>`
command line flag. The default format is the `compact` output format - a single
line, continuously updated as tests are run. When running on the GitHub Actions CI
however (detected via checking the `GITHUB_ACTIONS` environment variable for `true`),
the default changes to the `github` output format - a reporter customized
for that CI/CD system.

The available options for the `--reporter` flag are:

- `compact`: a single, continuously updated line
- `expanded`: a separate line for each update
- `github`: a custom reporter for GitHub Actions
- `json`: a machine-readable format; see https://dart.dev/go/test-docs/json_reporter.md

### Collecting Code Coverage

To collect code coverage, you can run tests with the `--coverage <directory>`
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/pubspec.yaml
@@ -1,5 +1,5 @@
name: test
version: 1.20.3-dev
version: 1.21.0-dev
description: >-
A full featured library for writing and running Dart tests across platforms.
repository: https://github.com/dart-lang/test/blob/master/pkgs/test
Expand Down