0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/mastracode/AGENTS.md
mastra-platform[bot] b87062b541
docs(factory): document focused test commands for mastracode/factory (#29866)
Closes #29813

## Summary
The `@mastra/factory` test suite is too large to run in the foreground
within the sandbox command limit, and neither `mastracode/AGENTS.md` nor
the package README said how to scope it. This adds focused-test guidance
to both:

- Run the colocated test files for your change in the foreground: `pnpm
--filter ./mastracode/factory exec vitest run <test-files>
--reporter=dot --bail 1`.
- Run broad suites (full `test`, whole `src/integrations`/`src/rules`
directories, `vitest related`, `vitest run --changed`) in the background
or leave them to CI.

The triage comment suggested an optional `test:changed` script, but this
PR doesn't add one. In testing, `vitest related
src/rules/dispatch-errors.ts` fanned out to 4,146 tests (~2.5 min), and
`--changed` reruns everything when `package.json` or config changes, so
the script would still time out in the foreground.

## Test plan
- [x] `pnpm --filter ./mastracode/factory exec vitest run
src/rules/dispatch-errors.test.ts --reporter=dot --bail 1` passes in
~0.1s (the documented command works)
- [x] Confirmed `vitest related` and `vitest run --changed` fan out to
most of the suite and exceed the foreground limit (why they are
documented as background-only)
- Docs and changeset only. No code changes, so typecheck and lint aren't
affected.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR explains how to check only the tests for the Factory code you
changed. It also explains that large test runs take longer, so they
should run in the background or be left to CI.

## Changes

- Added focused-test guidance to `mastracode/AGENTS.md` and the Factory
README.
- Documented the command for running colocated test files with Vitest.
- Added guidance to run broad test suites in the background or leave
them to CI.
- Added a patch changeset for `@mastra/factory`.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-10 04:50:02 +00:00

1.3 KiB

Packages: mastracode/sdk (@mastra/code-sdk), mastracode/tui (mastracode), mastracode/factory-ui (@internal/factory-ui), and standalone mastracode/web. Scope commands to the changed package.

TUI: build deps with pnpm build:mastracode; test SDK+TUI with pnpm test:mastracode; typecheck with pnpm --filter ./mastracode/tui check; lint with pnpm --filter ./mastracode/tui lint. Build first before broad tests.

Focused TUI test: pnpm --filter ./mastracode/tui exec vitest run <test-file> --reporter=dot --bail 1.

Factory: full suite is too slow for foreground runs; see "Development" in mastracode/factory/README.md for focused tests.

Factory UI is the independent React SPA and CLI UI artifact; see mastracode/factory-ui/AGENTS.md.

Tests are colocated in package src. TUI scenarios: mastracode/tui/e2e/tui/; fixtures: mastracode/tui/e2e/fixtures/. Use e2e:list, e2e:smoke, or e2e:test -- --reporter=dot; focus with MC_E2E_VITEST_SCENARIOS=<scenario> pnpm --filter ./mastracode/tui exec vitest run --config e2e/vitest.config.ts --reporter=dot.

Use testing-mastracode-tui for interactive guidance and mastracode/tui/e2e/README.md for runner commands. TUI-visible behavior needs checked-in TUI E2E coverage. Sanitize any read-only local Application Support data into deterministic AIMock fixtures.