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
2ee15bfd
Commit
2ee15bfd
authored
Mar 28, 2016
by
Yegor
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2962 from yjbanov/drive-pass-exit-code
[driver] propagate exit code from package:test
parents
8a2ee2c0
28b51867
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+5
-4
drive_test.dart
packages/flutter_tools/test/drive_test.dart
+32
-1
No files found.
packages/flutter_tools/lib/src/commands/drive.dart
View file @
2ee15bfd
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
as
io
;
import
'package:path/path.dart'
as
path
;
import
'package:test/src/executable.dart'
as
executable
;
// ignore: implementation_imports
...
...
@@ -110,7 +111,6 @@ class DriveCommand extends RunCommandBase {
try
{
return
await
testRunner
([
testFile
])
.
then
((
_
)
=>
0
)
.
catchError
((
dynamic
error
,
dynamic
stackTrace
)
{
printError
(
'CAUGHT EXCEPTION:
$error
\n
$stackTrace
'
);
return
1
;
...
...
@@ -285,15 +285,16 @@ Future<int> startApp(DriveCommand command) async {
}
/// Runs driver tests.
typedef
Future
<
Null
>
TestRunner
(
List
<
String
>
testArgs
);
typedef
Future
<
int
>
TestRunner
(
List
<
String
>
testArgs
);
TestRunner
testRunner
=
runTests
;
void
restoreTestRunner
(
)
{
testRunner
=
runTests
;
}
Future
<
Null
>
runTests
(
List
<
String
>
testArgs
)
{
Future
<
int
>
runTests
(
List
<
String
>
testArgs
)
async
{
printTrace
(
'Running driver tests.'
);
return
executable
.
main
(
testArgs
);
await
executable
.
main
(
testArgs
);
return
io
.
exitCode
;
}
...
...
packages/flutter_tools/test/drive_test.dart
View file @
2ee15bfd
...
...
@@ -146,7 +146,7 @@ void main() {
});
testRunner
=
expectAsync
((
List
<
String
>
testArgs
)
{
expect
(
testArgs
,
[
testFile
]);
return
new
Future
<
Null
>.
value
(
);
return
new
Future
<
int
>.
value
(
0
);
});
appStopper
=
expectAsync
((
_
)
{
return
new
Future
<
int
>.
value
(
0
);
...
...
@@ -167,6 +167,37 @@ void main() {
});
});
testUsingContext
(
'returns exitCode set by test runner'
,
()
async
{
withMockDevice
();
String
testApp
=
'/some/app/test/e2e.dart'
;
String
testFile
=
'/some/app/test_driver/e2e_test.dart'
;
appStarter
=
expectAsync
((
_
)
{
return
new
Future
<
int
>.
value
(
0
);
});
testRunner
=
expectAsync
((
_
)
{
return
new
Future
<
int
>.
value
(
123
);
});
appStopper
=
expectAsync
((
_
)
{
return
new
Future
<
int
>.
value
(
0
);
});
MemoryFileSystem
memFs
=
fs
;
await
memFs
.
file
(
testApp
).
writeAsString
(
'main() {}'
);
await
memFs
.
file
(
testFile
).
writeAsString
(
'main() {}'
);
List
<
String
>
args
=
[
'drive'
,
'--target=
$testApp
'
,
];
return
createTestCommandRunner
(
command
).
run
(
args
).
then
((
int
code
)
{
expect
(
code
,
equals
(
123
));
BufferLogger
buffer
=
logger
;
expect
(
buffer
.
errorText
,
isEmpty
);
});
});
group
(
'findTargetDevice'
,
()
{
testUsingContext
(
'uses specified device'
,
()
async
{
...
...
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