Skip to content

Conversation

@johnniwinther
Copy link
Member

The global declarer is used by package:test_reflective_loader which has no means of configuring the test output. It is for instance used to run all tests in package:analyzer, and the current output prints a line for each test (of which there is currently >32000) and uses colors in the output. This makes it very hard to output to find failing tests, since the failures are hidden within all the succeeding tests and piping the output to a file for easier search still leaves the color in the output.

This change adds .fromEnvironment variables to the creation of the global declarer, such that it can be configured at the command line. This allow for enabling compact output which only displays the failing tests, and whether to use colors in the output.

The global declarer is used by package:test_reflective_loader which has no means of configuring the test output. It is for instance used to run all tests in package:analyzer, and the current output prints a line for each test (of which there is currently >32000) and uses colors in the output. This makes it very hard to output to find failing tests, since the failures are hidden within all the succeeding tests and piping the output to a file for easier search still leaves the color in the output.

This change adds .fromEnvironment variables to the creation of the global declarer, such that it can be configured at the command line. This allow for enabling compact output which only displays the failing tests, and whether to use colors in the output.
@johnniwinther johnniwinther requested a review from a team as a code owner November 19, 2025 10:20
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

@@ -1,3 +1,6 @@
## 0.6.14
* Support environment flags for configuring the global declarer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a bit more explicit here?

It'd also be nice to update this section of the readme – so this feature isn't lost.

https://github.com/dart-lang/test/tree/master/pkgs/test#selecting-a-test-reporter

I have a few packages where I'd use this, too!

@jakemac53
Copy link
Contributor

jakemac53 commented Nov 19, 2025

There are many more issues than just this with running tests directly as opposed to through the test runner - test annotations won't be respected and test configuration files also won't be respected (and probably many more such as timeouts etc).

Is it possible to just use the test runner here?

@jakemac53
Copy link
Contributor

I also think it is potentially confusing that these environment variables are only supported by the global declarer and don't more generally set the defaults of test reporters as a whole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants