how to ignore a line in `dart-lang/coverage`
1,339
Solution 1
at the moment is not possible
to exclude a line for code coverage in dart and flutter (see this issue)
I'm disambiguating the question about
what is the correct way to test super
keyword
Solution 2
I see this. Not perfect, but a solution
// coverage:ignore-line to ignore one line.
// coverage:ignore-start and // coverage:ignore-end to ignore range of lines inclusive.
// coverage:ignore-file to ignore the whole file.
Solution 3
In documentation for widget_tester.dart
testWidgets('MyWidget asserts invalid bounds', (WidgetTester tester) async {
await tester.pumpWidget(MyWidget(-1));
expect(tester.takeException(), isAssertionError); // or isNull, as appropriate.
});
![Francesco Iapicca](https://i.stack.imgur.com/p2ehG.jpg?s=256&g=1)
Author by
Francesco Iapicca
Self taught developer in love with Flutter and Dart
Updated on December 27, 2022Comments
-
Francesco Iapicca over 1 year
use case
codecov sees
super
as in need for test,not sure being sure if writing a test for this keyword
- would be meaningful
- how to write such a test
I'd like to exclude the line from coverage until my doubts are cleared
question
how do I ignore a line in
dart-lang/coverage
-
lsaudon over 3 yearsMake 2 tests 1 for begin null (expect begin is null) and 1 for end null (expect end is null)
-
lsaudon over 3 years
-
Francesco Iapicca over 3 yearsthanks, but what about super? [editing the question] also... it's not a widget
-
Christian Findlay over 2 yearsA lot people are saying it was fixed, but I'm on the latest version of Flutter and it still doesn't appear to be fixed. I can ignore a whole file, but I cannot ignore sections of a file.