Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/code_coverage/bin/code_coverage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Future<void> main() async {
'run',
'coverage:format_coverage',
'--packages',
p.join(pkgDir, '.dart_tool', 'package_config.json'),
p.join(projectDir.path, '.dart_tool', 'package_config.json'),
'-i',
rawOutputDir,
'--base-directory',
Expand Down
2 changes: 1 addition & 1 deletion pkg/code_coverage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ rm ${APP_ALL_TEST_PATH}
echo "Exporting to LCOV"
cd "${APP_DIR}"
dart run coverage:format_coverage \
--packages "${APP_DIR}/.dart_tool/package_config.json" \
--packages "${PROJECT_DIR}/.dart_tool/package_config.json" \
-i "${OUTPUT_DIR}/raw/app_unit.json" \
--base-directory "${PROJECT_DIR}" \
--lcov \
Expand Down
4 changes: 2 additions & 2 deletions pkg/code_coverage/lib/format_lcov.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Future main() async {
!e.key.startsWith('pkg/pub_integration/'))
].nonNulls;
final pubDevEntry = Entry('pub-dev')
..covered = libEntries.map((e) => e.covered).reduce((a, b) => a + b)
..total = libEntries.map((e) => e.total).reduce((a, b) => a + b);
..covered = libEntries.map((e) => e.covered).fold(0, (a, b) => a + b)
..total = libEntries.map((e) => e.total).fold(0, (a, b) => a + b);
output.writeln([
pubDevEntry.formatted('pub-dev'),
_tree['app/lib']?.formatted('app'),
Expand Down
6 changes: 4 additions & 2 deletions pkg/code_coverage/lib/test_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,20 @@ Future<void> _convertToLcov(
final out = File(outputFile);
if (await out.exists()) return;
await out.parent.create(recursive: true);
final baseDir =
Directory(packageDir.contains('/app') ? '../' : '../../').absolute.path;
await Process.run(
'dart',
[
'pub',
'run',
'coverage:format_coverage',
'--packages',
'$packageDir/.dart_tool/package_config.json',
'$baseDir/.dart_tool/package_config.json',
'-i',
inputFile,
'--base-directory',
packageDir.contains('/app') ? '../' : '../../',
baseDir,
'--lcov',
'--out',
outputFile,
Expand Down
Loading