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
f7a09bd2
Unverified
Commit
f7a09bd2
authored
Jun 19, 2020
by
Helin Shiah
Committed by
GitHub
Jun 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration tests for structured error (#59809)
parent
b9af6551
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
0 deletions
+113
-0
flutter_run_with_error_test.dart
...s/test/integration.shard/flutter_run_with_error_test.dart
+69
-0
project_with_early_error.dart
...integration.shard/test_data/project_with_early_error.dart
+41
-0
test_driver.dart
...ges/flutter_tools/test/integration.shard/test_driver.dart
+3
-0
No files found.
packages/flutter_tools/test/integration.shard/flutter_run_with_error_test.dart
0 → 100644
View file @
f7a09bd2
// 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:async'
;
import
'package:file/file.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'../src/common.dart'
;
import
'test_data/project_with_early_error.dart'
;
import
'test_driver.dart'
;
import
'test_utils.dart'
;
void
main
(
)
{
Directory
tempDir
;
final
ProjectWithEarlyError
_project
=
ProjectWithEarlyError
();
const
String
_exceptionStart
=
'══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞══════════════════'
;
FlutterRunTestDriver
_flutter
;
setUp
(()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'run_test.'
);
await
_project
.
setUpIn
(
tempDir
);
_flutter
=
FlutterRunTestDriver
(
tempDir
);
});
tearDown
(()
async
{
await
_flutter
.
stop
();
tryToDelete
(
tempDir
);
});
test
(
'flutter run reports an early error in an application'
,
()
async
{
final
StringBuffer
stdout
=
StringBuffer
();
_flutter
.
stdout
.
listen
(
stdout
.
writeln
);
await
_flutter
.
run
(
startPaused:
true
,
withDebugger:
true
,
structuredErrors:
true
);
await
_flutter
.
resume
();
await
_flutter
.
stop
();
expect
(
stdout
.
toString
(),
contains
(
_exceptionStart
));
});
test
(
'flutter run for web reports an early error in an application'
,
()
async
{
final
StringBuffer
stdout
=
StringBuffer
();
await
_flutter
.
run
(
startPaused:
true
,
withDebugger:
true
,
structuredErrors:
true
,
chrome:
true
);
await
_flutter
.
resume
();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
bool
lineFound
=
false
;
await
Future
<
void
>(()
async
{
_flutter
.
stdout
.
listen
((
String
line
)
{
stdout
.
writeln
(
line
);
if
(
line
.
startsWith
(
'Another exception was thrown'
)
&&
!
lineFound
)
{
lineFound
=
true
;
completer
.
complete
();
}
});
await
completer
.
future
;
}).
timeout
(
const
Duration
(
seconds:
15
),
onTimeout:
()
{
// Complete anyway in case we don't see the 'Another exception' line.
completer
.
complete
();
});
expect
(
stdout
.
toString
(),
contains
(
_exceptionStart
));
await
_flutter
.
stop
();
},
skip:
'Running in cirrus environment causes premature exit'
);
}
packages/flutter_tools/test/integration.shard/test_data/project_with_early_error.dart
0 → 100644
View file @
f7a09bd2
// 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
'project.dart'
;
class
ProjectWithEarlyError
extends
Project
{
@override
final
String
pubspec
=
'''
name: test
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
'''
;
@override
final
String
main
=
r''
'
import '
dart:
async
';
import '
package:
flutter
/
material
.
dart
';
Future<void> main() async {
while (true) {
runApp(new MyApp());
await Future.delayed(const Duration(milliseconds: 50));
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
throw FormatException();
}
}
'''
;
}
packages/flutter_tools/test/integration.shard/test_driver.dart
View file @
f7a09bd2
...
...
@@ -437,6 +437,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
bool
startPaused
=
false
,
bool
pauseOnExceptions
=
false
,
bool
chrome
=
false
,
bool
structuredErrors
=
false
,
File
pidFile
,
String
script
,
})
async
{
...
...
@@ -451,6 +452,8 @@ class FlutterRunTestDriver extends FlutterTestDriver {
...<
String
>[
'chrome'
,
'--web-run-headless'
,
'--web-enable-expression-evaluation'
]
else
'flutter-tester'
,
if
(
structuredErrors
)
'--dart-define=flutter.inspector.structuredErrors=true'
,
],
withDebugger:
withDebugger
,
startPaused:
startPaused
,
...
...
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