-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Upgrade vitest to 4.0.16 #734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 25b0523 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 |
📝 WalkthroughWalkthroughUpgrades Vitest from 3.2.4 → 4.0.16 and Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ 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). (2)
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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In
@examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts:
- Around line 107-115: Remove the incorrect type assertions by not casting
matcher results to concrete types; instead capture the thrown error and assert
its shape with matchers: replace the current
toThrow(expect.objectContaining(...)) call that uses "expect.objectContaining"
and "expect.arrayContaining" with a pattern that invokes the function inside a
try/catch (or uses await/Promise rejection handling), catches the thrown error,
and then calls expect(error).toEqual(expect.objectContaining({ name:
'InvalidMimeTypeError', expectedFileExtensions:
expect.arrayContaining(['jpg','jpeg']) })); this removes the `as string[]` and
`as Error` casts while keeping type-safe matcher assertions.
📜 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 (2)
examples/blog-with-auth/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlexamples/todo-with-auth0/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
🧰 Additional context used
📓 Path-based instructions (11)
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/modules/storage/utils/mime.unit.test.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/modules/storage/utils/mime.unit.test.ts
examples/todo-with-auth0/**/*.{unit,int}.test.ts
📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)
examples/todo-with-auth0/**/*.{unit,int}.test.ts: Use.unit.test.tsor.int.test.tssuffixes for test files in TypeScript
Import test functions explicitly from 'vitest' instead of using globals. Example:import { describe, expect, it } from 'vitest';
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
**/*.{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)
If a particular interface or type is not exported, change the file so it is exported
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
**/*.{unit.test.ts,int.test.ts}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{unit.test.ts,int.test.ts}: Unit tests must use.unit.test.tssuffix, integration tests must use.int.test.tssuffix
Always import vitest globals explicitly (describe, it, expect)
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
**/*.{unit,int}.test.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
**/*.{unit,int}.test.{ts,tsx}: Use descriptive test names that explain what is being tested
Structure tests with Arrange-Act-Assert: clear setup, execution, and verification phases
Always mock external API calls and file system operations
Each test should be independent and not rely on other tests
Leverage TypeScript for type-safe mocking in tests
Focus on testing public methods and behaviors, not implementation details
Each test should verify one specific behavior
Extract repeated logic into helper functions to reduce duplication
Test broad behavior and common edge cases intelligently to avoid slowing down CI with excessive tests
For file system operations in tests, use memfs and mocknode:fsandnode:fs/promises
When using globby with mocked fs, pass the mocked fs adapter to the globby call
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
**/*.unit.test.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
Unit tests are colocated with source files using
.unit.test.tssuffix
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/mcp-actions.mdc)
**/*.{js,ts,tsx,jsx}: Usemcp__baseplate_dev_server__diff_project()to generate a diff between generated and current working directory state, with optional parameters for compact format, specific packages, and file glob filtering
Usemcp__baseplate_dev_server__sync_project()to sync a specified project using the baseplate sync engine, with optional parameters for overwrite behavior, command skipping, and custom snapshot directory
Usemcp__baseplate_dev_server__delete_template()to delete templates by providing a file path and optionally the project name, which removes the template file, metadata, and generated files
Usemcp__baseplate_dev_server__extract_templates()to extract templates from a project and app, with optional auto-generation of extractor.json files and directory cleanup control
Usemcp__baseplate_dev_server__generate_templates()to generate typed template files from existing extractor.json configurations with optional project specification and cleanup control
Usemcp__baseplate_dev_server__create_generator()to create new generators with boilerplate code, using naming format 'category/name' and specifying the target directory
Usemcp__baseplate_dev_server__list_templates()to list all available generators with their templates, optionally filtered by project
Usemcp__baseplate_dev_server__show_template_metadata()to retrieve template metadata for a file from .templates-info.json using file path and optional project specification
Usemcp__baseplate_dev_server__snapshot_add()to track files in snapshots for persistent difference tracking, specifying project, app, file paths, and optional deletion markers
Usemcp__baseplate_dev_server__snapshot_remove()to untrack files from snapshot management with project, app, and file path specifications
Usemcp__baseplate_dev_server__snapshot_save()to persist current differences to snapshot with optional force flag to bypass confirmation
Usemcp__baseplate_dev_server__snapshot_show()to dis...
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
**/*.{tsx,ts,jsx,js}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Import components from '@baseplate-dev/ui-components' package using destructured imports (e.g.,
import { Button, Input, Card, Dialog } from '@baseplate-dev/ui-components';)
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Always use
compareStringsfrom@baseplate-dev/utilsinstead ofString.prototype.localeCompare()for code generation, file sorting, and internal data structures
Files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
🧠 Learnings (11)
📓 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: 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';`)
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)
📚 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:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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/modules/storage/utils/mime.unit.test.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} : Leverage TypeScript for type-safe mocking in tests
Applied to files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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/**/*.test.ts : Import test functions explicitly from 'vitest' instead of relying on globals (e.g., `import { describe, expect, it } from 'vitest';`)
Applied to files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
📚 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} : Unit tests must use `.unit.test.ts` suffix, integration tests must use `.int.test.ts` suffix
Applied to files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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} : Use descriptive test names that explain what is being tested
Applied to files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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/**/*.{unit,int}.test.ts : Use `.unit.test.ts` or `.int.test.ts` suffixes for test files and collocate tests with source files
Applied to files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.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} : Each test should verify one specific behavior
Applied to files:
examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
⏰ 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). (2)
- GitHub Check: Lint Examples (todo-with-auth0)
- GitHub Check: Lint Examples (blog-with-auth)
| }).toThrow( | ||
| expect.objectContaining({ | ||
| name: 'InvalidMimeTypeError', | ||
| expectedFileExtensions: expect.arrayContaining([ | ||
| 'jpg', | ||
| 'jpeg', | ||
| ]) as string[], | ||
| }) as Error, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove incorrect type assertions for proper type safety.
The type assertions as string[] on line 113 and as Error on line 114 are semantically incorrect. expect.arrayContaining() returns a matcher object (not a string[]), and expect.objectContaining() returns a matcher object (not an Error). These assertions bypass TypeScript's type checking and violate the project's guideline to leverage TypeScript for type-safe testing.
If type errors exist without these assertions, that indicates the matchers are being used incorrectly or there's a type definition issue with Vitest 4.x that should be addressed properly rather than suppressed with casts.
🔎 Proposed fix
}).toThrow(
expect.objectContaining({
name: 'InvalidMimeTypeError',
- expectedFileExtensions: expect.arrayContaining([
- 'jpg',
- 'jpeg',
- ]) as string[],
- }) as Error,
+ expectedFileExtensions: expect.arrayContaining(['jpg', 'jpeg']),
+ }),
);Based on coding guidelines: "Leverage TypeScript for type-safe mocking in tests"
📝 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.
| }).toThrow( | |
| expect.objectContaining({ | |
| name: 'InvalidMimeTypeError', | |
| expectedFileExtensions: expect.arrayContaining([ | |
| 'jpg', | |
| 'jpeg', | |
| ]) as string[], | |
| }) as Error, | |
| ); | |
| }).toThrow( | |
| expect.objectContaining({ | |
| name: 'InvalidMimeTypeError', | |
| expectedFileExtensions: expect.arrayContaining(['jpg', 'jpeg']), | |
| }), | |
| ); |
🤖 Prompt for AI Agents
In
@examples/todo-with-auth0/apps/backend/src/modules/storage/utils/mime.unit.test.ts
around lines 107 - 115, Remove the incorrect type assertions by not casting
matcher results to concrete types; instead capture the thrown error and assert
its shape with matchers: replace the current
toThrow(expect.objectContaining(...)) call that uses "expect.objectContaining"
and "expect.arrayContaining" with a pattern that invokes the function inside a
try/catch (or uses await/Promise rejection handling), catches the thrown error,
and then calls expect(error).toEqual(expect.objectContaining({ name:
'InvalidMimeTypeError', expectedFileExtensions:
expect.arrayContaining(['jpg','jpeg']) })); this removes the `as string[]` and
`as Error` casts while keeping type-safe matcher assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In @packages/tools/vitest.config.node.js:
- Line 25: The test configuration's exclude array was changed to remove the e2e
pattern, causing end-to-end tests to be picked up by Vitest; restore the
explicit '**/e2e/**' entry in the exclude array (the one that currently reads
exclude: [...defaultExclude, '**/generators/*/*/templates/**']) so it becomes
exclude: [...defaultExclude, '**/generators/*/*/templates/**', '**/e2e/**'] to
ensure e2e folders remain excluded from test runs.
🧹 Nitpick comments (1)
packages/core-generators/src/generators/node/vitest/vitest.generator.ts (1)
17-17: Reorder import to follow coding guidelines.The
quotimport from@baseplate-dev/utilsshould be grouped with other external library imports at the top of the file (after line 6), rather than being placed between local imports.As per coding guidelines, imports should be sorted by group: external libs first, then local imports.
🔎 Proposed refactor
Move the import to line 7 (right after the zod import):
import { z } from 'zod'; +import { quot } from '@baseplate-dev/utils'; import { CORE_PACKAGES } from '#src/constants/index.js'; import { packageScope } from '#src/providers/scopes.js'; import { extractPackageVersions } from '#src/utils/extract-packages.js'; import { eslintConfigProvider } from '../eslint/index.js'; import { createNodePackagesTask, createNodeTask } from '../node/index.js'; const descriptorSchema = z.object({}); -import { quot } from '@baseplate-dev/utils'; - import { tsCodeFragment, TsCodeUtils, tsImportBuilder, } from '#src/renderers/index.js';
📜 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 (9)
examples/blog-with-auth/apps/admin/baseplate/generated/vitest.config.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/admin/baseplate/generated/vitest.config.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/apps/backend/baseplate/generated/vitest.config.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/apps/web/baseplate/generated/vitest.config.tsis excluded by!**/generated/**,!**/generated/**tests/simple/apps/backend/baseplate/generated/vitest.config.tsis excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/apps/backend/vitest.config.tsis excluded by!tests/**tests/simple/apps/web/baseplate/generated/vitest.config.tsis excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/apps/web/vitest.config.tsis excluded by!tests/**
📒 Files selected for processing (7)
examples/blog-with-auth/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tspackages/tools/vitest.config.node.js
🧰 Additional context used
📓 Path-based instructions (11)
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/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/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/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.ts
**/*.{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)
If a particular interface or type is not exported, change the file so it is exported
Files:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.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:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/mcp-actions.mdc)
**/*.{js,ts,tsx,jsx}: Usemcp__baseplate_dev_server__diff_project()to generate a diff between generated and current working directory state, with optional parameters for compact format, specific packages, and file glob filtering
Usemcp__baseplate_dev_server__sync_project()to sync a specified project using the baseplate sync engine, with optional parameters for overwrite behavior, command skipping, and custom snapshot directory
Usemcp__baseplate_dev_server__delete_template()to delete templates by providing a file path and optionally the project name, which removes the template file, metadata, and generated files
Usemcp__baseplate_dev_server__extract_templates()to extract templates from a project and app, with optional auto-generation of extractor.json files and directory cleanup control
Usemcp__baseplate_dev_server__generate_templates()to generate typed template files from existing extractor.json configurations with optional project specification and cleanup control
Usemcp__baseplate_dev_server__create_generator()to create new generators with boilerplate code, using naming format 'category/name' and specifying the target directory
Usemcp__baseplate_dev_server__list_templates()to list all available generators with their templates, optionally filtered by project
Usemcp__baseplate_dev_server__show_template_metadata()to retrieve template metadata for a file from .templates-info.json using file path and optional project specification
Usemcp__baseplate_dev_server__snapshot_add()to track files in snapshots for persistent difference tracking, specifying project, app, file paths, and optional deletion markers
Usemcp__baseplate_dev_server__snapshot_remove()to untrack files from snapshot management with project, app, and file path specifications
Usemcp__baseplate_dev_server__snapshot_save()to persist current differences to snapshot with optional force flag to bypass confirmation
Usemcp__baseplate_dev_server__snapshot_show()to dis...
Files:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
**/*.{tsx,ts,jsx,js}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Import components from '@baseplate-dev/ui-components' package using destructured imports (e.g.,
import { Button, Input, Card, Dialog } from '@baseplate-dev/ui-components';)
Files:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Always use
compareStringsfrom@baseplate-dev/utilsinstead ofString.prototype.localeCompare()for code generation, file sorting, and internal data structures
Files:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
**/generators/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/generators/**/*.{ts,tsx}: Follow task-based architecture for generators usingcreateGeneratorandcreateGeneratorTask
Use provider scopes for explicit wiring and to control visibility and prevent collisions between tasks
UseTsCodeFragmentfor composable code pieces andTsCodeUtilsfor manipulating fragments in TypeScript code generation
Use the import builder for managing dependencies in TypeScript code generation
Organize complex generation with Task Phases for ordered execution
Use Dynamic Tasks for data-driven generation
Files:
packages/core-generators/src/generators/node/vitest/vitest.generator.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/admin/vitest.config.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/admin/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.ts
**/*/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Only use
localeCompare()when building user-facing features that require locale-aware sorting, displaying sorted lists in the UI, or explicitly requested by product requirements
Files:
examples/todo-with-auth0/apps/web/vitest.config.ts
🧠 Learnings (32)
📓 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: 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';`)
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: Run tests from `./src` root directory in 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: 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.
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.
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"`
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.
📚 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:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
📚 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:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
📚 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:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
📚 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 src/tests/**/*.{ts,tsx} : Test helpers are located in `src/tests/` directory
Applied to files:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
📚 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 **/*.{ts,tsx} : Include absolute paths in import statements via tsconfig paths (`src/` is the alias for `src/`)
Applied to files:
examples/todo-with-auth0/apps/backend/vitest.config.tspackages/core-generators/src/generators/node/vitest/vitest.generator.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tspackages/tools/vitest.config.node.js
📚 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: Run tests from `./src` root directory in Vitest
Applied to files:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.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/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/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 : Enable `isolatedModules` in TypeScript configuration
Applied to files:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/blog-with-auth/apps/admin/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:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/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 src/__mocks__/**/*.{ts,tsx} : Manual mocks are in `src/__mocks__/` directory
Applied to files:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
📚 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:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.tspackages/tools/vitest.config.node.js
📚 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:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.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} : Leverage TypeScript for type-safe mocking in tests
Applied to files:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/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 **/*.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:
examples/todo-with-auth0/apps/backend/vitest.config.tsexamples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/vitest.config.tsexamples/blog-with-auth/apps/backend/vitest.config.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 **/*.test-helper.{ts,tsx} : Extract common setup code into test helpers in `*.test-helper.ts` files
Applied to files:
examples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-12-30T13:56:01.652Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T13:56:01.652Z
Learning: Applies to **/generators/**/*.{ts,tsx} : Use the import builder for managing dependencies in TypeScript code generation
Applied to files:
packages/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 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/core-generators/src/generators/node/vitest/vitest.generator.tspackages/tools/vitest.config.node.js
📚 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/core-generators/src/generators/node/vitest/vitest.generator.tspackages/tools/vitest.config.node.js
📚 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/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-12-30T13:56:01.652Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T13:56:01.652Z
Learning: Applies to **/generators/**/*.{ts,tsx} : Use `TsCodeFragment` for composable code pieces and `TsCodeUtils` for manipulating fragments in TypeScript code generation
Applied to files:
packages/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/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-12-30T13:55:38.721Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/mcp-actions.mdc:0-0
Timestamp: 2025-12-30T13:55:38.721Z
Learning: Applies to **/*.{js,ts,tsx,jsx} : Use `mcp__baseplate_dev_server__generate_templates()` to generate typed template files from existing extractor.json configurations with optional project specification and cleanup control
Applied to files:
packages/core-generators/src/generators/node/vitest/vitest.generator.tspackages/tools/vitest.config.node.js
📚 Learning: 2025-07-10T06:49:07.714Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 598
File: packages/fastify-generators/src/generators/yoga/yoga-plugin/templates/src/plugins/graphql/index.ts:18-18
Timestamp: 2025-07-10T06:49:07.714Z
Learning: In React projects using Vite, keep the .env file naming convention as .env.development, .env.production, etc. even when internal application environment values use shorter abbreviations like 'dev', 'stage', 'prod'. This follows Vite's mode conventions.
Applied to files:
packages/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:
examples/todo-with-auth0/apps/admin/vitest.config.tsexamples/blog-with-auth/apps/admin/vitest.config.tsexamples/todo-with-auth0/apps/web/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/**/*.{unit,int}.test.ts : Use `.unit.test.ts` or `.int.test.ts` suffixes for test files and collocate tests with source files
Applied to files:
examples/blog-with-auth/apps/admin/vitest.config.tsexamples/blog-with-auth/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/admin/vitest.config.tsexamples/blog-with-auth/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 `NodeNext` module resolution in TypeScript configuration
Applied to files:
examples/blog-with-auth/apps/admin/vitest.config.ts
📚 Learning: 2025-07-14T12:02:36.595Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 609
File: packages/ui-components/src/components/badge/badge-with-icon.stories.tsx:3-3
Timestamp: 2025-07-14T12:02:36.595Z
Learning: For TypeScript/TSX files: `#src/` is the new path alias standard for `src/` directory imports, replacing the previous `src/` convention.
Applied to files:
examples/todo-with-auth0/apps/web/vitest.config.ts
📚 Learning: 2025-12-30T13:55:38.721Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/mcp-actions.mdc:0-0
Timestamp: 2025-12-30T13:55:38.721Z
Learning: Applies to **/*.{js,ts,tsx,jsx} : Use `mcp__baseplate_dev_server__extract_templates()` to extract templates from a project and app, with optional auto-generation of extractor.json files and directory cleanup control
Applied to files:
packages/tools/vitest.config.node.js
📚 Learning: 2025-07-30T13:27:20.000Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 623
File: plugins/plugin-auth/src/local-auth/core/generators/react-session/templates/src/app/user-session-provider.tsx:6-12
Timestamp: 2025-07-30T13:27:20.000Z
Learning: Ignore ESLint import ordering rules for files in templates/** directories as these are code generation templates, not direct source code.
Applied to files:
packages/tools/vitest.config.node.js
📚 Learning: 2025-12-30T13:55:38.721Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/mcp-actions.mdc:0-0
Timestamp: 2025-12-30T13:55:38.721Z
Learning: Applies to **/*.{js,ts,tsx,jsx} : Use `mcp__baseplate_dev_server__create_generator()` to create new generators with boilerplate code, using naming format 'category/name' and specifying the target directory
Applied to files:
packages/tools/vitest.config.node.js
⏰ 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). (7)
- GitHub Check: Verify Sync (blog-with-auth)
- GitHub Check: Verify Sync (todo-with-auth0)
- GitHub Check: Lint Examples (todo-with-auth0)
- GitHub Check: Lint Examples (blog-with-auth)
- GitHub Check: test
- GitHub Check: Test E2E
- GitHub Check: Lint
🔇 Additional comments (8)
examples/todo-with-auth0/apps/admin/vitest.config.ts (1)
10-10: LGTM! Test directory configuration added.The addition of
dir: 'src'correctly restricts test discovery to thesrcdirectory, aligning with Vitest best practices and codebase learnings.Based on learnings, tests should run from the
./srcroot directory in Vitest.examples/todo-with-auth0/apps/backend/vitest.config.ts (1)
10-10: LGTM! Test directory configuration added.The
dir: 'src'configuration correctly restricts test discovery to thesrcdirectory, consistent with the Vitest 4.x upgrade and codebase conventions.Based on learnings, tests should run from the
./srcroot directory in Vitest.examples/todo-with-auth0/apps/web/vitest.config.ts (1)
10-10: LGTM! Test directory configuration added.The
dir: 'src'configuration aligns with Vitest best practices and ensures tests are discovered from thesrcdirectory.Based on learnings, tests should run from the
./srcroot directory in Vitest.examples/blog-with-auth/apps/admin/vitest.config.ts (1)
10-10: LGTM! Test directory configuration added.The
dir: 'src'configuration is correctly applied, consistent with the Vitest 4.x upgrade and codebase conventions.Based on learnings, tests should run from the
./srcroot directory in Vitest.packages/core-generators/src/generators/node/vitest/vitest.generator.ts (1)
88-88: LGTM! Generator now emits test directory configuration.The use of
quot('src')correctly generates thedir: 'src'configuration for new Vitest configs, ensuring consistency across newly generated projects.examples/blog-with-auth/apps/backend/vitest.config.ts (1)
10-10: LGTM! Proper test directory scoping.Adding
dir: 'src'correctly narrows test discovery to the src directory, aligning with the Vitest 4 upgrade and project learnings.packages/tools/vitest.config.node.js (2)
24-24: LGTM! Consistent test directory scoping.Adding
dir: 'src'appropriately scopes test discovery and aligns with the monorepo-wide Vitest 4 upgrade.
11-11: The type annotation is correct for Vitest 4.0.ViteUserConfigis the proper type export fromvitest/configand aligns with thedefineConfigreturn type.
| '**/generators/*/*/templates/**', | ||
| ], | ||
| dir: 'src', | ||
| exclude: [...defaultExclude, '**/generators/*/*/templates/**'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n packages/tools/vitest.config.node.jsRepository: halfdomelabs/baseplate
Length of output: 969
🏁 Script executed:
# Check Vitest's defaultExclude pattern in version 4.0+
node -e "
import('vitest/config').then(mod => {
console.log('defaultExclude contents:');
console.log(JSON.stringify(mod.defaultExclude, null, 2));
}).catch(err => {
console.log('Could not load vitest dynamically');
// Try alternative approach
const fs = require('fs');
const path = require('path');
try {
const configPath = require.resolve('vitest/config');
console.log('Vitest config path:', configPath);
} catch (e) {
console.log('Vitest not found in node_modules');
}
});
"Repository: halfdomelabs/baseplate
Length of output: 132
🏁 Script executed:
# Search for e2e test files in the repository
fd -e test.ts -e test.js -e e2e | grep -i e2e | head -20Repository: halfdomelabs/baseplate
Length of output: 135
🏁 Script executed:
# Check if there are any e2e tests or e2e directory
find . -type d -name 'e2e' -o -type d -name 'e2e-tests' 2>/dev/null | head -10Repository: halfdomelabs/baseplate
Length of output: 100
🌐 Web query:
Vitest 4.0 defaultExclude pattern documentation
💡 Result:
Vitest’s default exclude (used by test discovery) is:
- "/node_modules/"
- "/dist/"
- "/cypress/"
- "/.{idea,git,cache,output,temp}/"
(Shown in Vitest’s config defaults and referenced in the docs/config source.) [1][2]
Sources:
- Vitest config reference (docs). [1]
- Vitest shipped defaults (config defaults showing defaultExclude). [2]
🌐 Web query:
Vitest defaultExclude e2e pattern what files excluded
💡 Result:
Vitest’s default test exclude patterns (what files/folders are ignored unless you override) are:
- //node_modules/**
- //dist/**
- //cypress/**
- //.{idea,git,cache,output,temp}/**
- //{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*
So e2e folders are not specifically excluded by default (only a "cypress" folder is). If you want to exclude an e2e folder (e.g. ./test/e2e or ./e2e), add it to test.exclude or extend configDefaults.exclude. [1][2]
Sources: Vitest config reference (exclude and include). [1] https://v2.vitest.dev/config/ · [2] https://vitest.dev/config/file
Add back explicit **/e2e/** to the exclude array.
Vitest's defaultExclude does not include e2e patterns (it only excludes node_modules, dist, cypress, and hidden directories). The repository contains e2e tests, which will now be included in the test run. Restore the explicit **/e2e/** exclusion that was removed.
🤖 Prompt for AI Agents
In @packages/tools/vitest.config.node.js at line 25, The test configuration's
exclude array was changed to remove the e2e pattern, causing end-to-end tests to
be picked up by Vitest; restore the explicit '**/e2e/**' entry in the exclude
array (the one that currently reads exclude: [...defaultExclude,
'**/generators/*/*/templates/**']) so it becomes exclude: [...defaultExclude,
'**/generators/*/*/templates/**', '**/e2e/**'] to ensure e2e folders remain
excluded from test runs.
Summary by CodeRabbit
Chores
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.