ker*_*ite 3 lcov flutter windows-subsystem-for-linux
我一直在尝试使用 WSL 为我的 flutter 项目的代码覆盖率生成 html 报告,但是当我运行时会发生这种情况genhtml coverage/lcov.info -o coverage/html:
Reading data file coverage/lcov.info
Resolved relative source file path "lib\blocs\bloc1\bloc1.dart" with CWD to "/mnt/c/Users/User/flutter_project/lib\blocs\bloc1\bloc1.dart".
Found 284 entries.
Found common filename prefix "/mnt/c/Users/User/flutter_project"
Writing .css and .png files.
Generating output.
Processing file flutter_project/lib\otherDir\other_file.dart
genhtml: ERROR: cannot read /mnt/c/Users/User/flutter_project/lib\otherDir\other_file.dart
Run Code Online (Sandbox Code Playgroud)
我可以理解这可能与路径有关,但我不确定如何修复它。有小费吗?
小智 5
我在尝试通过 WSL 使用 lcov 时遇到了同样的问题,并且我已经解决了这个问题。
Windows 上生成的 lcov 文件的路径使用flutter test --coverage反斜杠\而不是正斜杠/。
只需在运行之前将文件中的所有反斜杠替换lcov.info为正斜杠genhtml,就可以解决问题。
| 归档时间: |
|
| 查看次数: |
1823 次 |
| 最近记录: |