how to ignore a line in `dart-lang/coverage`

Viewed 1886

use case

codecov sees super as in need for test,

enter image description here

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

3 Answers

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.

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.
});
Related