-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix(vite): pass cli arguments as options to vitest #22355
fix(vite): pass cli arguments as options to vitest #22355
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit d12f87f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 6 targets
Sent with 💌 from NxCloud. |
I have tested my changes locally using Still need to look into why the new e2e test for vite doesn't pick up the changes. |
Hey @thdk
It looks like all the written options are now properly passed down to vitest but the option used in your test I've found a |
Will this also enable the use of --ui again? |
@lynxwint3r you seem to be right about > nx run web:test --test-file app/components/atoms/Select/Select.test.tsx
DEV v1.3.1 /monorepo/apps/web
✓ app/utils/parseProcessEnvFeatureFlags.test.ts (4 tests) 2ms
✓ app/utils/request.test.ts (4 tests) 3ms
✓ app/components/atoms/Select/Select.test.tsx (1 test) 35ms
✓ app/components/atoms/Acceptance/Acceptance.test.tsx (2 tests) 43ms
✓ app/components/atoms/Card/Card.test.tsx (2 tests) 37ms
✓ app/components/organisms/FormGroup/FormGroup.test.tsx (1 test) 16ms
Test Files 6 passed (6)
Tests 14 passed (14)
Start at 21:14:17
Duration 1.34s (transform 261ms, setup 758ms, collect 804ms, tests 136ms, environment 2.04s, prepare 392ms)
PASS Waiting for file changes...
press h to show help, press q to quit
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project web (2s)
With additional flags:
--test-file=app/components/atoms/Select/Select.test.tsx > nx run web:test --test-files app/components/atoms/Select/Select.test.tsx
DEV v1.3.1 monorepo/apps/web
✓ app/components/atoms/Select/Select.test.tsx (1 test) 35ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 21:14:26
Duration 618ms (transform 34ms, setup 71ms, collect 87ms, tests 35ms, environment 195ms, prepare 46ms)
PASS Waiting for file changes...
press h to show help, press q to quit Unfortunately this gives the same result for the e2e test. |
a55ced1
to
0731ff1
Compare
Any plans to merge this PR? |
5346a06
to
19515e0
Compare
19515e0
to
5e4760f
Compare
337c933
to
081e3a1
Compare
@Coly010 I see CI now fails. Is there anything still required from my side? I can look at it to rebase by branch but don't want to force push now that you are on it as well. Is there a reason my commits have been squashed? I have the following commits on my local branch: e1a988f2d chore(vite): prevent test to hang by setting CI=true
6b0c81b1e chore: create runCLIUntil wrapper function
dd521ceab chore(vite): add e2e test for vitest --coverage and --watch
14d6c3491 fix(vite): pass cli arguments as options to vitest
0731ff154 fix(vite): explicitly disable vitest watch mode when not specified I do believe these commit message each bring value to the git history of the nx repo and in release reports. |
@thdk Nothing required from your side. This PR has uncovered a potential issue on our end however, which is why the CI is failing. (It passes locally, but CI is not producing logs of the failure). We always squash commits anyway when we merge, and the commits have been included in the Long Commit Message, so they're not lost. However, I did need to remove some changes you had made as they were not scoped to what this PR was aiming to achieve. Thanks however for this contribution, and when it can be merged (CI gets fixed), it will be |
081e3a1
to
d12f87f
Compare
Thanks @thdk for the contribution! 🎉 |
@Coly010 I think we now have an issue with the See: https://vitest.dev/guide/cli#changed
However, this change is now passing Unfortunately, there isn't a workaround (other than not using the |
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Context
Issue: #22354
I noticed the cli arguments were no longer working when the vite test executor was used.
Problem / solution
A recent change (00dae6a) introduced the use of
vitest.parseCli
. However, its return type (no longer?) is a valid options object.The
parseCli
function (docs) fromvitest
returns an object which should first be destructured to get the proper options object:Current Behavior
Cli args such as
--watch
or--coverage
of--ui
are not used when using@nx/vite
test executor.Expected Behavior
Related Issue(s)
Fixes #22354, Fixes #22392
Issue relates to #21890