-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Use case
When running flutter test on a CI, output is very verbose and hard to follow:
The current alternative is to output to json with flutter test --machine. This is even more verbose, but can be converted to JUnit XML so we can use a specialized test visualization tools, such as Bitrise Test Reports.
This does the job, but requires a lot of configuration and there is currently no way of having two reporters at the same time.
If I want both CLI output and JSON, I need to run tests twice.
I want to be able to output to any format while still having a console output (customizable as well).
Proposal
Flutter should have a --reporter CLI option, inspired by Mocha Reporters or Jest Reporters.
# Current output if not in CI environment
flutter test
# Simple, CI friendly output
flutter test --reporter spec
# Minimal output with number of passes AND json output to test_results.json file
flutter test --reporter min --reporter json --reporter-option output=test_results.json
# JUnit XML report out of the box
flutter test --reporter xunit --reporter-option output=test_results.xmlBy default Flutter will use the current reporter. If env CI=true, flutter will use spec automatically.
This is an idea we can take from the very well established and mature JS ecosystem.
