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
2cf82134
Unverified
Commit
2cf82134
authored
Jun 25, 2019
by
Emmanuel Garcia
Committed by
GitHub
Jun 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Break down flutter doctor validations and results (#34624)
parent
b5ce0616
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
3 deletions
+92
-3
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+20
-0
doctor_test.dart
packages/flutter_tools/test/commands/doctor_test.dart
+72
-3
No files found.
packages/flutter_tools/lib/src/doctor.dart
View file @
2cf82134
...
...
@@ -33,6 +33,7 @@ import 'macos/macos_workflow.dart';
import
'macos/xcode_validator.dart'
;
import
'proxy_validator.dart'
;
import
'tester/flutter_tester.dart'
;
import
'usage.dart'
;
import
'version.dart'
;
import
'vscode/vscode_validator.dart'
;
import
'web/web_validator.dart'
;
...
...
@@ -248,6 +249,8 @@ class Doctor {
break
;
}
flutterUsage
.
sendEvent
(
'doctorResult.
${validator.runtimeType.toString()}
'
,
result
.
typeStr
);
if
(
result
.
statusInfo
!=
null
)
{
printStatus
(
'
${result.coloredLeadingBox}
${validator.title}
(
${result.statusInfo}
)'
,
hangingIndent:
result
.
leadingBox
.
length
+
1
);
...
...
@@ -327,6 +330,7 @@ enum ValidationMessageType {
abstract
class
DoctorValidator
{
const
DoctorValidator
(
this
.
title
);
/// This is displayed in the CLI.
final
String
title
;
String
get
slowWarning
=>
'This is taking an unexpectedly long time...'
;
...
...
@@ -434,6 +438,22 @@ class ValidationResult {
}
return
null
;
}
/// The string representation of the type.
String
get
typeStr
{
assert
(
type
!=
null
);
switch
(
type
)
{
case
ValidationType
.
missing
:
return
'missing'
;
case
ValidationType
.
installed
:
return
'installed'
;
case
ValidationType
.
notAvailable
:
return
'notAvailable'
;
case
ValidationType
.
partial
:
return
'partial'
;
}
return
null
;
}
}
class
ValidationMessage
{
...
...
packages/flutter_tools/test/commands/doctor_test.dart
View file @
2cf82134
...
...
@@ -18,6 +18,7 @@ import 'package:flutter_tools/src/globals.dart';
import
'package:flutter_tools/src/proxy_validator.dart'
;
import
'package:flutter_tools/src/vscode/vscode.dart'
;
import
'package:flutter_tools/src/vscode/vscode_validator.dart'
;
import
'package:flutter_tools/src/usage.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
...
...
@@ -207,6 +208,75 @@ void main() {
});
});
group
(
'doctor usage params'
,
()
{
Usage
mockUsage
;
setUp
(()
{
mockUsage
=
MockUsage
();
when
(
mockUsage
.
isFirstRun
).
thenReturn
(
true
);
});
testUsingContext
(
'contains installed'
,
()
async
{
await
doctor
.
diagnose
(
verbose:
false
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.PassingValidator'
,
captureAny
)).
captured
,
<
dynamic
>[
'installed'
,
'installed'
,
'installed'
],
);
},
overrides:
<
Type
,
Generator
>{
DoctorValidatorsProvider:
()
=>
FakeDoctorValidatorsProvider
(),
Platform:
_kNoColorOutputPlatform
,
Usage:
()
=>
mockUsage
,
});
testUsingContext
(
'contains installed and partial'
,
()
async
{
await
FakePassingDoctor
().
diagnose
(
verbose:
false
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.PassingValidator'
,
captureAny
)).
captured
,
<
dynamic
>[
'installed'
,
'installed'
],
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.PartialValidatorWithHintsOnly'
,
captureAny
)).
captured
,
<
dynamic
>[
'partial'
],
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.PartialValidatorWithErrors'
,
captureAny
)).
captured
,
<
dynamic
>[
'partial'
],
);
},
overrides:
<
Type
,
Generator
>{
Platform:
_kNoColorOutputPlatform
,
Usage:
()
=>
mockUsage
,
});
testUsingContext
(
'contains installed, missing and partial'
,
()
async
{
await
FakeDoctor
().
diagnose
(
verbose:
false
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.PassingValidator'
,
captureAny
)).
captured
,
<
dynamic
>[
'installed'
],
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.MissingValidator'
,
captureAny
)).
captured
,
<
dynamic
>[
'missing'
],
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.NotAvailableValidator'
,
captureAny
)).
captured
,
<
dynamic
>[
'notAvailable'
],
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.PartialValidatorWithHintsOnly'
,
captureAny
)).
captured
,
<
dynamic
>[
'partial'
],
);
expect
(
verify
(
mockUsage
.
sendEvent
(
'doctorResult.PartialValidatorWithErrors'
,
captureAny
)).
captured
,
<
dynamic
>[
'partial'
],
);
},
overrides:
<
Type
,
Generator
>{
Platform:
_kNoColorOutputPlatform
,
Usage:
()
=>
mockUsage
,
});
});
group
(
'doctor with fake validators'
,
()
{
testUsingContext
(
'validate non-verbose output format for run without issues'
,
()
async
{
...
...
@@ -486,6 +556,8 @@ void main() {
});
}
class
MockUsage
extends
Mock
implements
Usage
{}
class
IntelliJValidatorTestTarget
extends
IntelliJValidator
{
IntelliJValidatorTestTarget
(
String
title
,
String
installPath
)
:
super
(
title
,
installPath
);
...
...
@@ -639,8 +711,6 @@ class FakeDoctorValidatorsProvider implements DoctorValidatorsProvider {
List
<
Workflow
>
get
workflows
=>
<
Workflow
>[];
}
class
PassingGroupedValidator
extends
DoctorValidator
{
PassingGroupedValidator
(
String
name
)
:
super
(
name
);
...
...
@@ -650,7 +720,6 @@ class PassingGroupedValidator extends DoctorValidator {
messages
.
add
(
ValidationMessage
(
'A helpful message'
));
return
ValidationResult
(
ValidationType
.
installed
,
messages
);
}
}
class
MissingGroupedValidator
extends
DoctorValidator
{
...
...
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