dart-generate-test-mocks 是做什么的?
使用 package:mockito 和 build_runner 定义并生成外部依赖的模拟对象。用于对依赖复杂外部服务(如 API 或数据库)的类进行单元测试。
使用 `package:mockito` 和 `build_runner` 定义并生成外部依赖的模拟对象。用于对依赖复杂外部服务(如 API 或数据库)的类进行单元测试。
该技能指导开发者使用 Dart 生态中的 `package:mockito` 和 `build_runner` 工具,自动生成针对外部依赖(如 API、数据库等)的模拟对象(Mock)。它主要应用于单元测试场景,当被测试的类依赖于复杂的外部服务时,通过模拟这些依赖来隔离测试逻辑,确保测试的独立性和可靠性。支持 Dart 和 Flutter 项目,工作流程包括:定义模拟注解、运行 `build_runner` 生成代码、在测试中注入并验证模拟行为。这一方法能显著减少手动编写模拟代码的工作量,提高测试维护效率。
npx skills add https://github.com/dart-lang/skills/tree/main/skills/dart-generate-test-mocksInstalled? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →
使用 package:mockito 和 build_runner 定义并生成外部依赖的模拟对象。用于对依赖复杂外部服务(如 API 或数据库)的类进行单元测试。
This repo contains 8 individual skills — each has its own dedicated page.
Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.
Entrypoint structure, exit codes, cross-platform scripts. Use when building command line utilities, scripts, or applications.
Collect coverage using the coverage packge and create an LCOV report
Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.
Replace the usage of `expect` and similar functions from `package:matcher` to `package:checks` equivalents.
Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.
Execute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatically resolve mechanical lint issues. Use during development to ensure code quality and before committing changes.
Use switch expressions and pattern matching where appropriate
Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.
Control Eight Sleep pods (status, temperature, alarms, schedules).
BluOS CLI (blu) for discovery, playback, grouping, and volume.
Create, search, and manage Bear notes via grizzly CLI.
Capture frames or clips from RTSP/ONVIF cameras.
Search GIF providers with CLI/TUI, download results, and extract stills/sheets.