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

AF-3801 fix reporter runtime error in Dart 2.1.0 #287

Merged
merged 3 commits into from
Jan 14, 2019
Merged
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion lib/src/reporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ class Reporter {
color && message.isNotEmpty ? pen(message) : message;

void _log(IOSink sink, String message, {bool shout: false}) {
if (quiet && !shout) return;
// This may look like a strange conditional, but please leave it.
// Somehow when using the tearoff `reporter.log` the `quiet` variable
// is null, which causes a runtime error when running tests in Dart 2.1.0
if (quiet == true && shout != true) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be that Reporter isn't getting passed both arguments during intiialization?

Reporter reporter = new Reporter();

Based on the existing code,

bool color = true;
bool quiet = false;
Reporter({bool this.color, bool this.quiet});
String colorBlue(String message) => _color(_blue, message);

, I would expect new Reporter() to have both fields be null.

I feel like it should just be:

bool color;
bool quiet;

Reporter({bool this.color = true, bool this.quiet = false}); 

Could it be that it's only showing up in testing because this is being run in checked mode?

sink.writeln(message);
}
}