Skip to content
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

Bug: @vue/test-utils doesn't require a specific vue version as peer dependency #2507

Closed
Gi11i4m opened this issue Sep 5, 2024 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@Gi11i4m
Copy link
Contributor

Gi11i4m commented Sep 5, 2024

Describe the bug
@vue/test-utils doesn't require a specific vue version as peer dependency. In a monorepo with multiple vue versions (possible with pnpm (and probably yarn as well) this caused @vue/test-utils to import the wrong vue version when using mount.

The problem was fixed when adding vue 3.x as peerDependency to @vue/test-utils using pnpm's packageExtensions.

To Reproduce
I can't share our code and since I'm not exactly sure what dependency structure is needed I can't take the time to set up a reproduction.

We have a monorepo library with vue2 packages, vue3 packages and shared packages (with code that can be shared between the two versions).

It seems to me that declaring peer dependencies is a good practice in general.

Expected behavior
I expect @vue/test-utils to always depend on the correct vue version by declaring peer dependencies.

@Gi11i4m Gi11i4m added the bug Something isn't working label Sep 5, 2024
@cexbrayat
Copy link
Member

Hi @Gi11i4m

The peer dependency has been removed in #2364 by @qmonmert

@qmonmert @lmiller1990 can you explain why this was necessary?

@Gi11i4m
Copy link
Contributor Author

Gi11i4m commented Sep 17, 2024

Reading the commit message it seems like the peer dependencies were not removed for a valid reason. They're definitely not useless.

Seeing as @Akryum is describing the exact same problem, is it okay if I open a PR re-adding the peerDependencies, although with a much wider range since that's probably the reason they "generated warnings"?

@cexbrayat
Copy link
Member

@Gi11i4m Yes, feel free to open a PR 👍

@qmonmert
Copy link
Contributor

@Gi11i4m the reason was in this ticket jhipster/jhipster-lite#9030

Gi11i4m added a commit to Gi11i4m/test-utils that referenced this issue Sep 19, 2024
- no peer dependencies causes @vue/test-utils to import stuff from the wrong Vue version in monorepos with multiple Vue versions
- too specific peer dependencies causes dependant projects not to be updated or find a valid Vue version so the range has been widened

closes 2507
@Gi11i4m
Copy link
Contributor Author

Gi11i4m commented Sep 19, 2024

@qmonmert I see. Well, I'm pretty sure the issue could've been fixed as well by setting the peer dependency range to 3.x instead of 3.0.1. Peer dependencies shouldn't be so strict, but we also shouldn't nuke them 😅

Here's a PR with peer dependencies re-added but with a wide range to assure everyone can still update within their own Vue 3 version.

#2511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants