refactor: Migrate Vitest global setup from single merged file to individual files per generator#713
Conversation
…vidual files per generator
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: c9eeaa6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughMigrates Vitest global setup from a single merged file to per-generator global setup files. Replaces Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts (1)
1-5: Add JSDoc documentation for the exported setup function.The coding guidelines require JSDoc comments for all exported functions in the
examples/todo-with-auth0directory, including documentation of the function's purpose, parameters, return value, and behavior.📝 Suggested JSDoc
+/** + * Vitest global setup for Redis. + * Sets the Redis key prefix to "test:" for test isolation. + * + * @returns {void} + */ export default function setup(): void { // Set Redis key prefix for test isolation process.env.REDIS_KEY_PREFIX = 'test:'; console.info('Redis key prefix set to "test:" for isolation'); }Based on coding guidelines.
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts (1)
5-7: Add JSDoc documentation for the exported setup function.The coding guidelines require JSDoc comments for all exported functions in the
examples/blog-with-authdirectory, including documentation of the function's purpose, parameters, and return value.📝 Suggested JSDoc
+/** + * Vitest global setup for environment variables. + * Note: The .env file is loaded at module evaluation time (line 3). + * + * @returns {Promise<void>} A promise that resolves when setup is complete. + */ export default async function setup(): Promise<void> { // Environment loaded }Based on coding guidelines.
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts (1)
5-7: Add JSDoc documentation for the exported setup function.The coding guidelines require JSDoc comments for all exported functions in the
examples/todo-with-auth0directory, including documentation of the function's purpose, parameters, and return value.📝 Suggested JSDoc
+/** + * Vitest global setup for environment variables. + * Note: The .env file is loaded at module evaluation time (line 3). + * + * @returns {Promise<void>} A promise that resolves when setup is complete. + */ export default async function setup(): Promise<void> { // Environment loaded }Based on coding guidelines.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (16)
examples/blog-with-auth/apps/backend/baseplate/generated/src/tests/scripts/global-setup-env.tsis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/apps/backend/baseplate/generated/src/tests/scripts/global-setup-prisma.tsis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/apps/backend/baseplate/generated/vitest.config.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/apps/backend/baseplate/generated/src/tests/scripts/global-setup-env.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/apps/backend/baseplate/generated/src/tests/scripts/global-setup-prisma.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/apps/backend/baseplate/generated/src/tests/scripts/global-setup-redis.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/apps/backend/baseplate/generated/vitest.config.tsis excluded by!**/generated/**,!**/generated/**packages/core-generators/src/generators/node/vitest/generated/template-paths.tsis excluded by!**/generated/**,!**/generated/**packages/core-generators/src/generators/node/vitest/generated/template-renderers.tsis excluded by!**/generated/**,!**/generated/**packages/core-generators/src/generators/node/vitest/generated/typed-templates.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/core/fastify-redis/generated/template-paths.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/core/fastify-redis/generated/template-renderers.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/core/fastify-redis/generated/typed-templates.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/vitest/prisma-vitest/generated/template-paths.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/vitest/prisma-vitest/generated/template-renderers.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/vitest/prisma-vitest/generated/typed-templates.tsis excluded by!**/generated/**,!**/generated/**
📒 Files selected for processing (24)
.changeset/migrate-vitest-global-setup-to-individual-files.mdexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-prisma.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/extractor.jsonpackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tspackages/fastify-generators/src/generators/core/fastify-redis/extractor.jsonpackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tspackages/project-builder-server/src/actions/sync/sync-all-projects.action.tspackages/project-builder-server/src/actions/sync/sync-project.action.tspackages/project-builder-server/src/sync/sync-project.ts
💤 Files with no reviewable changes (2)
- examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-prisma.ts
- examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-prisma.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx}: Use TypeScript with strict type checking enabled
Always include return types on top-level functions including React components (React.ReactElement)
Include absolute paths in import statements via tsconfig paths (@src/is the alias forsrc/)
If a particular interface or type is not exported, change the file so it is exported
If caught on a typing loop where forcing theanytype is necessary, do not iterate too much - leave the typing as broken and let the user fix itIf target code is not easily testable, refactor it to be more testable (e.g., export types or functions)
**/*.{ts,tsx}: Import components from '@baseplate-dev/ui-components' package for UI development (e.g., Button, Input, Card, Dialog, etc.)
Use form components with React Hook Form controller variants (InputField, TextareaField, SelectField, CheckboxField, SwitchField, ComboboxField, MultiComboboxField, ColorPickerField, DatePickerField, DateTimePickerField)
Use SidebarLayout, Card, Breadcrumb, NavigationMenu, and NavigationTabs components for consistent layout structure from @baseplate-dev/ui-components
Use Dialog, ConfirmDialog, and useConfirmDialog from @baseplate-dev/ui-components for modal dialogs and confirmation interactions
Always usecompareStringsfrom@baseplate-dev/utilsinstead ofString.prototype.localeCompare()for code generation, file sorting, and internal data structures
If a particular interface or type is not exported, modify the file to export it
Use TsCodeFragment for composable code pieces and TsCodeUtils for manipulating fragments when generating TypeScript code
Create generators usingcreateGeneratorwith configuration via descriptor schema (Zod), organizing into one or more tasks created withcreateGeneratorTask
Tasks should haverun(initialization) andbuild(code generation) phases, export and consume providers, and may be organized into phases for ordered execution
Use provider scopes to control visibility and prevent collisions be...
Files:
packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tspackages/project-builder-server/src/sync/sync-project.tsexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tspackages/project-builder-server/src/actions/sync/sync-project.action.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/project-builder-server/src/actions/sync/sync-all-projects.action.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx,js}: Node 16 module resolution - include file extensions in imports (.js)
Sort imports by group: external libs first, then local imports
Use camelCase for variables/functions, PascalCase for types/classes
Order functions such that functions are placed below the variables/functions they use
Prefer using nullish coalescing operator (??) instead of logical or (||), enforced via ESLint rule
Prefer barrel exports e.g.export * from './foo.js'instead of individual named exports
Use console.info/warn/error instead of console.log
Files:
packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tspackages/project-builder-server/src/sync/sync-project.tsexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tspackages/project-builder-server/src/actions/sync/sync-project.action.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/project-builder-server/src/actions/sync/sync-all-projects.action.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
examples/todo-with-auth0/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)
Always use .js extensions in import statements, even for TypeScript files. Example:
import { getSystemInfo } from '@src/system-info.js';
Files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
examples/todo-with-auth0/**/*.{ts,tsx}
📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)
examples/todo-with-auth0/**/*.{ts,tsx}: Useimport typefor type-only imports
Always specify explicit return types for functions
Add JSDocs to all exported functions, interfaces, and classes with documentation of the function, its parameters, return value, and all fields
Files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
examples/blog-with-auth/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (examples/blog-with-auth/CLAUDE.md)
examples/blog-with-auth/**/*.{ts,tsx,js,jsx}: Always use .js extensions in import statements, even for TypeScript files (e.g.,import { getSystemInfo } from '@src/system-info.js';)
Follow ESM module resolution with TypeScript'sNodeNextsetting
Add JSDocs to all exported functions, interfaces, and classes with documentation of the function, its parameters, return value, and all fields
Files:
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/vitest.config.ts
examples/blog-with-auth/**/*.{ts,tsx}
📄 CodeRabbit inference engine (examples/blog-with-auth/CLAUDE.md)
examples/blog-with-auth/**/*.{ts,tsx}: Useimport typefor type-only imports in TypeScript
Always specify explicit return types for functions in TypeScript
Files:
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/vitest.config.ts
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
Add a new Changeset in the
.changeset/directory for new features or changes, with format'package-name': patchand description of the feature or change
Files:
.changeset/migrate-vitest-global-setup-to-individual-files.md
🧠 Learnings (47)
📓 Common learnings
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Import test functions explicitly from 'vitest' instead of using globals. Example: `import { describe, expect, it } from 'vitest';`
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{unit.test.ts,int.test.ts} : Always import vitest globals explicitly (describe, it, expect)
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.test.ts : Import test functions explicitly from 'vitest' instead of relying on globals (e.g., `import { describe, expect, it } from 'vitest';`)
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Import test functions explicitly from 'vitest' instead of using globals. Example: `import { describe, expect, it } from 'vitest';`
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/core-generators/src/generators/node/vitest/extractor.json.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.test-helper.{ts,tsx} : Extract common setup code into test helpers in `*.test-helper.ts` files
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/core-generators/src/generators/node/vitest/extractor.json.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.test.ts : Import test functions explicitly from 'vitest' instead of relying on globals (e.g., `import { describe, expect, it } from 'vitest';`)
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/core-generators/src/generators/node/vitest/extractor.json.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{unit.test.ts,int.test.ts} : Always import vitest globals explicitly (describe, it, expect)
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/core-generators/src/generators/node/vitest/extractor.json.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Structure tests with Arrange-Act-Assert: clear setup, execution, and verification phases
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tspackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/core-generators/src/generators/node/vitest/extractor.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Use `.unit.test.ts` or `.int.test.ts` suffixes for test files in TypeScript
Applied to files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-06-03T09:11:29.651Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 562
File: plugins/plugin-auth/package.json:32-36
Timestamp: 2025-06-03T09:11:29.651Z
Learning: With TypeScript project references, TypeScript compilation is watched from the root level using "watch:tsc:root" script, so individual packages no longer need to include their "tsc:watch" scripts in their local "watch" commands. The local "tsc:watch" scripts are renamed from "watch:tsc" but are not meant to be run as part of the package's watch command since TypeScript watching is handled centrally at the workspace root.
Applied to files:
packages/project-builder-server/src/sync/sync-project.tspackages/project-builder-server/src/actions/sync/sync-all-projects.action.ts
📚 Learning: 2025-05-08T12:56:11.723Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 539
File: scripts/check-changesets.ts:70-79
Timestamp: 2025-05-08T12:56:11.723Z
Learning: In the check-changesets.ts script for monorepo validation, `npm pack ${pkg.name}latest` is intentionally used to pack the most recently published version (not local changes) for comparison purposes to determine if changes require new changesets.
Applied to files:
packages/project-builder-server/src/sync/sync-project.ts
📚 Learning: 2025-04-23T16:39:07.742Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 511
File: packages/project-builder-server/src/service/builder-service.ts:158-183
Timestamp: 2025-04-23T16:39:07.742Z
Learning: The `writeMetadata` method in the `SyncMetadataController` class returns void and is synchronous, not a Promise.
Applied to files:
packages/project-builder-server/src/sync/sync-project.ts
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{ts,tsx} : Add JSDocs to all exported functions, interfaces, and classes with documentation of the function, its parameters, return value, and all fields
Applied to files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Create generators using `createGenerator` with configuration via descriptor schema (Zod), organizing into one or more tasks created with `createGeneratorTask`
Applied to files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonpackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/core/fastify-redis/extractor.json.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Always use `compareStrings` from `baseplate-dev/utils` instead of `String.prototype.localeCompare()` for code generation, file sorting, and internal data structures
Applied to files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonpackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use Dynamic Tasks for data-driven generation where code generation is driven by data
Applied to files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonpackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.int.test.{ts,tsx} : Integration tests use `.int.test.ts` suffix
Applied to files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to src/tests/**/*.{ts,tsx} : Test helpers are located in `src/tests/` directory
Applied to files:
packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonpackages/core-generators/src/generators/node/vitest/extractor.jsonpackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Leverage TypeScript for type-safe mocking in tests
Applied to files:
packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.unit.test.{ts,tsx} : Unit tests are colocated with source files using `.unit.test.ts` suffix
Applied to files:
packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.jsonexamples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.jsonexamples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonpackages/core-generators/src/generators/node/vitest/extractor.jsonexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/tsconfig.json : Enable `isolatedModules` in TypeScript configuration
Applied to files:
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.{ts,tsx,js,jsx} : Follow ESM module resolution with TypeScript's `NodeNext` setting
Applied to files:
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/tsconfig.json : Use `NodeNext` module resolution in TypeScript configuration
Applied to files:
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/tsconfig.json : Use strict type checking in TypeScript configuration
Applied to files:
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.{ts,tsx} : Use `import type` for type-only imports in TypeScript
Applied to files:
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Baseplate development follows a code-first approach: make changes directly in working codebases, extract those changes into reusable templates, update generators to use the new templates, then validate and sync the generated code
Applied to files:
examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-07-07T18:24:17.522Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 592
File: plugins/plugin-auth/src/auth0/generators/react/auth0-hooks/templates/src/hooks/use-required-user-id.ts:1-2
Timestamp: 2025-07-07T18:24:17.522Z
Learning: Files under templates/** directories can use `// ts-nocheck` because they are templates meant for code generation, not direct type checking.
Applied to files:
examples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonpackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/core/fastify-redis/extractor.jsonexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Import components from 'baseplate-dev/ui-components' package for UI development (e.g., Button, Input, Card, Dialog, etc.)
Applied to files:
examples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonpackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:27.654Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/ui-rules.mdc:0-0
Timestamp: 2025-11-24T19:45:27.654Z
Learning: Applies to +(*.tsx|packages/project-builder-web/**/*.tsx|packages/ui-components/**/*.tsx) : Use ShadCN-based components from `baseplate-dev/ui-components` instead of creating custom components
Applied to files:
examples/blog-with-auth/apps/backend/baseplate/file-id-map.jsonpackages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-05-08T12:56:59.222Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 539
File: scripts/check-changesets.ts:10-13
Timestamp: 2025-05-08T12:56:59.222Z
Learning: Node.js 20.12.0 and above include `globSync` in the core `node:fs` module, so `import { promises as fs, globSync } from 'node:fs';` is valid syntax in projects using these Node.js versions.
Applied to files:
packages/project-builder-server/src/actions/sync/sync-project.action.tspackages/project-builder-server/src/actions/sync/sync-all-projects.action.ts
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{ts,tsx} : Use `import type` for type-only imports
Applied to files:
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Follow task-based architecture for generators, use provider scopes for explicit wiring, leverage TypeScript rendering system for code generation, organize complex generation with Task Phases, and use Dynamic Tasks for data-driven generation
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use TsCodeFragment for composable code pieces and TsCodeUtils for manipulating fragments when generating TypeScript code
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use SidebarLayout, Card, Breadcrumb, NavigationMenu, and NavigationTabs components for consistent layout structure from baseplate-dev/ui-components
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
📚 Learning: 2025-05-05T06:37:43.106Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 521
File: plugins/baseplate-plugin-storage/src/generators/react/upload-components/upload-components.generator.ts:108-112
Timestamp: 2025-05-05T06:37:43.106Z
Learning: The template extractor in the baseplate codebase can automatically infer and determine the necessary import map providers for certain templates, making explicit specification of importMapProviders unnecessary in those cases.
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Tasks should have `run` (initialization) and `build` (code generation) phases, export and consume providers, and may be organized into phases for ordered execution
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-05-05T06:36:50.687Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 521
File: packages/react-generators/src/generators/admin/admin-crud-edit/admin-crud-edit.generator.ts:90-94
Timestamp: 2025-05-05T06:36:50.687Z
Learning: In this codebase, import paths can include `.ts` extensions, and the `resolveModuleSpecifier` function will handle them appropriately. There's no need to strip file extensions before passing paths to functions like `TsCodeUtils.importFragment`.
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-07-12T19:56:08.559Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 606
File: plugins/plugin-auth/src/auth/core/generators/auth-apollo/auth-apollo.generator.ts:24-32
Timestamp: 2025-07-12T19:56:08.559Z
Learning: For generator functions and configuration object methods like those in createGeneratorTask, inferred return types are acceptable when the structure is clear from the implementation. ESLint rules handle enforcement of explicit return types where truly needed, so manual review for this is not necessary.
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use provider scopes to control visibility and prevent collisions between tasks
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-04-23T06:44:30.952Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: In the project-builder-server test suite, Vitest automocks for 'node:fs' and 'node:fs/promises' are already configured to use memfs without needing explicit implementation replacement in each test file.
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-04-23T06:44:30.952Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: When testing file operations in this codebase, the pattern is to use Vitest automocks for 'node:fs' and 'node:fs/promises' (without explicit implementation replacement) while populating a virtual filesystem with vol.fromJSON() from memfs. File operations in tests are performed directly via vol.promises methods.
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.test.{ts,tsx} : For file system operations in tests, use memfs and mock 'node:fs' and 'node:fs/promises' with vi.mock
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts.changeset/migrate-vitest-global-setup-to-individual-files.mdexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-04-23T06:44:30.952Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: In this codebase, when testing file operations, Vitest's automocks for 'node:fs' and 'node:fs/promises' are used in conjunction with memfs, but without replacing the mock implementation explicitly in each test file. The virtual filesystem is populated using vol.fromJSON or similar methods, which works seamlessly with the automocks.
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts.changeset/migrate-vitest-global-setup-to-individual-files.mdpackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : For file system operations in tests, use memfs and mock `node:fs` and `node:fs/promises`
Applied to files:
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-08-17T01:30:00.344Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 633
File: packages/core-generators/src/renderers/typescript/extractor/apply-simple-replacements.ts:47-48
Timestamp: 2025-08-17T01:30:00.344Z
Learning: In template extraction systems like apply-simple-replacements.ts, it's intentional to skip processing import declarations to allow unused imports to be removed properly after template variable replacements are applied.
Applied to files:
packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Always mock external API calls and file system operations
Applied to files:
packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Extract repeated logic into helper functions to reduce duplication
Applied to files:
packages/core-generators/src/generators/node/vitest/extractor.jsonpackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Test broad behavior and common edge cases intelligently to avoid slowing down CI with excessive tests
Applied to files:
examples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:08.523Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/dev-commands.mdc:0-0
Timestamp: 2025-11-24T19:45:08.523Z
Learning: Run tests using `pnpm test:affected` from repository root or `pnpm test` from package, with ability to run specific test files via `pnpm vitest <path/to/file.unit.test.ts>` or specific test patterns via `pnpm test "test name pattern"`
Applied to files:
packages/core-generators/src/generators/node/vitest/vitest.generator.ts
🧬 Code graph analysis (4)
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts (2)
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts (1)
setup(5-7)packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts (1)
setup(7-9)
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts (1)
packages/core-generators/src/generators/node/vitest/vitest.generator.ts (1)
vitestConfigProvider(39-39)
packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts (3)
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-prisma.ts (1)
setup(3-21)examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-prisma.ts (1)
setup(3-21)packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.ts (1)
createTestDatabase(29-54)
packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts (1)
packages/core-generators/src/generators/node/vitest/vitest.generator.ts (1)
vitestConfigProvider(39-39)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Verify Sync (todo-with-auth0)
- GitHub Check: Verify Sync (blog-with-auth)
- GitHub Check: Lint
- GitHub Check: test
- GitHub Check: Test E2E
| const metadata = await syncMetadataController?.getMetadata(); | ||
|
|
||
| const packageSyncResults = Object.fromEntries( | ||
| apps.map((app) => [app.id, metadata?.packages[app.id].result]), | ||
| ); |
There was a problem hiding this comment.
Potential null pointer exception when accessing package results.
Line 227 uses incomplete optional chaining: metadata?.packages[app.id].result. If metadata is undefined, the expression metadata?.packages returns undefined, then undefined[app.id] returns undefined, but accessing .result on undefined will throw a TypeError.
🔎 Proposed fix with full optional chaining
- const packageSyncResults = Object.fromEntries(
- apps.map((app) => [app.id, metadata?.packages[app.id].result]),
- );
+ const packageSyncResults = Object.fromEntries(
+ apps.map((app) => [app.id, metadata?.packages[app.id]?.result]),
+ );📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const metadata = await syncMetadataController?.getMetadata(); | |
| const packageSyncResults = Object.fromEntries( | |
| apps.map((app) => [app.id, metadata?.packages[app.id].result]), | |
| ); | |
| const metadata = await syncMetadataController?.getMetadata(); | |
| const packageSyncResults = Object.fromEntries( | |
| apps.map((app) => [app.id, metadata?.packages[app.id]?.result]), | |
| ); |
🤖 Prompt for AI Agents
In packages/project-builder-server/src/sync/sync-project.ts around lines 224 to
228, the code accesses metadata?.packages[app.id].result which can throw when
metadata or packages is undefined; change the access to use full optional
chaining (e.g. metadata?.packages?.[app.id]?.result) or provide a safe fallback
(like null or a default object) so you never call .result on undefined, and
update the packageSyncResults creation accordingly.
Summary by CodeRabbit
Release Notes
Tests
New Features
✏️ Tip: You can customize this high-level summary in your review settings.