Skip to content

the description of the throwsToolExit matcher is vague #136698

@andrewkolos

Description

@andrewkolos

See title. If you run a test that has a failing throwsToolExit matcher, you may see output similar to this:

Expected: throws (<Instance of 'ToolExit'> and satisfies function)
  Actual: <Instance of 'Future<void>'>
   Which: threw ToolExit:<Exception: Error parsing assemble command: your generated configuration may be out of date. Try re-running 'flutter build ios' or the appropriate build command.>
          stack package:flutter_tools/src/base/common.dart 10:3                     throwToolExit
                package:flutter_tools/src/commands/assemble.dart 294:7              AssembleCommand.runCommand
...

While there is no useful information about the mismatch, this is generally still sufficient--there are only two fields throwsToolExit can match on.

However, where this can be confusing when writing tests that involve multiple throwsToolExit matchers, because it isn't necessarily easy to figure out in which the mismatch occurred, especially if the stack traces are long enough to get truncated. This is a situation that should ideally be rare, but I've encountered a couple of times now.

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 teamtriaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions