Files
cypress/npm/react/AGENTS.md
T
Ryan Manuel 4931cf06ff chore: bootstrap AI agent context files (AGENTS.md + CLAUDE.md) (#33429)
* chore: bootstrap AI agent context files (AGENTS.md + CLAUDE.md)

Adds a three-tier set of AI context files across the monorepo:

- Root AGENTS.md / CLAUDE.md — project overview, workspaces, common
  commands, architecture map, code conventions, and CI/CD summary
- Workspace-level pairs for cli/, packages/, npm/, tooling/,
  system-tests/, and scripts/
- Package-level pairs for all 33 packages/, 15 npm/, 3 tooling/
  packages, and the cli workspace (117 files total)

CLAUDE.md files are thin wrappers (@AGENTS.md import + workflow rules)
so Claude Code picks them up walking upward from cwd. AGENTS.md files
carry the substantive content and are also read natively by Codex CLI
and Cursor.

Command conventions applied throughout:
- No watch / file-watcher commands (agents run once and read results)
- No bare full-suite test runs for large packages; always target a
  specific file (<path-to-spec>) or glob ("<glob-pattern>")
- No cypress:open (interactive mode); use cypress:run with --spec
- Test runner syntax varies by package: vitest (test --),
  mocha (test-unit/test-integration --), jest (--testPathPattern),
  Cypress CT (cypress:run:ct -- --spec)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* gitignore

* clarify AI internal docs and contribution guidelines

* update TOC

* tweak nvm wording

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 16:01:52 -05:00

1.4 KiB

@cypress/react

@cypress/react is a published npm package that provides the mount function for mounting React components (React 18+) inside the Cypress test runner for component testing. It is bundled with the cypress binary and does not typically need to be installed separately by end users.

Key Commands

yarn build        # rimraf dist + rollup (outputs to dist/); also syncs to cli/react
yarn check-ts     # TypeScript type-check without emitting
yarn lint         # ESLint
yarn cy:run -- --spec <path-to-spec>   # run a specific component test spec

Architecture

  • src/index.ts — public entry point
  • src/mount.ts — core React mounting logic (renders into the Cypress AUT iframe using react-dom)
  • src/createMount.ts — factory used to create the mount function with custom options
  • src/getDisplayName.ts — utility to extract display names for logging

Gotchas / Notes

  • The postbuild step syncs dist/ to cli/react/ in the monorepo root — build before testing against the Cypress binary.
  • Ships multiple bundle formats: CJS (dist/cypress-react.cjs.js), ESM bundler (dist/cypress-react.esm-bundler.js), and browser UMD (dist/cypress-react.browser.js).
  • Supports React 18 and 19 via peer dependency ranges.

Integration Points

  • Depends on @cypress/mount-utils (sibling package) for shared adapter utilities.
  • The cli/react copy is what the bundled cypress package ships to end users.