dart-migrate-to-checks-package

Migrate Dart test assertions from package:matcher to package:checks syntax.

1|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-migrate-to-checks-package-sohampawar1866
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dart-migrate-to-checks-package
Source: https://github.com/sohampawar1866/zeromile-go/tree/main/.agents/skills/dart-migrate-to-checks-package
Command: npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-migrate-to-checks-package-sohampawar1866

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Migrating Dart test suites from the legacy package:matcher assertions (exported by package:test) to the modern package:checks library is error-prone: subtle differences like deep collection equality, async throws behavior, and strict null safety can silently break tests or cause compiler errors. This Skill provides a structured workflow, a matcher mapping table, and pitfall guidance to perform the migration safely. ## Core Features & Use Cases - Step-by-step migration workflow: Update pubspec.yaml dependencies, swap imports (package:test/scaffolding.dart + package:checks/checks.dart), translate assertions, and verify with dart analyze and dart test. - Matcher-to-Checks mapping table: Direct replacements for expect, isA, hasLength, completion, throwsA, emits, and more, plus workarounds for matchers with no equivalent (e.g., isPositive, inClosedOpenRange). - Pitfall documentation: Covers ten critical differences including .deepEquals for collections, because replacing reason, RegExp handling in .matchesPattern, and sync vs. async .throws<E>() chaining. - Use Case: You inherit a legacy Dart package with hundreds of expect(actual, expected) calls. Use this Skill to incrementally convert each test file, using the compiler to surface remaining unmigrated assertions. ## Quick Start Migrate the tests in my Dart project's test directory from package:matcher expect calls to package:checks syntax.

Frequently Asked Questions about dart-migrate-to-checks-package

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate Dart tests from package:matcher to package:checks?

Add package:checks as a dev dependency, replace the package:test/test.dart import with package:test/scaffolding.dart and package:checks/checks.dart, then rewrite expect calls using check() syntax. Run dart analyze and dart test to verify the migration.

What is the package:checks equivalent of expect(actual, expected)?

Use check(actual).equals(expected) for values with proper == implementations. For collections like Lists, Maps, and Sets, you must use check(actual).deepEquals(expected) because Dart collections do not override operator == for element-wise comparison.

Can I migrate Dart tests to package:checks incrementally?

Yes, keep the import package:test/expect.dart alongside the checks imports so legacy expect calls still compile in partially migrated files. Remove that import when done, and remaining unmigrated expect calls will surface as compiler errors.

Why does check(myList).equals([1, 2, 3]) fail at runtime?

The .equals expectation uses strict Dart == equality, and Dart collections compare by identity rather than elements. Replace it with .deepEquals([1, 2, 3]) to perform the element-wise comparison that package:matcher did automatically.

How do I replace throwsA and completion matchers in package:checks?

Use await check(future).throws<ErrorType>() for exceptions and await check(future).completes() for successful futures. Async throws returns Future<void>, so pass an inspection callback instead of chaining expectations after it.

Which package:matcher matchers have no direct package:checks replacement?

Specific error matchers like throwsArgumentError become .throws<ArgumentError>(), numeric toggles like isPositive become isGreaterThan(0), and ranges like inClosedOpenRange become chained boundary checks using cascade operators.