Skip to content

Corkscrews/dart_test_filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dart_test_filter

A clean, color-coded test output filter for dart test and flutter test. Suppresses noisy JSON reporter logs and replaces them with a live progress line and clear failure details.

Features

  • Works with both dart test and flutter test
  • 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 1 when any test fails

Requirements

  • Python 3.10+
  • Dart SDK or Flutter SDK

Installation

pipx (recommended)

pipx install git+https://github.com/Corkscrews/dart_test_filter.git

This installs dart-test-filter globally in an isolated environment. No venv activation needed.

From source

make install

This creates a .venv, installs the package and dev dependencies into it.

Usage

Activate the venv once, then use dart-test-filter anywhere:

source .venv/bin/activate
cd your_dart_project/
dart test --reporter json | dart-test-filter
flutter test --reporter json | dart-test-filter

Or skip activation and use the full path:

dart test --reporter json | /path/to/dart_test_filter/.venv/bin/dart-test-filter

--ci

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

CI output:

Resolving dependencies...
Downloading packages...
Got dependencies! (52 outdated dependencies hidden)

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
==================================================

--report

Pass --report to write all errors and skipped tests to a timestamped log file:

dart test --reporter json | dart-test-filter --report
# creates 20260312_143022.log

Example Output

Running: 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
==================================================

Development

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

How It Works

The filter reads JSON events from stdin and processes five event types:

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

Project Structure

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_integration.py # End-to-end with dart test
example/               # Minimal Dart project for integration tests

About

A clean, color-coded test output filter for `dart test` and `flutter test`.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors