如何忽略`dart-lang/coverage`中的一行 用例问题目前是不可能的

问题描述

用例

codecov 认为 super 需要测试,

enter image description here

不确定是否为此关键字

编写测试
  • 会很有意义
  • 如何编写这样的测试

我想从 coverage 中排除该行,直到我的疑虑消除

问题

如何忽略 dart-lang/coverage 中的一行

解决方法

widget_tester.dart 的文档中

testWidgets('MyWidget asserts invalid bounds',(WidgetTester tester) async {
  await tester.pumpWidget(MyWidget(-1));
  expect(tester.takeException(),isAssertionError); // or isNull,as appropriate.
});
,

我看到了。不完美,但有解决方案

// 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.
,

目前是不可能的

在 dart 和 flutter 中排除代码覆盖行(请参阅此 issue

我正在消除有关问题的歧义 what is the correct way to test super keyword

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...