Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3ceef86b
Unverified
Commit
3ceef86b
authored
Aug 21, 2019
by
Zachary Anderson
Committed by
GitHub
Aug 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Handle crashes from doctor validators (#38920)
parent
6e34e805
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
165 additions
and
51 deletions
+165
-51
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+122
-51
doctor_test.dart
...lutter_tools/test/general.shard/commands/doctor_test.dart
+43
-0
No files found.
packages/flutter_tools/lib/src/doctor.dart
View file @
3ceef86b
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/commands/doctor_test.dart
View file @
3ceef86b
...
...
@@ -308,6 +308,23 @@ void main() {
));
},
overrides:
noColorTerminalOverride
);
testUsingContext
(
'validate non-verbose output format for run with crash'
,
()
async
{
expect
(
await
FakeCrashingDoctor
().
diagnose
(
verbose:
false
),
isFalse
);
expect
(
testLogger
.
statusText
,
equals
(
'Doctor summary (to see all details, run flutter doctor -v):
\n
'
'[✓] Passing Validator (with statusInfo)
\n
'
'[✓] Another Passing Validator (with statusInfo)
\n
'
'[☠] Crashing validator (the doctor check crashed)
\n
'
' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
'please let us know about this issue at https://github.com/flutter/flutter/issues.
\n
'
' ✗ fatal error
\n
'
'[✓] Validators are fun (with statusInfo)
\n
'
'[✓] Four score and seven validators ago (with statusInfo)
\n
'
'
\n
'
'! Doctor found issues in 1 category.
\n
'
));
},
overrides:
noColorTerminalOverride
);
testUsingContext
(
'validate non-verbose output format when only one category fails'
,
()
async
{
expect
(
await
FakeSinglePassingDoctor
().
diagnose
(
verbose:
false
),
isTrue
);
expect
(
testLogger
.
statusText
,
equals
(
...
...
@@ -647,6 +664,15 @@ class PartialValidatorWithHintsOnly extends DoctorValidator {
}
}
class
CrashingValidator
extends
DoctorValidator
{
CrashingValidator
()
:
super
(
'Crashing validator'
);
@override
Future
<
ValidationResult
>
validate
()
async
{
throw
'fatal error'
;
}
}
/// A doctor that fails with a missing [ValidationResult].
class
FakeDoctor
extends
Doctor
{
List
<
DoctorValidator
>
_validators
;
...
...
@@ -711,6 +737,23 @@ class FakeQuietDoctor extends Doctor {
}
}
/// A doctor with a validator that throws an exception.
class
FakeCrashingDoctor
extends
Doctor
{
List
<
DoctorValidator
>
_validators
;
@override
List
<
DoctorValidator
>
get
validators
{
if
(
_validators
==
null
)
{
_validators
=
<
DoctorValidator
>[];
_validators
.
add
(
PassingValidator
(
'Passing Validator'
));
_validators
.
add
(
PassingValidator
(
'Another Passing Validator'
));
_validators
.
add
(
CrashingValidator
());
_validators
.
add
(
PassingValidator
(
'Validators are fun'
));
_validators
.
add
(
PassingValidator
(
'Four score and seven validators ago'
));
}
return
_validators
;
}
}
/// A DoctorValidatorsProvider that overrides the default validators without
/// overriding the doctor.
class
FakeDoctorValidatorsProvider
implements
DoctorValidatorsProvider
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment