Skip to content

Use fail instead of throw StateError for validating testUsingContext #163091

@matanlurey

Description

@matanlurey

fail, which throws a TestFailure, is understood and handled by the test framework.

For example, when using "run test" in VSCode, the test will run (successfully) and report a failure (successfully):

Image

With throw StateError, an unhandled exception is triggered, and the test does not run, and instead you get a stack dump:

Image

This is a minor but easy to fix QoL improvement when developing package:flutter_tools.

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: tech-debtTechnical debt, code quality, testing, etc.team-toolOwned by Flutter Tool team

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions