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
fc8cdf4d
Commit
fc8cdf4d
authored
Nov 05, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a command for running unit tests
parent
f5ce5564
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
4 deletions
+52
-4
executable.dart
packages/flutter_tools/lib/executable.dart
+2
-0
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+44
-0
loader.dart
packages/flutter_tools/lib/src/test/loader.dart
+6
-4
No files found.
packages/flutter_tools/lib/executable.dart
View file @
fc8cdf4d
...
...
@@ -21,6 +21,7 @@ import 'src/commands/logs.dart';
import
'src/commands/run_mojo.dart'
;
import
'src/commands/start.dart'
;
import
'src/commands/stop.dart'
;
import
'src/commands/test.dart'
;
import
'src/commands/trace.dart'
;
import
'src/process.dart'
;
...
...
@@ -54,6 +55,7 @@ Future main(List<String> args) async {
..
addCommand
(
new
RunMojoCommand
())
..
addCommand
(
new
StartCommand
())
..
addCommand
(
new
StopCommand
())
..
addCommand
(
new
TestCommand
())
..
addCommand
(
new
TraceCommand
());
return
Chain
.
capture
(()
async
{
...
...
packages/flutter_tools/lib/src/commands/test.dart
0 → 100644
View file @
fc8cdf4d
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:logging/logging.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/src/executable.dart'
as
executable
;
import
'flutter_command.dart'
;
import
'../test/loader.dart'
as
loader
;
final
Logger
_logging
=
new
Logger
(
'sky_tools.test'
);
class
TestCommand
extends
FlutterCommand
{
final
String
name
=
'test'
;
final
String
description
=
'Runs Flutter unit tests for the current project (requires a local build of the engine).'
;
TestCommand
()
{
argParser
.
addOption
(
'build-dir'
,
defaultsTo:
'../../../engine/src/out/Debug'
);
}
String
get
_shellPath
{
if
(
Platform
.
isLinux
)
return
path
.
join
(
argResults
[
'build-dir'
],
'sky_shell'
);
if
(
Platform
.
isMacOS
)
return
path
.
join
(
argResults
[
'build-dir'
],
'SkyShell.app'
,
'Contents'
,
'MacOS'
,
'SkyShell'
);
throw
new
Exception
(
'Unsupported platform.'
);
}
@override
Future
<
int
>
runInProject
()
async
{
loader
.
shellPath
=
_shellPath
;
if
(!
FileSystemEntity
.
isFileSync
(
loader
.
shellPath
))
{
_logging
.
severe
(
'Cannot find Flutter Shell at
${loader.shellPath}
'
);
return
1
;
}
loader
.
installHook
();
await
executable
.
main
(
argResults
.
rest
);
return
exitCode
;
}
}
packages/flutter_tools/lib/src/test/loader.dart
View file @
fc8cdf4d
...
...
@@ -29,8 +29,10 @@ final String _kSkyShell = Platform.environment['SKY_SHELL'];
const
String
_kHost
=
'127.0.0.1'
;
const
String
_kPath
=
'/runner'
;
String
shellPath
;
// Right now a bunch of our tests crash or assert after the tests have finished running.
// Mostly this is just because the test puts the framework in an inconsistent state with
// Mostly this is just because the test puts the framework in an inconsistent state with
// a scheduled microtask that verifies that state. Eventually we should fix all these
// problems but for now we'll just paper over them.
const
bool
kExpectAllTestsToCloseCleanly
=
false
;
...
...
@@ -54,8 +56,8 @@ Future<_ServerInfo> _createServer() async {
}
Future
<
Process
>
_startProcess
(
String
path
,
{
String
packageRoot
})
{
assert
(
_kSkyShell
!=
null
);
// Please provide the path to the shell in the SKY_SHELL environment variable.
return
Process
.
start
(
_kSkyShell
,
[
assert
(
shellPath
!=
null
||
_kSkyShell
!=
null
);
// Please provide the path to the shell in the SKY_SHELL environment variable.
return
Process
.
start
(
shellPath
??
_kSkyShell
,
[
'--enable-checked-mode'
,
'--non-interactive'
,
'--package-root=
$packageRoot
'
,
...
...
@@ -172,7 +174,7 @@ void main() {
completer
.
complete
(
response
[
"tests"
].
map
((
test
)
{
var
testMetadata
=
new
Metadata
.
deserialize
(
test
[
'metadata'
]);
return
new
RemoteTest
(
test
[
'name'
],
testMetadata
,
socket
,
test
[
'index'
]);
}));
}));
}
});
...
...
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