-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dart2 + Coverage not working #15681
Comments
Seemingly this issue was resolved a week or so ago: |
Thanks for the info! I didn't see the fix on the latest dev branch, and master wasn't working for me either haha. I'll wait for this change to land on master! |
@brianegan this issue should be resolved on master, we rolled the engine that included the Dart side of the fix. I just tried with Can you check if your |
Ah I see the master is broken for you due to optional- Unfortunately that means in the meanwhile you can't use optional- |
With this patch: diff --git a/test/flutter_redux_test.dart b/test/flutter_redux_test.dart
index 666f1e7..75fe9e2 100644
--- a/test/flutter_redux_test.dart
+++ b/test/flutter_redux_test.dart
@@ -11,7 +11,7 @@ void main() {
identityReducer,
initialState: "I",
);
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: store,
child: StoreCaptor<String>(),
);
@@ -27,7 +27,7 @@ void main() {
testWidgets('should update the children if the store changes',
(WidgetTester tester) async {
Widget widget([String state]) {
- return StoreProvider<String>(
+ return new StoreProvider<String>(
store: Store<String>(
identityReducer,
initialState: state,
@@ -49,11 +49,11 @@ void main() {
group('StoreConnector', () {
testWidgets('initially builds from the current state of the store',
(WidgetTester tester) async {
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: Store<String>(identityReducer, initialState: "I"),
child: new StoreBuilder<String>(
builder: (context, store) {
- return Text(
+ return new Text(
store.state,
textDirection: TextDirection.ltr,
);
@@ -68,12 +68,12 @@ void main() {
testWidgets('can convert the store to a ViewModel',
(WidgetTester tester) async {
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: Store<String>(identityReducer, initialState: "I"),
child: new StoreConnector<String, String>(
converter: selector,
builder: (context, latest) {
- return Text(
+ return new Text(
latest,
textDirection: TextDirection.ltr,
);
@@ -92,11 +92,11 @@ void main() {
identityReducer,
initialState: "I",
);
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: store,
child: new StoreBuilder<String>(
builder: (context, store) {
- return Text(
+ return new Text(
store.state,
textDirection: TextDirection.ltr,
);
@@ -123,7 +123,7 @@ void main() {
identityReducer,
initialState: "I",
);
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: store,
child: new StoreConnector<String, String>(
converter: selector,
@@ -155,7 +155,7 @@ void main() {
identityReducer,
initialState: "I",
);
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: store,
child: new StoreConnector<String, String>(
converter: selector,
@@ -192,7 +192,7 @@ void main() {
identityReducer,
initialState: "I",
);
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: store,
child: new StoreConnector<String, String>(
ignoreChange: (dynamic state) => state == 'N',
@@ -229,7 +229,7 @@ void main() {
initialState: "A",
);
final Widget Function() widget = () {
- return StoreProvider<String>(
+ return new StoreProvider<String>(
store: store,
child: new StoreConnector<String, String>(
onInit: counter,
@@ -279,7 +279,7 @@ void main() {
initialState: "I",
);
final Widget Function() widget = () {
- return StoreProvider<String>(
+ return new StoreProvider<String>(
store: store,
child: new StoreConnector<String, String>(
converter: selector,
@@ -309,7 +309,7 @@ void main() {
initialState: "A",
);
final Widget Function() widget = () {
- return StoreProvider<String>(
+ return new StoreProvider<String>(
store: store,
child: new StoreConnector<String, String>(
onDispose: counter,
@@ -342,7 +342,7 @@ void main() {
initialState: "A",
);
final Widget Function() widget = () {
- return StoreProvider<String>(
+ return new StoreProvider<String>(
store: store,
child: new StoreBuilder<String>(
onInit: counter,
@@ -391,7 +391,7 @@ void main() {
initialState: "init",
);
final Widget Function() widget = () {
- return StoreProvider<String>(
+ return new StoreProvider<String>(
store: store,
child: new StoreBuilder<String>(
onDispose: counter,
@@ -422,7 +422,7 @@ void main() {
identityReducer,
initialState: "I",
);
- final widget = StoreProvider<String>(
+ final widget = new StoreProvider<String>(
store: store,
child: new StoreConnector<String, String>(
// Same exact setup as the previous test, but distinct is set to true. I have all tests in pass in your $ flutter test --preview-dart-2 --coverage --coverage-path=lcov.info
00:06 +0: ...home/vegorov/src/third_party/flutter_redux/test/flutter_redux_test.dart
00:43 +14: All tests passed!
Collecting coverage information... |
I will close this issue for now, because the underlying issue is resolved. Thanks for trying out Dart 2, sorry it is a bit of the bumpy ride! |
@mraleph Ah, interesting! Ok, I'll pop in the optional new / const for now to get it running again. Thanks for taking the time to help me track down the problem :) |
@brianegan @mraleph I am getting the same error, The error stack trace is hard to understand. I tried adding the new keyword wherever I could. I am not sure what token number indicates. Here is my error stack trace, and flutter doctor overview. Any help is appreciated.
Flutter Doctor
Here is the simple widget_test I wrote
I cannot put the entire code here. I am using bloc pattern, thus have blocProviders and blocs. But I do not believe the problem lies with it. My test cases pass, but the coverage is an issue. |
@Shantanu-Kotambkar can you open |
@mraleph There isn't a position 4144. Here is my blocTextField.dart import 'dart:async';
import '../validators.dart';
import 'package:rxdart/rxdart.dart';
class BlocTextField extends Object with Validators {
final _textFieldController = new BehaviorSubject<dynamic>();
final String regExp;
final bool isOptional;
final String fieldName;
BlocTextField({this.fieldName, this.regExp, this.isOptional});
//To change data to our Stream using Sink.
Function(dynamic) get changeTextField => _textFieldController.sink.add;
//To add TextField data from Stream.
Stream<dynamic> get textFieldStream => _textFieldController.stream
.transform(validateTextField(isOptional, regExp, fieldName));
dispose() {
_textFieldController.close();
}
} |
Thanks. I think this gives us some information to start investigation from. /cc @aam @kmillikin were there any recent changes to mixins that might lead to incorrect token positions? The error we are seeing above usually indicates that there is a mismatch between script uri and file location. |
@Shantanu-Kotambkar can you provide the content of (note: you can use tripple tick ``` to escape large blocks of code) |
@Shantanu-Kotambkar ping. do you still have the error happening? |
@mraleph sorry, I wasn't active here for the past few days .
|
@mraleph Here is one of the validate method class Validators {
validateTextField(bool isOptional, String regExp, String fieldName) {
return StreamTransformer<dynamic, dynamic>.fromHandlers(
handleData: (textFieldStream, sink) {
RegExp test = new RegExp(regExp);
bool optionalFlag = isOptional && textFieldStream == '';
bool validFlag = optionalFlag || test.hasMatch(textFieldStream);
switch (validFlag) {
case false:
sink.addError('Text Error');
dataBloc.errorMap[fieldName] = textFieldStream;
removeEntry(dataBloc.dataMap, fieldName);
break;
case true:
sink.add(textFieldStream);
dataBloc.dataMap[fieldName] = textFieldStream;
removeEntry(dataBloc.errorMap, fieldName);
break;
}
});
} |
Here is my flutter doctor result
|
There's nothing specific that I can think of. We have to try to reproduce this. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Hi all, I'm trying to update some of my Flutter libraries, but have found code coverage isn't working. This breaks my CI pipelines and prevents me from tracking code coverage.
Thanks for any help you could provide!
Steps to Reproduce
flutter test --preview-dart-2
flutter test --preview-dart-2 --coverage
Logs
Flutter Analyze
Flutter Doctor
The text was updated successfully, but these errors were encountered: