add: adding support for code coverage
This commit is contained in:
parent
848ffd4988
commit
f8db3107b9
4 changed files with 28 additions and 1 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -5,6 +5,10 @@
|
||||||
.packages
|
.packages
|
||||||
build/
|
build/
|
||||||
|
|
||||||
|
# Coverage files
|
||||||
|
coverage/
|
||||||
|
coverage_report/
|
||||||
|
|
||||||
# Files and directories created by developer
|
# Files and directories created by developer
|
||||||
spike/
|
spike/
|
||||||
devbox.d/
|
devbox.d/
|
||||||
|
|
17
.melos/coverage.yaml
Normal file
17
.melos/coverage.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
scripts:
|
||||||
|
_: &coverage_scripts
|
||||||
|
coverage:
|
||||||
|
run: >
|
||||||
|
melos exec -c 1 --fail-fast -- "dart pub add --dev coverage && dart test --coverage=coverage && dart pub global activate coverage && dart pub global run coverage:format_coverage -l --packages=.dart_tool/package_config.json --report-on=lib/ -i coverage -o coverage/lcov.info && dart pub remove coverage"
|
||||||
|
description: Run tests with coverage and generate LCOV report for each package
|
||||||
|
coverage_report:
|
||||||
|
run: >
|
||||||
|
melos exec -c 1 --fail-fast -- "
|
||||||
|
if [ -s coverage/lcov.info ]; then
|
||||||
|
genhtml -o coverage_report coverage/lcov.info;
|
||||||
|
echo 'Coverage report generated successfully.';
|
||||||
|
else
|
||||||
|
echo 'No valid coverage data found. Skipping report generation.';
|
||||||
|
fi
|
||||||
|
"
|
||||||
|
description: Generate HTML coverage report from LCOV data for each package, if valid data exists
|
|
@ -62,6 +62,12 @@ scripts:
|
||||||
docs:serve:custom:
|
docs:serve:custom:
|
||||||
run: "melos exec --scope=\"$MELOS_SCOPE\" -- \"echo 'Serving docs for {MELOS_PACKAGE_NAME}' && dhttpd --path doc --port \\${DOC_PORT:-8080}\"\n"
|
run: "melos exec --scope=\"$MELOS_SCOPE\" -- \"echo 'Serving docs for {MELOS_PACKAGE_NAME}' && dhttpd --path doc --port \\${DOC_PORT:-8080}\"\n"
|
||||||
description: Serve generated documentation for specified packages (use with MELOS_SCOPE and optionally DOC_PORT env vars)
|
description: Serve generated documentation for specified packages (use with MELOS_SCOPE and optionally DOC_PORT env vars)
|
||||||
|
coverage:
|
||||||
|
run: "melos exec -c 1 --fail-fast -- \"dart pub add --dev coverage && dart test --coverage=coverage && dart pub global activate coverage && dart pub global run coverage:format_coverage -l --packages=.dart_tool\/package_config.json --report-on=lib\/ -i coverage -o coverage\/lcov.info && dart pub remove coverage\"\n"
|
||||||
|
description: Run tests with coverage and generate LCOV report for each package
|
||||||
|
coverage_report:
|
||||||
|
run: "melos exec -c 1 --fail-fast -- \" if [ -s coverage\/lcov.info ]; then\n genhtml -o coverage_report coverage\/lcov.info;\n echo 'Coverage report generated successfully.';\nelse\n echo 'No valid coverage data found. Skipping report generation.';\nfi \"\n"
|
||||||
|
description: "Generate HTML coverage report from LCOV data for each package, if valid data exists"
|
||||||
test:
|
test:
|
||||||
run: melos exec -c 1 --fail-fast -- "dart test"
|
run: melos exec -c 1 --fail-fast -- "dart test"
|
||||||
description: Run tests for all packages
|
description: Run tests for all packages
|
||||||
|
|
Loading…
Reference in a new issue