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

feat(nx-plugin): added support for vitest test runner #29140

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

gperdomor
Copy link
Contributor

Current Behavior

Nx Plugin do not have the option to use Vitest as test runner

Expected Behavior

This PR allow us to use Vitest as test runner in plugins projects.

Vitest for e2e targets is still missing and a new PR will be raised after #29139 is fixed

Related Issue(s)

Fixes #22882

@gperdomor gperdomor requested review from a team as code owners December 2, 2024 02:25
Copy link

vercel bot commented Dec 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Dec 19, 2024 10:58pm

Copy link

nx-cloud bot commented Dec 2, 2024

View your CI Pipeline Execution ↗ for commit 3540033.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 39m 11s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 1m 6s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx format:check --base=09800... ✅ Succeeded 21s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 19s View ↗
nx documentation --no-dte ✅ Succeeded 43s View ↗

☁️ Nx Cloud last updated this comment at 2024-12-19 23:36:35 UTC

Copy link
Collaborator

@isaacplmann isaacplmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs changes look good

@gperdomor gperdomor force-pushed the feature/nx-plugin-unit-tests-vitest branch 4 times, most recently from 8f8841b to 47ddfdd Compare December 3, 2024 18:30
@gperdomor
Copy link
Contributor Author

Hi @FrozenPandaz, can you please take a look at this when you have some time? 🙏🏻

@gperdomor gperdomor force-pushed the feature/nx-plugin-unit-tests-vitest branch 7 times, most recently from 199ddf4 to c7cef07 Compare December 8, 2024 21:36
@gperdomor gperdomor changed the title feat(nx-plugin): added suport for vitest test runner feat(nx-plugin): added support for vitest test runner Dec 9, 2024
@gperdomor gperdomor force-pushed the feature/nx-plugin-unit-tests-vitest branch from c7cef07 to 5456d78 Compare December 10, 2024 14:38
@gperdomor
Copy link
Contributor Author

Folks let me know if any change it's required before merge this 🙏🏻 ...

@gperdomor gperdomor requested a review from vsavkin as a code owner December 10, 2024 18:58
@gperdomor gperdomor force-pushed the feature/nx-plugin-unit-tests-vitest branch from 0dea15c to 5fb2756 Compare December 10, 2024 19:05
@gperdomor gperdomor force-pushed the feature/nx-plugin-unit-tests-vitest branch from 5fb2756 to babee77 Compare December 11, 2024 16:43
@gperdomor
Copy link
Contributor Author

Hi folks... Can you merge this please? have been passed two weeks since was approved 🙏🏻

@isaacplmann
Copy link
Collaborator

I approved it for the docs changes, but @FrozenPandaz needs to review this to decide if the change makes technical sense and if we want to take on the maintenance of the change, etc.

Sorry if my approval communicated more of a positive indicator than it actually carried. I was just approving to make sure that I wasn't blocking the PR.

@gperdomor
Copy link
Contributor Author

Yeah don't worry @isaacplmann and thank you for your quick response...

Just to clarify, my intention with this change is reduce the dependency on jest using vitest everywhere...
I have a workspace with some shared libraries where I'm using Vitest and some plugins too, the idea is use only one testing library... 😄

@gperdomor gperdomor force-pushed the feature/nx-plugin-unit-tests-vitest branch from eeefd52 to d26265d Compare December 17, 2024 01:27
Copy link

nx-cloud bot commented Dec 17, 2024

Your CI Pipeline Execution ↗ for commit a8be3ff is in progress ⏳

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 35m 5s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 1m 6s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded <1s View ↗
nx-cloud record -- nx format:check --base=a675b... ✅ Succeeded 23s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 22s View ↗
nx documentation --no-dte ✅ Succeeded 41s View ↗

☁️ Nx Cloud last updated this comment at 2024-12-18 21:49:37 UTC

@AgentEnder
Copy link
Member

I believe the generated test files for vitest would not make sense? Vitest requires importing describe, it, etc and those are not imported in the specs. If we want to add this support, we need to make sure that running a generator's tests will work out of the box

@gperdomor
Copy link
Contributor Author

@AgentEnder works without importing describe or other stuff from vitest, I published a local version using verdaccio and create a workspace and new plugins project without issues

@AgentEnder AgentEnder merged commit 3a164a2 into nrwl:master Dec 20, 2024
6 checks passed
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.

[Nx Plugin] Vitest support for nx plugins generators
4 participants