agentleFS
Zulut30Zulut30/dart-mobile-game-studio/.cursor/rules/dart-flutter-testing.mdc

dart-mobile-game-studio / rules

Cursor rule1 starsChanged 5 months agoMITView on GitHub

Testing & build rules for Dart/Flutter games — unit-test the pure model with dart test, widget/golden/Patrol tests, honest analyze/build reporting.

The file

We split this dart-flutter-testing.mdc into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Only report analyze/build/tests as passing if you ran them and saw the output.

    line 36

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
dart-flutter-testing.mdc
---
description: Testing & build rules for Dart/Flutter games — unit-test the pure model with dart test, widget/golden/Patrol tests, honest analyze/build reporting.
globs: **/*_test.dart, **/test/**/*.dart, **/integration_test/**/*.dart
alwaysApply: false
---

# Dart/Flutter game testing & build rules

Applies to test files and any build/test work.

## What to test (priority order)
1. **Pure model rules** with `dart test` on the VM (fast, no device): legal/illegal moves, scoring,
   win/lose, level load + validation, every state transition, deterministic (seeded) shuffles/spawns.
2. **Widgets** with `flutter_test`: `testWidgets`, `WidgetTester`, `pump`/`pumpAndSettle`,
   `find`/`expect`. **Golden** tests for stable visuals (avoid text in goldens).
3. **Flame** components (when worth it) with `flame_test` (`testWithGame`, `await game.ready()`,
   `game.update(dt)`).
4. **E2E** with **Patrol** (`leancodepl/patrol`): onboarding, purchase/ads flow, game start, level
   completion, pause/resume, settings, permissions, native dialogs, app lifecycle.

## Determinism & seams
- Inject a seeded `Random` (`assets/seeded_random.dart`) so randomized outcomes are reproducible.
- Inject the clock/persistence as seams so tests use fakes; keep the model `package:flutter`-free.

## Commands
```bash
dart format --output=none --set-exit-if-changed .
dart analyze            # or: flutter analyze
dart test               # pure core (VM)
flutter test            # widgets + goldens
patrol test             # E2E (device/emulator)
```
Discover via `scripts/verify-flutter-project.sh`.

## Honesty rule
Only report analyze/build/tests as passing if you ran them and saw the output. If there's no
toolchain here, say so and provide the exact commands — never assert green.

## Before "done"
- New model rule / state transition has a `dart test`; non-trivial widget has a `flutter_test`;
  critical flow has a Patrol E2E. No debug `print`, placeholder, or TODO in the shipped path.

Reference: `references/testing-and-release.md`, `references/quality-policy.md`.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.