Closed MNishimuraBonfire closed 1 year ago
@MNishimuraBonfire yes, that is correct, when using vite
then vitest
is used as well, not jest
. You are correct, I will add this in our docs. I will fix that none
is respected though.
Let me know what you think about that, though! Thank you for pointing it out!
Allowing none
is probably good enough to limit my annoyance with it; I'm working a repo where we switched to Vite as a bundler (and switched to NX) over Webpack for build speed reasons, but the tests are Jest (and there are a lot of them, test speed in CI is a major concern, and I'd prefer to not intermingle test runners, though NX does obviously support that), so would loosely prefer that configuration be supported.
Given vitest 0.34.0 (re: https://github.com/vitest-dev/vitest/issues/579 ) seems to be improving performance concerns, it may be worth taking the time to see if switching over entirely makes sense again.
That said, as long as I can give instructions to generate a new project without installing vitest as a side effect, and having to explain how to rip out its configuration, it's an improvement.
Thank for the feedback @MNishimuraBonfire ! Good to know!
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
nx g @nx/react:app my-app --bundler=vite --unitTestRunner=jest
installs vitest and configures vitest as the test runner. This is also true ofnx g @nx/react:app my-app --bundler=vite --unitTestRunner=none
Expected Behavior
--unitTestRunner should be respected
GitHub Repo
https://github.com/nrwl/nx-examples
Steps to Reproduce
nx g @nx/react:app my-app --bundler=vite --unitTestRunner=jest
vite.config.ts
contains vitest config.Nx Report
Failure Logs
No response
Package Manager Version
npm 9.6.7
Operating System
Additional Information
Appears introduced by https://github.com/nrwl/nx/pull/13436, which comments on behaviour later changed by https://github.com/nrwl/nx/pull/14188.
As far as I can tell, removing the
behaves sanely for the initial generator run, though I may be not understanding additional context about how test generators behave later. If the intent is that using Vite as a bundler must use Vitest, that should be documented in the generator.