PackageTrack
Sign in Get early access

approval_tests_flutter

Approval Tests implementation in Dart (Flutter). Inspired by ApprovalTests.

1.5.1 265 downloads/mo #1113 most downloaded on pub.dev approvals/ApprovalTests.Dart.Flutter

What this package is like to depend on

Last release 17 days ago

07 Aug 2026

Release timing varies

gaps range from 2 weeks to 8 months

Most releases are documented

notes for 12 of 14 stable releases

Nothing withdrawn

no release was ever pulled

2 years old

14 releases · first in 2024

8 releases in the last 12 months

see the full history below

Release timeline

14 releases · Jul 2024 to Aug 2026
2025 2026
Release Pre-release

Releases

latest 14
  1. 1.5.1 07 Aug 2026
    Release notes

    approval_tests_flutter 1.5.1

    Open source →
    Release notes

    Documentation

    • Reworked the package guide with a first Flutter approval test, guidance for choosing approval snapshots versus focused assertions, and a CI policy for reviewing and committing baselines safely.
    • Expanded the executable example with a feature-first orders slice covering dependency-injected state management, typed failures, loading/loaded/error approvals, focused retry and empty-state assertions, and repository lifecycle changes.
    Open source →
  2. 1.5.0 26 Jul 2026
    Release notes

    Fixed

    • Widget-name cache writes are now atomic. flutter test runs test files in parallel processes that share one cache file, so the previous single write was observable by another process as a truncated file — a short read drops names, which silently drops lines from a snapshot.
    • Widget-name discovery no longer throws ArgumentError on Windows. AnalysisContextCollection rejects a path that is not absolute and normalized; the lib and Dart SDK paths were built by string concatenation.
    • Cache freshness is validated by fingerprint instead of newest modification time. The old check missed a deleted non-newest file, a checkout with backdated timestamps, and a timestamp-preserving rename, and it treated a write racing an edit as fresh. Any cache problem is now a rescan, never an error.
    • The cache is byte-stable: discovered sources and class names are sorted.
    • The analysis context is disposed, so its driver no longer outlives setUpAll.
    • Blocking listSync / createSync / writeAsStringSync calls inside the async setup path are now awaited.
    • printExpects(widgetTypes: ...) no longer ignores its argument after the first call. A one-shot latch meant only the first set was ever registered.
    • The intl reverse lookup reloads when pathToStrings changes. Its "already loaded" flag was checked but never set, so the file was re-read on every call, and a different path could never win.

    Changed

    • Capture state — registered types and names, previous-capture memory, the localization lookup, and the intl string holder — moved out of library globals into an explicit session.
    • Added ApprovalWidgets.tearDownAll(), which discards that session. It is optional: omitting it reproduces the previous behaviour exactly. Add it when one test file has groups with different registrations, since a registerTypes call otherwise stays in effect for every later group in the file and changes their snapshots.
    • registerTypes keeps its signature but now writes into the current session.
    • printExpects(widgetNames: ...) adds to the session's registered names instead of replacing them, so a narrower set no longer hides names discovered by setUpAll. This affects console output only, never an approved file.
    • Added path as a direct dependency; it was already resolved transitively.

    Removed

    • loadWidgetNames() and the StringApprovedExtension.endWithNewline helper in src/common.dart, both unused after the discovery rewrite. Neither was exported from the package's public API.

    Snapshot output is unchanged. No *.approved.txt needs re-approving.

    Internal

    • Expanded deterministic coverage for widget metadata and expect generation, finder and pump policies, semantics and golden approvals, widget-name cache failures, and bounded Windows rename retries.
    • Reached 100% executable line coverage (594/594 lines); all 100 test executions pass.
    Open source →
  3. 1.4.1 15 Jul 2026
    Release notes
    • Added WidgetActionPumpPolicy so tapWidget() callers can explicitly choose no pump, one pump, a fixed-duration pump, or bounded settling.
    • Deprecated tapWidget(shouldPumpAndSettle: ...). Existing calls still settle by default throughout 1.x; migrate to the explicit pumpPolicy parameter.
    • Approval capture helpers remain caller-controlled and never pump or settle implicitly.
    Open source →
  4. 1.4.0 22 Jun 2026
    Release notes
    • Fix (behavior change): approvalTest() now writes a full, self-contained snapshot of the widget tree on every call. Previously a second call in the same test emitted only the delta from the prior call, producing snapshots that could not be reviewed in isolation. Existing approved files that relied on the old delta output must be re-approved.
    • Snapshot lines are now sorted deterministically, so approvals no longer flake on widget tree-traversal order.
    • Added tester.approvalSemantics() — approval testing of the rendered accessibility (semantics) tree (labels, values, hints, tooltips, identifiers, actions); geometry is omitted so output is stable across platforms.
    • Added tester.approvalGolden(finder) — golden/pixel approvals named to sit alongside the text approvals; run flutter test --update-goldens to (re)create the image.
    • Exported the expectWidget / tapWidget / findBy finder helpers and registerTypes, and exposed widgetTypes / widgetNames on tester.printExpects().
    • Removed the cold-start flutter --version subprocess; the Dart SDK is now resolved from FLUTTER_ROOT, making widget-name extraction faster and not dependent on flutter being on PATH.
    • Removed the unused match dependency.
    • Internal cleanup: replaced the Completer/.then wrappers with async/await (failures now propagate instead of hanging to timeout), guarded the analyzer parse-result cast, fixed the stale Approved.initialize() setup hint, and stopped tracking the generated .approval_tests/ cache.
    Open source →
  5. 1.3.2 22 Jun 2026
    Release notes
    • Raised the analyzer constraint to >=12.0.0 <14.0.0 to resolve a version conflict with flutter_test on current Flutter/Dart SDKs, whose pinned test/test_api require analyzer 12+.
    • Migrated widget-name extraction to the analyzer 12 AST API (ClassDeclaration.namePart.typeName), replacing the removed name token getter.
    • Note: this drops support for analyzer 8–11 (older Flutter SDKs).
    Open source →
  6. 1.3.1 11 Oct 2025
    Release notes
    • Fixed loadWidgetNames to return an empty string when the widget cache file is missing, avoiding LateInitializationError.
    • Restored intl reverse-lookup loading by re-enabling JSON parsing in loadEnStringReverseLookup.
    • Updated WidgetMeta.hashCode to match its equality semantics, ensuring set/map deduplication works as intended.
    • Added regression tests covering widget name loading, intl reverse lookup, and WidgetMeta equality.
    • Declared an upper bound on the supported Dart SDK (<4.0.0) to satisfy pub publishing requirements.
    • Added explicit platform support metadata (Android, iOS, Linux, macOS, Windows) so pub scoring can detect supported platforms.
    • Replaced the bundled license text with the standard Apache 2.0 wording recognized by pub.dev.
    • Added a minimal example/main.dart showcasing a widget approval test.
    • Updated dependency constraints (for example approval_tests now targets 1.3.3) to stay aligned with upstream packages.
    • ContextLocator replaced by AnalysisContextCollection
    Open source →
  7. 1.3.0 11 Oct 2025

    Nothing published for this version

  8. 1.2.0 10 Oct 2025

    Nothing published for this version

  9. 1.1.6 18 Feb 2025
    Release notes
    • Upgraded all dependencies to actuals.
    Open source →
  10. 1.1.3 03 Jul 2024
    Release notes
    • Updated README.md file: fix links.
    Open source →
  11. 1.1.2 02 Jul 2024
    Release notes
    • Added CLI additional options:
      Usage: dart run approval_tests:review [arguments]
      • Arguments:
        • --help Print this usage information.
        • --list Print a list of project .received.txt files.
        • <index> Review an .received.txt file indexed by --list.
        • <path/to/.received.txt> Review an .received.txt file.
    Open source →
  12. 1.1.1 02 Jul 2024
    Release notes
    • Updated README.md file.
    Open source →
  13. 1.1.0 02 Jul 2024
    Release notes
    • Breaking release:
      • Added new reporter: GitReporter. It allows you to use git to view the differences between the received and approved files.
      • Added support to approve files using CLI. Now you can approve files using the command line: dart run approval_tests:review
      • Added support to use ApprovalTests during widget tests.
      • Added header to generated files. For resolved issues you can add this to approved files:
        '# This file was generated by approval_tests. Please do not edit.\n'
      • Some minor changes and code improvements. Thanks to Richard Coutts
    Open source →
  14. 1.0.0 02 Jul 2024
    Release notes
    • Initial major release.
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive