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
bc20f2ee
Unverified
Commit
bc20f2ee
authored
Feb 24, 2021
by
Jia Hao
Committed by
GitHub
Feb 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Fail fast when test dependencies are missing (#76679)
parent
e4373882
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
+46
-3
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+1
-2
test_test.dart
...flutter_tools/test/commands.shard/hermetic/test_test.dart
+45
-1
No files found.
packages/flutter_tools/lib/src/commands/test.dart
View file @
bc20f2ee
...
...
@@ -219,8 +219,7 @@ class TestCommand extends FlutterCommand {
final
BuildInfo
buildInfo
=
await
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
if
(
buildInfo
.
packageConfig
[
'test_api'
]
==
null
)
{
globals
.
printError
(
'
\n
'
throwToolExit
(
'Error: cannot run without a dependency on either "package:flutter_test" or "package:test". '
'Ensure the following lines are present in your pubspec.yaml:'
'
\n\n
'
...
...
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
View file @
bc20f2ee
...
...
@@ -5,6 +5,7 @@
// @dart = 2.8
import
'dart:async'
;
import
'dart:convert'
;
import
'package:args/command_runner.dart'
;
import
'package:file/memory.dart'
;
...
...
@@ -25,6 +26,25 @@ import '../../src/common.dart';
import
'../../src/context.dart'
;
import
'../../src/testbed.dart'
;
const
String
_pubspecContents
=
'''
dev_dependencies:
flutter_test:
sdk: flutter'''
;
final
String
_packageConfigContents
=
json
.
encode
(<
String
,
Object
>{
'configVersion'
:
2
,
'packages'
:
<
Map
<
String
,
Object
>>[
<
String
,
String
>{
'name'
:
'test_api'
,
'rootUri'
:
'file:///path/to/pubcache/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.19'
,
'packageUri'
:
'lib/'
,
'languageVersion'
:
'2.12'
}
],
'generated'
:
'2021-02-24T07:55:20.084834Z'
,
'generator'
:
'pub'
,
'generatorVersion'
:
'2.13.0-68.0.dev'
});
void
main
(
)
{
Cache
.
disableLocking
();
MemoryFileSystem
fs
;
...
...
@@ -32,10 +52,34 @@ void main() {
setUp
(()
{
fs
=
MemoryFileSystem
.
test
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
writeAsStringSync
(
_pubspecContents
);
(
fs
.
directory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
..
createSync
(
recursive:
true
))
.
writeAsString
(
_packageConfigContents
);
fs
.
directory
(
'test'
).
childFile
(
'some_test.dart'
).
createSync
(
recursive:
true
);
});
testUsingContext
(
'Missing dependencies in pubspec'
,
()
async
{
// Clear the dependencies already added in [setUp].
fs
.
file
(
'pubspec.yaml'
).
writeAsStringSync
(
''
);
fs
.
directory
(
'.dart_tool'
).
childFile
(
'package_config.json'
).
writeAsStringSync
(
''
);
final
FakePackageTest
fakePackageTest
=
FakePackageTest
();
final
TestCommand
testCommand
=
TestCommand
(
testWrapper:
fakePackageTest
);
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
testCommand
);
expect
(()
=>
commandRunner
.
run
(
const
<
String
>[
'test'
,
'--no-pub'
,
]),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Pipes test-randomize-ordering-seed to package:test'
,
()
async
{
final
FakePackageTest
fakePackageTest
=
FakePackageTest
();
...
...
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