rstest
AGENTS.md514 starsChanged 8 days agoMITView on GitHub
Rstest is an Rsbuild-based testing framework for JavaScript/TypeScript projects. When working on code in a specific package, read that package's AGENTS.md file for package-specific guidelines: If a package does not have its own AGENTS.md, follow this root file and copy the closest local patterns. pnpm check-harness-docs validates the package index and the command, path, and dependency claims written inside AGENTS.md/SKILL.md files. Altitude rule: document only what the code cannot express — cross-boundary data flow, invariants, coupling points, pitfalls — phrased…
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- website/AGENTS.mdAGENTS.md
- api-doc-syncSkill
- create-draft-release-notesSkill
- create-release-blogSkill
- developmentSkill
- pr-creatorSkill
- rstack-docs-writerSkill
- testingSkill
- typescriptSkill
- verifySkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
16 rules. About 0 are common, 8 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
When working on code in a specific package, read that package's AGENTS.md file for package-specific guidelines:
- Distinctive: line 20
If a package does not have its own AGENTS.md, follow this root file and copy the closest local patterns.
- Very specific: line 46
Use pnpm (the version is pinned via the packageManager field in the root package.json).
- Distinctive: line 85
Before changing behavior, identify the affected package(s), public API/config impact, browser-mode impact, adapter impact, docs impact, and …
- Very specific: line 89
If a config option is shared with Rsbuild/Rslib/Rspack, check whether the adapters need to transform or pass it through consistently.
- Distinctive: line 92
Do not make repo-wide rewrites unless explicitly asked.
- Distinctive: line 93
Do not revert unrelated local changes.
- Very specific: line 98
Do not pass e2e/... paths to the root pnpm rstest command.
- Very specific: line 99
Run e2e tests from the e2e/ directory.
- Very specific: line 100
Do not overlap pnpm build and pnpm e2e.
- Distinctive: line 101
If e2e fails with missing built files, rebuild the affected package(s) before retrying.
- Very specific: line 105
Use ESM-first: .mjs for runtime loaders, .ts/.mts for typed utilities.
- Distinctive: line 106
Do not mix CommonJS and ESM in the same module unless the file is intentionally a compatibility fixture.
- Distinctive: line 107
Use 2-space indentation and LF line endings.
- Very specific: line 108
Use camelCase for locals, PascalCase for types/components, and SCREAMING_SNAKE_CASE for constants.
- Very specific: line 109
Avoid namespace imports like import * as foo from 'foo' unless the module shape requires it.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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.
Files
Rstest monorepo
Rstest is an Rsbuild-based testing framework for JavaScript/TypeScript projects.
Sub-package Instructions
When working on code in a specific package, read that package's AGENTS.md file for package-specific guidelines:
- For @rstest/core:
packages/core/AGENTS.md - For @rstest/browser:
packages/browser/AGENTS.md - For @rstest/browser-ui:
packages/browser-ui/AGENTS.md - For @rstest/browser-react:
packages/browser-react/AGENTS.md - For @rstest/playwright:
packages/playwright/AGENTS.md - For @rstest/coverage-istanbul:
packages/coverage-istanbul/AGENTS.md - For @rstest/adapter-rslib:
packages/adapter-rslib/AGENTS.md - For @rstest/adapter-rsbuild:
packages/adapter-rsbuild/AGENTS.md - For @rstest/adapter-rspack:
packages/adapter-rspack/AGENTS.md - For documentation site:
website/AGENTS.md
If a package does not have its own AGENTS.md, follow this root file and copy the closest local patterns.
pnpm check-harness-docs validates the package index and the command, path, and dependency claims written inside AGENTS.md/SKILL.md files.
Altitude rule: document only what the code cannot express — cross-boundary data flow, invariants, coupling points, pitfalls — phrased as constraints on future changes. No file inventories, no file:line references (the checker validates paths, not line numbers — line refs are undetectable drift); refer to symbols. A claim you cannot verify gets deleted, not hedged.
Monorepo structure
packages/core/— @rstest/core: core testing framework (CLI, runtime, reporter, pool)packages/browser/— @rstest/browser: browser mode support (Playwright, WebSocket RPC)packages/browser-ui/— @rstest/browser-ui: prebuilt browser container UI (React + Tailwind + Ant Design)packages/browser-react/— @rstest/browser-react: React component testing utilities for browser modepackages/playwright/— @rstest/playwright: Node-side Playwright browser automation fixturespackages/coverage-istanbul/— @rstest/coverage-istanbul: Istanbul coverage providerpackages/coverage-v8/— @rstest/coverage-v8: V8 coverage providerpackages/adapter-rslib/— @rstest/adapter-rslib: Rslib configuration adapterpackages/adapter-rsbuild/— @rstest/adapter-rsbuild: Rsbuild configuration adapterpackages/adapter-rspack/— @rstest/adapter-rspack: Rspack configuration adapterbenchmarks/— benchmark projects and runnerse2e/— end-to-end integration testsexamples/— example projects (node, react, browser)website/— documentation site (Rspress)scripts/— build scripts and shared configs
Package manager and workspace
- Use
pnpm(the version is pinned via thepackageManagerfield in the rootpackage.json). - The workspace includes
benchmarks,website,scripts/**,packages/**,examples/**, ande2e/**. - Dependency installs use pnpm's stricter settings (
minimumReleaseAge,strictDepBuilds, and explicit build-script approvals). Do not loosen these settings or add heavy dependencies without discussion.
Commands
# Root commands
pnpm install # Install all workspace dependencies
pnpm build # Build all packages under packages/*
pnpm test # Run unit tests via rstest
pnpm e2e # Run e2e tests
pnpm lint # Formatting + spell check + doc type sync + harness docs + lint/type check
pnpm lint:type # Run rs lint --type-check (needs built package .d.ts)
pnpm typecheck # Alias of lint:type
pnpm format # Format files, including heading case, via rs fmt
pnpm check-unused # Run knip
pnpm test:examples # Run example tests
pnpm bench:cpu # Run CPU benchmarks
pnpm bench:memory # Run memory benchmarks
# Package-specific examples
pnpm --filter @rstest/core build
pnpm --filter @rstest/core dev
pnpm --filter @rstest/core test
pnpm --filter @rstest/core test -- tests/core/rsbuild.test.ts
# File-scoped / faster feedback (from the repository root)
pnpm exec rs lint packages/core
pnpm rstest packages/core/tests/core/rsbuild.test.ts
pnpm exec rs fmt path/to/file.tsNote: E2E tests and examples consume built package output. Rebuild affected packages before running them (for example, pnpm --filter @rstest/browser build). For testing workflows, use the testing skill.
Note: Run lint and type checks from the repository root so paths in rstack.config.mts resolve consistently. pnpm exec rs lint lints the repository; file arguments narrow lint diagnostics. pnpm typecheck also checks types across the configured projects and cannot be narrowed to a package.
Development workflow
- Before changing behavior, identify the affected package(s), public API/config impact, browser-mode impact, adapter impact, docs impact, and test scope.
- The editor integration is maintained in a separate repository, rstackjs/rstack-editor, which drives
@rstest/core/api(createRstest,listTests,run,ListedTest, reporter events) from its own worker and maps Test Explorer actions to CLI flags. Onmainpushes that can change the built packages,.github/workflows/ecosystem-ci.ymldispatches rstackjs/rstack-ecosystem-ci, which builds@rstest/corefrom that commit and runs rstack-editor'stest:unitandlint(rs lint --type-check) against it. It does not run rstack-editor's VS Code E2E; that runs in rstack-editor on the Renovate PR for each@rstest/corerelease. Both report a break only after the change has landed, so when a change touches that API surface, the CLI flags, or reporter output, open the matching change (or at least an issue) in rstack-editor in the same PR cycle and link both. - Public API or config changes usually require docs updates.
- Behavioral changes require corresponding e2e coverage unless there is a clear reason existing coverage is sufficient.
- If a config option is shared with Rsbuild/Rslib/Rspack, check whether the adapters need to transform or pass it through consistently.
- Keep release-train versions separate from
@rstest/corecompatibility: packages compatible across releases must declare an explicit peer range starting at the oldest supported core version. Use a ranged workspace marker such asworkspace:^only temporarily when a package starts consuming an unreleased core capability. Packages that require an identical core version must useworkspace:*so the published peer is exact. - In every
release:PR, replace temporary ranged workspace peer markers with the actual release range, confirm every@rstest/corepeer accepts the new core version, and review ranges at each potentially breaking core boundary (each minor while core is0.x, then each major from1.xonward). Do not raise a package's lower bound when its core compatibility did not change, and do not widen an exact lockstep peer. - Do not make repo-wide rewrites unless explicitly asked.
- Do not revert unrelated local changes.
Testing guidance
- For root-discovered unit tests, prefer
pnpm rstest <package-test-path>. - Do not pass
e2e/...paths to the rootpnpm rstestcommand. - Run e2e tests from the
e2e/directory; when passing a path, strip thee2e/prefix. - Do not overlap
pnpm buildandpnpm e2e; wait for builds to finish before e2e. - If e2e fails with missing built files, rebuild the affected package(s) before retrying.
Code style
- Use ESM-first:
.mjsfor runtime loaders,.ts/.mtsfor typed utilities. - Do not mix CommonJS and ESM in the same module unless the file is intentionally a compatibility fixture.
- Use 2-space indentation and LF line endings.
- Use camelCase for locals, PascalCase for types/components, and SCREAMING_SNAKE_CASE for constants.
- Avoid namespace imports like
import * as foo from 'foo'unless the module shape requires it. - In-file TypeScript quality rules (restating comments, defensive checks,
as/any, one-use abstractions, drift prevention) are owned by thetypescriptskill — apply it when writing.ts/.tsx/.mtsfiles.
Skills
Available workflow skills in .agents/skills/:
| Skill | Description |
| development | Feature / bug-fix checklist for scope review and workflow routing |
| testing | Testing workflow for the rstest monorepo (run tests, write tests, debug failures) |
| typescript | TypeScript anti-slop guardrails for .ts, .tsx, and .mts files |
| verify | Behavioral verification rules before claiming a change works (no proxy signals) |
| pr-creator | Create a PR for the current branch |
| rstack-docs-writer | Write or revise Markdown and MDX documentation, including READMEs and guides |
| create-draft-release-notes | Create or update draft GitHub releases and organize generated release notes |
| create-release-blog | Draft bilingual release blog posts from a version range |
| api-doc-sync | Verify/fix that hand-written API doc signatures stay faithful to exported types |
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
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.

