Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ lib/generated/

# Mutation testing reports
mutation-test-report/

# Coverage output (regenerated by `flutter test --coverage`)
coverage/
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,62 @@ flutter format .
# Run tests
flutter test
flutter test integration_test/

# Run tests and produce a coverage report
flutter test --coverage
dart run tool/coverage_report.dart
```

## 🧪 Test Coverage

**Current line coverage: 33.00% (6,498 of 19,689 lines), across 952 tests.**

The figure counts every non-generated file under `lib/`. Generated sources
(`lib/generated/**`, `*.g.dart`, `*.freezed.dart`, `*.mocks.dart`) are excluded
because `build_runner` re-creates them on every build; counting them would
distort the number.

### Checking coverage yourself

```bash
flutter pub get
dart run build_runner build -d # generates mocks and localization
flutter test --coverage # writes coverage/lcov.info
dart run tool/coverage_report.dart # prints the summary
```

`tool/coverage_report.dart` reads `coverage/lcov.info` and prints total line
coverage, the number of files measured, and any `lib/` file that no test ever
loaded. Those untouched files are reported explicitly instead of being dropped
from the denominator, which is what a plain `lcov` summary would do.

Useful flags:

```bash
# List the files with the most uncovered lines
dart run tool/coverage_report.dart --top 20

# Fail with a non-zero exit code below a threshold (handy in CI)
dart run tool/coverage_report.dart --min 33
```

For an annotated HTML report, `lcov` works on the same file:

```bash
genhtml coverage/lcov.info -o coverage/html && open coverage/html/index.html
```

### What is and is not covered

- **Well covered**: protocol models and payloads, enums, the order state
machine (`MostroFSM`, `OrderState`), relay models, shared utilities, and most
presentational widgets plus the settings, logs and wallet screens.
- **Thin or uncovered**: `main.dart` and platform bootstrap, background and
push-notification services, Firebase glue, the restore manager, and the
long-lived Nostr/subscription notifiers. These need a live relay, a platform
channel, or a substantial mocking harness, so they are exercised by
`integration_test/` rather than by unit tests.

### Code Quality
This project maintains **zero Flutter analyze issues** and follows modern Flutter best practices:
- Updated to latest APIs (no deprecated warnings)
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ dev_dependencies:
sdk: flutter
flutter_intl: ^0.0.1
mockito: ^5.4.5
# In-memory SharedPreferencesAsync backend for widget tests
shared_preferences_platform_interface: ^2.4.1
Comment thread
coderabbitai[bot] marked this conversation as resolved.
build_runner: ^2.4.0
# Mutation testing for test quality assurance
mutation_test: ^1.8.0
Expand Down Expand Up @@ -176,3 +178,4 @@ flutter_launcher_icons:
adaptive_icon_foreground: "assets/images/launcher-icon.png"
adaptive_icon_background: "#2D2D2D"
min_sdk_android: 21

Loading
Loading