Skip to content

docs: clarify async exception verification - #272

Open
a1573595 wants to merge 1 commit into
felangel:mainfrom
a1573595:cw/247
Open

docs: clarify async exception verification#272
a1573595 wants to merge 1 commit into
felangel:mainfrom
a1573595:cw/247

Conversation

@a1573595

Copy link
Copy Markdown

Status

READY

Breaking Changes

NO

Description

Addresses #247.

This documents the async timing behavior when throwsA is used with a Future or a closure returning a Future, and adds regression coverage for verifying mock interactions after the async exception expectation has been awaited.

expect(..., throwsA(...)) registers the async matcher but does not wait before the next statement runs. In the issue reproduction, the code under test yields after the first await, so immediate verify calls can run before later mocked calls have happened.

The documented pattern is to use await expectLater(...) before verifying interactions.

Added regression coverage showing that after await expectLater(...), all calls made before the thrown async exception remain verifiable.

Verification:

  • git diff --check
  • fvm dart analyze
  • fvm dart test
  • fvm dart test --coverage=coverage
  • fvm dart run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib
  • coverage remains 430/430 = 100.00%

Type of Change

  • ✨ New feature
  • 🛠️ Bug fix
  • ❌ Breaking change
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant