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
22f17004
Unverified
Commit
22f17004
authored
Jan 26, 2021
by
Jia Hao
Committed by
GitHub
Jan 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Make setting of CWD consistent for flutter test (#74622)
parent
2eeeba9c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
26 additions
and
24 deletions
+26
-24
working_directory_expectation.txt
...ated_tests/flutter_test/working_directory_expectation.txt
+1
-0
working_directory_test.dart
dev/automated_tests/flutter_test/working_directory_test.dart
+12
-0
vitool_test.dart
dev/tools/vitool/test/vitool_test.dart
+1
-3
translations_test.dart
...utter_localizations/test/cupertino/translations_test.dart
+1
-1
translations_test.dart
...lutter_localizations/test/material/translations_test.dart
+1
-1
fuchsia_tester.dart
packages/flutter_tools/bin/fuchsia_tester.dart
+0
-1
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+5
-7
runner.dart
packages/flutter_tools/lib/src/test/runner.dart
+0
-10
test_test.dart
packages/flutter_tools/test/integration.shard/test_test.dart
+4
-0
binding_fail_test.dart
packages/integration_test/test/binding_fail_test.dart
+1
-1
No files found.
dev/automated_tests/flutter_test/working_directory_expectation.txt
0 → 100644
View file @
22f17004
[0-9]+:[0-9]+ [+]1: All tests passed!
dev/automated_tests/flutter_test/working_directory_test.dart
0 → 100644
View file @
22f17004
// Copyright 2014 The Flutter 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:io'
;
import
'package:test/test.dart'
hide
TypeMatcher
,
isInstanceOf
;
void
main
(
)
{
test
(
'working directory is the root of this package'
,
()
{
expect
(
Directory
.
current
.
path
,
endsWith
(
'automated_tests'
));
});
}
dev/tools/vitool/test/vitool_test.dart
View file @
22f17004
...
@@ -10,8 +10,6 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -10,8 +10,6 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:vitool/vitool.dart'
;
import
'package:vitool/vitool.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:path/path.dart'
as
path
;
const
String
kPackagePath
=
'..'
;
void
main
(
)
{
void
main
(
)
{
test
(
'parsePixels'
,
()
{
test
(
'parsePixels'
,
()
{
...
@@ -694,5 +692,5 @@ class PathAnimationMatcher extends Matcher {
...
@@ -694,5 +692,5 @@ class PathAnimationMatcher extends Matcher {
}
}
String
testAsset
(
String
name
)
{
String
testAsset
(
String
name
)
{
return
path
.
join
(
kPackagePath
,
'test_assets'
,
name
);
return
path
.
join
(
'test_assets'
,
name
);
}
}
packages/flutter_localizations/test/cupertino/translations_test.dart
View file @
22f17004
...
@@ -13,7 +13,7 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -13,7 +13,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../test_utils.dart'
;
import
'../test_utils.dart'
;
final
String
rootDirectoryPath
=
Directory
.
current
.
pa
rent
.
pa
th
;
final
String
rootDirectoryPath
=
Directory
.
current
.
path
;
void
main
(
)
{
void
main
(
)
{
for
(
final
String
language
in
kCupertinoSupportedLanguages
)
{
for
(
final
String
language
in
kCupertinoSupportedLanguages
)
{
...
...
packages/flutter_localizations/test/material/translations_test.dart
View file @
22f17004
...
@@ -13,7 +13,7 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -13,7 +13,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../test_utils.dart'
;
import
'../test_utils.dart'
;
final
String
rootDirectoryPath
=
Directory
.
current
.
pa
rent
.
pa
th
;
final
String
rootDirectoryPath
=
Directory
.
current
.
path
;
void
main
(
)
{
void
main
(
)
{
for
(
final
String
language
in
kMaterialSupportedLanguages
)
{
for
(
final
String
language
in
kMaterialSupportedLanguages
)
{
...
...
packages/flutter_tools/bin/fuchsia_tester.dart
View file @
22f17004
...
@@ -140,7 +140,6 @@ Future<void> run(List<String> args) async {
...
@@ -140,7 +140,6 @@ Future<void> run(List<String> args) async {
exitCode
=
await
const
FlutterTestRunner
().
runTests
(
exitCode
=
await
const
FlutterTestRunner
().
runTests
(
const
TestWrapper
(),
const
TestWrapper
(),
tests
.
keys
.
toList
(),
tests
.
keys
.
toList
(),
workDir:
testDirectory
,
watcher:
collector
,
watcher:
collector
,
ipv6:
false
,
ipv6:
false
,
enableObservatory:
collector
!=
null
,
enableObservatory:
collector
!=
null
,
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
22f17004
...
@@ -219,18 +219,17 @@ class TestCommand extends FlutterCommand {
...
@@ -219,18 +219,17 @@ class TestCommand extends FlutterCommand {
);
);
}
}
Directory
workDir
;
if
(
files
.
isEmpty
)
{
if
(
files
.
isEmpty
)
{
// We don't scan the entire package, only the test/ subdirectory, so that
// We don't scan the entire package, only the test/ subdirectory, so that
// files with names like like "hit_test.dart" don't get run.
// files with names like like "hit_test.dart" don't get run.
work
Dir
=
globals
.
fs
.
directory
(
'test'
);
final
Directory
test
Dir
=
globals
.
fs
.
directory
(
'test'
);
if
(!
work
Dir
.
existsSync
())
{
if
(!
test
Dir
.
existsSync
())
{
throwToolExit
(
'Test directory "
${
work
Dir.path}
" not found.'
);
throwToolExit
(
'Test directory "
${
test
Dir.path}
" not found.'
);
}
}
files
=
_findTests
(
work
Dir
).
toList
();
files
=
_findTests
(
test
Dir
).
toList
();
if
(
files
.
isEmpty
)
{
if
(
files
.
isEmpty
)
{
throwToolExit
(
throwToolExit
(
'Test directory "
${
work
Dir.path}
" does not appear to contain any test files.
\n
'
'Test directory "
${
test
Dir.path}
" does not appear to contain any test files.
\n
'
'Test files must be in that directory and end with the pattern "_test.dart".'
'Test files must be in that directory and end with the pattern "_test.dart".'
);
);
}
}
...
@@ -269,7 +268,6 @@ class TestCommand extends FlutterCommand {
...
@@ -269,7 +268,6 @@ class TestCommand extends FlutterCommand {
final
int
result
=
await
testRunner
.
runTests
(
final
int
result
=
await
testRunner
.
runTests
(
testWrapper
,
testWrapper
,
files
,
files
,
workDir:
workDir
,
names:
names
,
names:
names
,
plainNames:
plainNames
,
plainNames:
plainNames
,
tags:
tags
,
tags:
tags
,
...
...
packages/flutter_tools/lib/src/test/runner.dart
View file @
22f17004
...
@@ -27,7 +27,6 @@ abstract class FlutterTestRunner {
...
@@ -27,7 +27,6 @@ abstract class FlutterTestRunner {
Future
<
int
>
runTests
(
Future
<
int
>
runTests
(
TestWrapper
testWrapper
,
TestWrapper
testWrapper
,
List
<
String
>
testFiles
,
{
List
<
String
>
testFiles
,
{
Directory
workDir
,
List
<
String
>
names
=
const
<
String
>[],
List
<
String
>
names
=
const
<
String
>[],
List
<
String
>
plainNames
=
const
<
String
>[],
List
<
String
>
plainNames
=
const
<
String
>[],
String
tags
,
String
tags
,
...
@@ -64,7 +63,6 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...
@@ -64,7 +63,6 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
Future
<
int
>
runTests
(
Future
<
int
>
runTests
(
TestWrapper
testWrapper
,
TestWrapper
testWrapper
,
List
<
String
>
testFiles
,
{
List
<
String
>
testFiles
,
{
Directory
workDir
,
List
<
String
>
names
=
const
<
String
>[],
List
<
String
>
names
=
const
<
String
>[],
List
<
String
>
plainNames
=
const
<
String
>[],
List
<
String
>
plainNames
=
const
<
String
>[],
String
tags
,
String
tags
,
...
@@ -206,14 +204,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...
@@ -206,14 +204,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
additionalArguments:
additionalArguments
,
additionalArguments:
additionalArguments
,
);
);
// Call package:test's main method in the appropriate directory.
final
Directory
saved
=
globals
.
fs
.
currentDirectory
;
try
{
try
{
if
(
workDir
!=
null
)
{
globals
.
printTrace
(
'switching to directory
$workDir
to run tests'
);
globals
.
fs
.
currentDirectory
=
workDir
;
}
globals
.
printTrace
(
'running test package with arguments:
$testArgs
'
);
globals
.
printTrace
(
'running test package with arguments:
$testArgs
'
);
await
testWrapper
.
main
(
testArgs
);
await
testWrapper
.
main
(
testArgs
);
...
@@ -222,7 +213,6 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...
@@ -222,7 +213,6 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
return
exitCode
;
return
exitCode
;
}
finally
{
}
finally
{
globals
.
fs
.
currentDirectory
=
saved
.
path
;
await
platform
.
close
();
await
platform
.
close
();
}
}
}
}
...
...
packages/flutter_tools/test/integration.shard/test_test.dart
View file @
22f17004
...
@@ -42,6 +42,10 @@ void main() {
...
@@ -42,6 +42,10 @@ void main() {
return
_testFile
(
'trivial_widget'
,
automatedTestsDirectory
,
flutterTestDirectory
,
exitCode:
isZero
);
return
_testFile
(
'trivial_widget'
,
automatedTestsDirectory
,
flutterTestDirectory
,
exitCode:
isZero
);
});
});
testWithoutContext
(
'flutter test set the working directory correctly'
,
()
async
{
return
_testFile
(
'working_directory'
,
automatedTestsDirectory
,
flutterTestDirectory
,
exitCode:
isZero
);
});
testWithoutContext
(
'flutter test should report nice errors for exceptions thrown within testWidgets()'
,
()
async
{
testWithoutContext
(
'flutter test should report nice errors for exceptions thrown within testWidgets()'
,
()
async
{
return
_testFile
(
'exception_handling'
,
automatedTestsDirectory
,
flutterTestDirectory
);
return
_testFile
(
'exception_handling'
,
automatedTestsDirectory
,
flutterTestDirectory
);
});
});
...
...
packages/integration_test/test/binding_fail_test.dart
View file @
22f17004
...
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:path/path.dart'
as
path
;
import
'package:path/path.dart'
as
path
;
final
String
bat
=
Platform
.
isWindows
?
'.bat'
:
''
;
final
String
bat
=
Platform
.
isWindows
?
'.bat'
:
''
;
final
String
_flutterBin
=
path
.
join
(
Directory
.
current
.
parent
.
parent
.
pa
rent
.
pa
th
,
'bin'
,
'flutter
$bat
'
);
final
String
_flutterBin
=
path
.
join
(
Directory
.
current
.
parent
.
parent
.
path
,
'bin'
,
'flutter
$bat
'
);
const
String
_integrationResultsPrefix
=
const
String
_integrationResultsPrefix
=
'IntegrationTestWidgetsFlutterBinding test results:'
;
'IntegrationTestWidgetsFlutterBinding test results:'
;
const
String
_failureExcerpt
=
r'Expected: <false>\n Actual: <true>'
;
const
String
_failureExcerpt
=
r'Expected: <false>\n Actual: <true>'
;
...
...
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