Skip to content

Adopt suffix-based Vitest test routing - #67

Merged
kentcdodds merged 2 commits into
mainfrom
cursor/vitest-test-file-patterns-665a
Mar 27, 2026
Merged

kentcdodds merged 2 commits into
mainfrom
cursor/vitest-test-file-patterns-665a

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Mar 27, 2026 •

Copy link
Copy Markdown
Member

Summary

  • replace hand-maintained Vitest include lists with suffix-based globs for node, workers, and MCP E2E projects
  • rename existing tests so each file opts into its Vitest project via filename convention, including new node-side tests added on main
  • update docs, tooling references, and the newly surfaced client test assertion to match the new convention

Testing

  • npm run test
  • npm run test:mcp
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Chores
    • Streamlined testing infrastructure by standardizing test file naming conventions and updating configuration patterns for consistency across the codebase.
    • Updated documentation to reflect new testing guidelines and file organization standards for developers.

@coderabbitai

coderabbitai Bot commented Mar 27, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR refactors Vitest test discovery from explicit file path listings to convention-based filename suffixes (.node.test.ts, .workers.test.ts, .mcp-e2e.test.ts), updates documentation to reflect the new naming patterns, and modifies related TypeScript and test tooling configuration accordingly.

Changes

Cohort / File(s) Summary
Documentation Updates
docs/agents/adding-capabilities.md, docs/agents/testing-principles.md, docs/agents/typescript-setup.md
Updated guidance to reflect new MCP E2E test filename pattern and documented how filename suffixes map to Vitest projects.
Vitest Configuration
vitest.node.config.ts, vitest.workers.config.ts, vitest.mcp-e2e.config.ts
Replaced explicit file path lists with glob patterns matching filename conventions (e.g., **/*.node.test.ts, **/*.workers.test.ts, **/*.mcp-e2e.test.ts).
TypeScript Tooling Configuration
tsconfig-tools.json
Updated include glob to reference new MCP E2E test file naming pattern.
Package Configuration
packages/home-connector/package.json
Updated Vitest target path in test script from packages/home-connector/src to packages/home-connector.
Test Logic Update
packages/worker/client/app-session-refresh.node.test.ts
Changed UI rendering from synchronous String(render()) to asynchronous renderToString(render()).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Hop-hop, a naming convention takes flight,
Suffixes guide tests through day and night,
From explicit paths to glob-based grace,
Discovery quickens across codespace!
Tests organized, configs made neat—
Convention-driven, what a sweet feat! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adopting suffix-based routing for Vitest test file discovery.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/vitest-test-file-patterns-665a

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kentcdodds

Copy link
Copy Markdown
Member Author

@cursor, please rebase on main and make necessary adjustments based on the changes in main.

@cursor

cursor Bot commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Rebased cursor/vitest-test-file-patterns-665a onto the latest origin/main, resolved the vitest.node.config.ts conflict in favor of the suffix-glob convention, and force-pushed the rebased branch.
  • Folded in the new Node-side tests that landed on main by renaming them into the convention as run-codemode-registry.node.test.ts and packages/worker/src/mcp/secrets/*.node.test.ts, so the rebased branch keeps that newer coverage. vitest.node.config.ts:29-33 run-codemode-registry.node.test.ts:1-93 capability-inputs.node.test.ts:1-78 errors.node.test.ts:1-37
  • Kept the supporting tooling/docs aligned with the rebased test naming, including the MCP tools tsconfig reference. tsconfig-tools.json:29-38

Testing

  • No manual UI testing was needed because this was a git rebase plus test-file convention maintenance; the relevant validation is the targeted Vitest coverage on the rebased branch.
  • ✅ npm run test — verified the rebased node-unit and workers-unit projects pass with the updated convention, now covering 46 files and 159 tests after absorbing the new tests from main. terminal:1-54
  • ✅ npm run test:mcp — verified the dedicated MCP E2E project still discovers and runs the .mcp-e2e.test.ts file on the rebased branch. terminal:1-21
Open in Web Open in Cursor 

cursoragent and others added 2 commits March 27, 2026 20:32
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@cursor
cursor Bot force-pushed the cursor/vitest-test-file-patterns-665a branch from e0e5cfe to 2060886 Compare March 27, 2026 20:34
@kentcdodds
kentcdodds marked this pull request as ready for review March 27, 2026 20:48
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-67.kentcdodds.workers.dev

Worker: kody-pr-67
D1: kody-pr-67-db
KV: kody-pr-67-oauth-kv

Mocks:

@kentcdodds
kentcdodds merged commit e7e3a75 into main Mar 27, 2026
15 of 16 checks passed
@kentcdodds
kentcdodds deleted the cursor/vitest-test-file-patterns-665a branch March 27, 2026 20:51
tk-shockwave pushed a commit to tk-shockwave/kody that referenced this pull request Oct 17, 2026
…y-hq#67)

When a one-shot fetch fails to bundle, agents using --json need a
structured object on stdout (human mode still prints once via stderr).

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
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.

2 participants