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

3

8

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

Godart answered 12/2, 2021 at 10:26 Comment(2)
Make 2 tests 1 for begin null (expect begin is null) and 1 for end null (expect end is null)Attic
github.com/dart-lang/coverage/issues/162Attic
A
15

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.
Attic answered 12/2, 2021 at 12:15 Comment(0)
R
2

This might help meanwhile:

// coverage:ignore-start
}) : super(
begin: begin,
end: end,
);
// coverage:ignore-end
Reiko answered 29/12, 2022 at 7:10 Comment(0)
A
1

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.
});
Attic answered 12/2, 2021 at 11:27 Comment(1)
thanks, but what about super? [editing the question] also... it's not a widgetGodart

© 2022 - 2024 — McMap. All rights reserved.