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

Vitest should install correct ui/browser package versions via CLI #5855

Closed
6 tasks done
yannbf opened this issue Jun 7, 2024 · 1 comment · Fixed by #6611
Closed
6 tasks done

Vitest should install correct ui/browser package versions via CLI #5855

yannbf opened this issue Jun 7, 2024 · 1 comment · Fixed by #6611
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@yannbf
Copy link
Contributor

yannbf commented Jun 7, 2024

Describe the bug

When running tests with specific flags which the project is not ready for, e.g. --ui or --browser, the CLI detects the need to install such dependencies:

image

However, the dependencies don't follow the version of the CLI. In my project, I'm using vitest: 2.0.0-beta.9 and when prompted to install @vitest/browser, I end up getting latest (1.6.0). This causes further issues as the packages won't play nicely if they differ in versions, especially major versions.

It would be nice if the code which installs dependencies, if such dependencies are vitest ones e.g. @vitest/browser or @vitest/ui, that they use the same version of the installed Vitest CLI:

await (await import('@antfu/install-pkg')).installPackage(dependency, { dev: true })

Reproduction

  • Create any vitest project using a specific, non-latest version
  • Run vitest --browser
  • Get prompted, see the installed version being different than the Vitest CLI

Used Package Manager

npm

Validations

@AriPerkkio
Copy link
Member

This is also an issue with code coverage packages. As we (intentionally) require all Vitest packages to be on same version, it's not guaranteed that vitest@1.2.0 and @vitest/<package>@1.5.0 work together. When auto-installing prompted coverage packages while running older versions of Vitest, you may end up in a situation where newer version @vitest/coverage-* is installed.

@AriPerkkio AriPerkkio added p2-nice-to-have Not breaking anything but nice to have (priority) and removed pending triage labels Jun 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants