A clean, color-coded test output filter for dart test, flutter test, and
flutter drive UI / integration tests. Suppresses noisy reporter and app logs
and replaces them with a live progress line and clear failure details.
- Works with
dart test,flutter test, and UI integration tests (flutter drive) - Live progress bar with completed/total count and percentage
- Color-coded output: green for passed, yellow for skipped, red for failed
- Inline failure details with error messages and stack traces
- Clean summary banner at the end
- ANSI color support detection (including Windows)
- Exits with code
1when any test fails - UI mode (
--ui/ auto-detect): parses[uitest]protocol lines and hides Dio/HTTP/socket noise - ASCII-safe output (default): strips multi-byte UTF-8 from printed output to avoid IDE terminal decode noise during long runs; use
--unicodefor emoji and raw Unicode
- Python 3.10+
- Dart SDK or Flutter SDK
pipx install git+https://github.com/Corkscrews/dart_test_filter.gitThis installs dart-test-filter globally in an isolated environment. No venv activation needed.
make installThis creates a .venv, installs the package and dev dependencies into it.
source .venv/bin/activate
dart test --reporter json | dart-test-filter
flutter test --reporter json | dart-test-filterEmit structured lines from Dart (see UiTestLog in the host app), then:
flutter drive ... 2>&1 | dart-test-filter --ui--ui is also auto-enabled when the first [uitest] line appears. Pass --all
to keep raw drive/app logs alongside filtered progress.
Protocol:
[uitest] suite start|<id>|<label>|<expectedSteps>
[uitest] step start|<suiteId>|<stepId>|<label>
[uitest] step pass|<suiteId>|<stepId>
[uitest] step fail|<suiteId>|<stepId>|<message>
[uitest] suite done|<id>
[uitest] note|<suiteId>|<message>
flutter drive may prefix lines with flutter: ; the filter strips that.
Example UI output:
SUITE: Offline consultation (4 steps)
-> Offline consultation / Scenario A: full offline
[ok] Offline consultation / Scenario A: full offline
Running: 1/4 (25%) | Passed: 1
FAIL: Offline consultation / Scenario C: online then mid-drop
pumpAndSettle timed out
==================================================
4 steps: 1 passed, 0 skipped, 1 failed
==================================================
Pass --ci for CI-friendly output. Suppresses the live progress bar (which uses \r and doesn't render well in CI log viewers) and collapses verbose dependency-resolution output into a single line. Only failures and the final summary are printed.
flutter test --reporter json 2>&1 | dart-test-filter --ci
flutter drive ... 2>&1 | dart-test-filter --ui --ciPass --report to write all errors and skipped tests to a timestamped log file:
dart test --reporter json | dart-test-filter --report
# creates 20260312_143022.logRunning: 42/50 (84%) | Passed: 40 | Skipped: 1 | Failed: 1
FAIL: subtract subtracts two numbers
Expected: <6>
Actual: <14.0>
test/calculator_test.dart 27:7 main.<fn>.<fn>
==================================================
50 tests: 48 passed, 1 skipped, 1 failed
==================================================
make install # create .venv and install package + dev deps
make test # run all tests
make test-unit # unit tests only (no Dart SDK needed)
make test-integration # end-to-end with dart test
make lint # ruff check
make format # ruff format
make clean # remove .venv, caches, build artifacts| Event | Action |
|---|---|
group |
Extracts total expected test count |
testStart |
Registers the test by ID |
error |
Buffers error/stack trace for the test |
testDone |
Updates counters, prints failures inline |
done |
Prints the final summary banner |
| Line | Action |
|---|---|
suite start |
Adds expected step count, prints suite header |
step start / pass / fail |
Updates counters, progress, inline failures |
note |
Always printed (even when noise is hidden) |
Flutter EXCEPTION CAUGHT |
Captured and printed in filtered UI mode |
src/dart_test_filter/
├── __init__.py # Package exports and CLI entry point
├── __main__.py # python -m support
└── filter.py # TestFilter class and AnsiColors
tests/
├── conftest.py # Shared fixtures
├── test_filter.py # Unit tests (no Dart SDK needed)
├── test_ui_filter.py # [uitest] protocol unit tests
└── test_integration.py # End-to-end with dart test
example/ # Minimal Dart project for integration tests