Skip to content

docs(agents): tell agents to run tests through bun run test - #219

Closed
TornquistK wants to merge 1 commit into
mainfrom
workset/agents-md-test-command
Closed

TornquistK wants to merge 1 commit into
mainfrom
workset/agents-md-test-command

Conversation

@TornquistK

Copy link
Copy Markdown
Collaborator

Summary

Agents run plain bun test first, hit the isolated-HOME refusal, and retry with bun run test. A checked-in instruction tells them the command up front.

+AGENTS.md   # run tests with `bun run test`; one file: in its package, `bun run test -- <path>`
+CLAUDE.md   # @AGENTS.md, so Claude Code reads the same line

Why not make bun test forward to test/run-isolated.ts instead (probed with Bun 1.4.4):

Route Result
Preload re-runs run-isolated.ts with the original arguments preload's process.argv is [bun, <first test file>]: -t, other files and flags are lost
Same, with --parallel the preload runs only in the workers, so each worker would start its own run
Preload sets HOME in-process os.homedir() and Bun.spawn children keep the real HOME

Evidence

  • Before: in packages/mate-core, bun test src/lib/update-checker.test.ts → error: tests must run with an isolated HOME: use \bun run test` …`
  • After (the documented command): bun run test -- src/lib/update-checker.test.ts → 42 tests, 0 fail.
  • From the repository root, bun run test -- <path> passes the path to every package (scripts/test/run-packages.ts), so the line says to run one file in its package.
  • Not exercised: whether each agent runtime loads AGENTS.md or CLAUDE.md in this repository.

Merge Danger

Door: two-way

Two new instruction files; no code, test or script change. A revert deletes them.

Blast Radius: narrow

Every agent session in a mate-cli checkout loads the line. A contributor with an untracked local AGENTS.md or CLAUDE.md gets a "would be overwritten" error on pull until they move it.

Plain bun test fails in the isolated-HOME preload. A preload cannot forward the run: it sees only the first test file, and with --parallel it runs in each worker. Agents now read the command before their first test run.
@TornquistK TornquistK closed this Dec 1, 2026
@TornquistK
TornquistK deleted the workset/agents-md-test-command branch December 1, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant