Skip to content

Conversation

@Tobbe
Copy link
Member

@Tobbe Tobbe commented Aug 11, 2025

When #355 added vitest support to the testing package it should also have made vitest a peer dependency. And that's what I had it be in #80. But I didn't want all Cedar apps to have to install vitest. It should really only be a peer dep for ESM apps. I didn't know how to handle it, so I just left it out of #355 while I thought about it.

I've now decided that the best way forward for now is to mark it as an optional peer dependency. It really isn't optional for ESM apps, but I think this is the best I can do.

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

netlify bot commented Aug 11, 2025

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit 31773f0
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/6899fa629ac03700083c8a60

Copy link
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 vitest as an optional peer dependency to the @cedarjs/testing package. The change is completing incomplete work from PR #355, which originally added vitest support to the testing package but failed to properly configure the dependency structure.

The testing package currently exports vitest-specific functionality through dedicated export paths (./api/vitest and ./web/vitest) and includes vitest plugins for API configuration. However, vitest was only listed in devDependencies, creating an inconsistent dependency structure. This change adds vitest as an optional peer dependency with version 3.2.4, following npm best practices for packages that provide optional integrations.

The dual dependency structure (keeping vitest in both devDependencies and peerDependencies) is intentional - devDependencies allows the package to be built and tested, while the optional peer dependency ensures vitest is available when users consume the vitest-specific features. This pattern allows users to install the testing package even if they don't use vitest, while ensuring proper functionality when vitest features are utilized.

PR Description Notes:

  • The PR description appears to be cut off mid-sentence after "it should also have made"

Confidence score: 5/5

  • This PR is extremely safe to merge with virtually no risk of production issues
  • Score reflects a simple, well-understood dependency configuration change that follows established npm patterns
  • No files require special attention as this is a straightforward package.json modification

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@Tobbe Tobbe enabled auto-merge (squash) August 11, 2025 14:14
@Tobbe Tobbe merged commit 8810330 into main Aug 11, 2025
36 checks passed
@Tobbe Tobbe deleted the tobbe-testing-vitest-opt-peer-dep branch August 11, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants