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
f59b185b
Unverified
Commit
f59b185b
authored
Mar 30, 2021
by
Jonah Williams
Committed by
GitHub
Mar 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] do not make drive require pub if --no-pub is requested (#79379)
parent
1f30bfd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+8
-2
drive_test.dart
...lutter_tools/test/commands.shard/hermetic/drive_test.dart
+40
-0
No files found.
packages/flutter_tools/lib/src/commands/drive.dart
View file @
f59b185b
...
...
@@ -147,9 +147,15 @@ class DriveCommand extends RunCommandBase {
}
// `pub` must always be run due to the test script running from source,
// even if an application binary is used.
// even if an application binary is used. Default to true unless the user explicitly
// specified not to.
@override
bool
get
shouldRunPub
=>
true
;
bool
get
shouldRunPub
{
if
(
argResults
.
wasParsed
(
'pub'
)
&&
!
boolArg
(
'pub'
))
{
return
false
;
}
return
true
;
}
FlutterDriverFactory
_flutterDriverFactory
;
final
FileSystem
_fileSystem
;
...
...
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
View file @
f59b185b
...
...
@@ -8,11 +8,15 @@ import 'package:file/memory.dart';
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/drive.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:test/fake.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
void
main
(
)
{
FileSystem
fileSystem
;
...
...
@@ -25,6 +29,15 @@ void main() {
platform
=
FakePlatform
(
operatingSystem:
'linux'
);
});
setUpAll
(()
{
Cache
.
disableLocking
();
});
tearDownAll
(()
{
Cache
.
enableLocking
();
});
testWithoutContext
(
'drive --screenshot writes to expected output'
,
()
async
{
final
Device
screenshotDevice
=
ScreenshotDevice
();
...
...
@@ -60,6 +73,33 @@ void main() {
expect
(
logger
.
statusText
,
isEmpty
);
expect
(
logger
.
errorText
,
contains
(
'Error taking screenshot: FileSystemException: Not a directory'
));
});
testUsingContext
(
'shouldRunPub is true unless user specifies --no-pub'
,
()
async
{
final
DriveCommand
command
=
DriveCommand
(
fileSystem:
fileSystem
,
logger:
logger
,
platform:
platform
);
fileSystem
.
file
(
'lib/main.dart'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'test_driver/main_test.dart'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
try
{
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'drive'
,
'--no-pub'
]);
}
on
Exception
{
// Expected to throw
}
expect
(
command
.
shouldRunPub
,
false
);
try
{
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'drive'
]);
}
on
Exception
{
// Expected to throw
}
expect
(
command
.
shouldRunPub
,
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Pub:
()
=>
FakePub
(),
});
}
class
ScreenshotDevice
extends
Fake
implements
Device
{
...
...
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