Repository navigation
Fix CI node-unit Cloudflare module resolution - #45
Conversation
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/worker/src/test-support/cloudflare-workers-stub.ts (1)
11-11: EmptyRpcTargetstub is sufficient for current usage.The empty class correctly resolves module imports. RpcTarget is not currently imported or used anywhere in the codebase, so no methods or properties are needed. This follows the established pattern for type stubs that satisfy module resolution without requiring implementation.
Optionally, consider adding a JSDoc comment for maintainability:
Suggested documentation
+/** + * Test stub for Cloudflare Workers RpcTarget. + * Empty implementation is sufficient as RpcTarget is not instantiated in tests. + */ export class RpcTarget {}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/worker/src/test-support/cloudflare-workers-stub.ts` at line 11, The RpcTarget export is intentionally an empty stub to satisfy module resolution; leave the class definition export class RpcTarget {} as-is but add a short JSDoc above the RpcTarget declaration explaining it is a type/module resolution stub for test-support Cloudflare worker emulation and not intended for runtime use; ensure the JSDoc references RpcTarget so future readers understand why there are no methods or properties.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/worker/src/test-support/cloudflare-workers-stub.ts`:
- Line 11: The RpcTarget export is intentionally an empty stub to satisfy module
resolution; leave the class definition export class RpcTarget {} as-is but add a
short JSDoc above the RpcTarget declaration explaining it is a type/module
resolution stub for test-support Cloudflare worker emulation and not intended
for runtime use; ensure the JSDoc references RpcTarget so future readers
understand why there are no methods or properties.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8ae03d63-1c58-4662-adb7-144914a57934
📒 Files selected for processing (9)
packages/worker/src/mcp/mcp-registration-agent.tspackages/worker/src/mcp/register-resources.tspackages/worker/src/mcp/register-tools.tspackages/worker/src/mcp/resources/generated-ui-app-resource.tspackages/worker/src/mcp/tools/execute.tspackages/worker/src/mcp/tools/open-generated-ui.tspackages/worker/src/mcp/tools/search.tspackages/worker/src/test-support/cloudflare-workers-stub.tsvitest.node.config.ts
Summary
@cloudflare/codemodethrough Vitest SSR bundling in node-unit socloudflare:workersresolves through the test aliasRpcTargetfor codemode's node-test load pathRoot cause
@cloudflare/codemodeimportsRpcTargetfromcloudflare:workersin its package entry. In node-unit, Vitest was externalizing that dependency, so raw Node tried to resolve thecloudflare:scheme and aborted before tests executed.Testing
bun run vitest run --project node-unit packages/worker/src/mcp/tools/search.test.tsbun run vitest run --project node-unit packages/worker/src/mcp/skills/skill-embed-and-flags.test.tsbun run vitest run --project node-unit packages/worker/src/mcp/capabilities/coding/coding-capabilities.test.tsbun run testbun run typecheckSummary by CodeRabbit
Refactor
Chores