-
Notifications
You must be signed in to change notification settings - Fork 218
Refactor the Reporter API #1311
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
Comments
We could also consider just a single Stream of objects, |
I spent some time digging on this. One bit that has me worried about making a change here is this snippet:
This appears to rely on certain tests not showing up in There is some logic that prevents tests which have a test/pkgs/test_core/lib/src/runner/engine.dart Lines 449 to 450 in 62f7408
This is done because of a UX concern and isn't related to the logic of running tests. That mixing of responsibilities makes this tricky. I think it's maybe relying on I think that it's only these |
Probably so that the |
We could still give the json reporter access to the engine if we needed to right? Without actually making that a part of the public contract? Not sure if I am totally following but that seems like it could help resolve the scenario we are talking about. I don't know how that would work out exactly in the code, the built in reporters might end up being a bit special in that way. Or, can we communicate this same information through the new apis such that we could mimic the old behavior but without exposing the engine? |
That's what I'm attempting to figure out out. If I can be reasonably sure that it's only the We could also consider dropping the I do need to dig around some more though. I think that |
Working towards #1311 The `Compact` and `Expanded` reporters have a lot of code in common, along with many superficial, and a few not-superficial differences. Some of the impactful differences look like they may be bugs. Make it easier to understand both reporters and their differences by reducing the superficial changes. The JSON reporter shares less code with the others, but aim for a consistent field ordering there as well. - Avoid using `Configuration.current` from the compact reporter. This was never added in the expanded reporter to avoid a transitive import to `dart:io`. The pattern of being configured at construction is already baked in to the `ReporterFactory` typedef as is a more clear pattern than reading from a magic zone scoped variable. Add required constructor args for the compact reporter which match those in the expanded reporter. Remove the TODO. - Use the same pattern for setting the color escape code fields. In the future we will likely want to migrate to `package:io` for these. - Shuffle some fields so they are ordered consistently in both reporters. - Add a default for `_lastProgressPassed` to avoid making it nullable. - Add `_printPath` and `_printPlatform` fields in the compact reporter rather than read them lazily through the zone scoped configuration. - Make the arguments required for the constructors instead of adding defaults which are never used. - Use 2 slashs for comments.
Working towards #1311 The `Compact` and `Expanded` reporters have a lot of code in common, along with many superficial, and a few not-superficial differences. Some of the impactful differences look like they may be bugs. Make it easier to understand both reporters and their differences by reducing the superficial changes. The JSON reporter shares less code with the others, but aim for a consistent field ordering there as well. - Avoid using `Configuration.current` from the compact reporter. This was never added in the expanded reporter to avoid a transitive import to `dart:io`. The pattern of being configured at construction is already baked in to the `ReporterFactory` typedef as is a more clear pattern than reading from a magic zone scoped variable. Add required constructor args for the compact reporter which match those in the expanded reporter. Remove the TODO. - Use the same pattern for setting the color escape code fields. In the future we will likely want to migrate to `package:io` for these. - Shuffle some fields so they are ordered consistently in both reporters. - Add a default for `_lastProgressPassed` to avoid making it nullable. - Add `_printPath` and `_printPlatform` fields in the compact reporter rather than read them lazily through the zone scoped configuration. - Make the arguments required for the constructors instead of adding defaults which are never used. - Use 2 slashs for comments.
Towards #1311 Removes a UX concern from `Engine` which no longer needs to worry about how a reporter might display information about load suites. Makes the interaction between the engine and reporters less subtle. Use the term "suite load" over "load test" to start pushing terminology away from conflating tests and loading.
\Towards #1311 Removes a UX concern from `Engine` which no longer needs to worry about how a reporter might display information about load suites. Makes the interaction between the engine and reporters less subtle. Use the term "suite load" over "load test" to start pushing terminology away from conflating tests and loading.
The API is currently "backwards". The
Reporter
class is designed around how theRunner
class wants to use it, it doesn't really say anything about what the reporter should do, or how to implement one. The details for what the reporter should do are communicated, although not well at all, through theReporterFactory
typedef. What really needs to happen is for the reporter to listen on various streams from theEngine
, but to know the specific ones you really need to just copy existing reporter behavior. This also means that lots of other irrelevant details fromEngine
leak.We should consider refactoring to a new pattern. Some options that have been discussed:
Engine
and create an API in terms of one or more Streams that emit values that might beLiveTest
, or perhaps a new and more limited interface.Current reporters also read other details from the engine, like the list of "active" tests so some consideration will bee needed about how to expose what is necessary and leave room for enhancement without leaking too many unnecessary details.
The text was updated successfully, but these errors were encountered: