Skip to content

feat(esm): packages/vite api side vitest support#359

Merged
Tobbe merged 2 commits into
mainfrom
tobbe-vite-esm-prep
Aug 9, 2025
Merged

feat(esm): packages/vite api side vitest support#359
Tobbe merged 2 commits into
mainfrom
tobbe-vite-esm-prep

Conversation

@Tobbe
Copy link
Copy Markdown
Member

@Tobbe Tobbe commented Aug 9, 2025

Bringing over the last packages/vite changes from #80 to the main branch

PR (6/n) for adding ESM support. See #349 for PR 1/n in the series

@Tobbe Tobbe added this to the next-release milestone Aug 9, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 9, 2025

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit 9c988f0
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/6897b89700584f0008bc883f

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds API-side Vitest testing support to the CedarJS framework by creating a new testing preset configuration. The changes introduce a new export path './api' in the @cedarjs/vite package that provides a bundled Vitest configuration specifically tailored for API testing scenarios.

The implementation follows CedarJS's preset pattern by creating cedarVitestPreset function that combines four essential Vite plugins: cedarVitestApiConfigPlugin for environment setup and test configuration, autoImportsPlugin for automatic importing of testing utilities like mockContext, mockHttpEvent, gql, and context, cedarjsDirectoryNamedImportPlugin to maintain compatibility with CedarJS's directory-based import conventions, and trackDbImportsPlugin for database interaction tracking during tests.

The package.json modifications add the new export entry pointing to the compiled TypeScript output and include @cedarjs/testing as a workspace dependency. The preset file uses ESM-compatible imports with .js extensions, aligning with the broader ESM preparation work indicated in the branch name. This mirrors the existing web-side testing architecture, providing consistency across the framework's testing infrastructure and making it easier for developers to configure API-side tests with a single preset rather than manually configuring multiple plugins.

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it adds new functionality without modifying existing code
  • Score reflects clean implementation following established patterns and straightforward plugin bundling approach
  • Pay close attention to the new export path in package.json to ensure proper module resolution

2 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment thread packages/vite/package.json
@Tobbe Tobbe merged commit 7d92939 into main Aug 9, 2025
50 checks passed
@Tobbe Tobbe deleted the tobbe-vite-esm-prep branch August 9, 2025 21:22
Tobbe added a commit that referenced this pull request Aug 9, 2025
Tobbe added a commit that referenced this pull request Aug 9, 2025
Tobbe added a commit that referenced this pull request Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant