feat(react): add react + vite + vitest + playwright example#35921
Draft
FrozenPandaz wants to merge 2 commits into
Draft
feat(react): add react + vite + vitest + playwright example#35921FrozenPandaz wants to merge 2 commits into
FrozenPandaz wants to merge 2 commits into
Conversation
The global `test` targetDefault applied jest-only flags (--detectOpenHandles, --forceExit) and NODE_OPTIONS=--experimental-vm-modules to every `test` target, including @nx/vitest ones — which vitest rejects. Each vitest project had to carry a per-project `args` override to strip them. Scope the jest flags to @nx/jest/plugin targets and add a vitest-scoped default (--passWithNoTests), so vitest test targets get correct args without per-project overrides. Remove the now-redundant overrides from @nx/angular-rspack(-compiler) and consolidate the @nx/vite/plugin and @nx/vitest plugin declarations.
Adds examples/react/basic — a React app built with Vite, unit-tested with Vitest, e2e-tested with Playwright, and linted with ESLint. It dogfoods the local @nx/vite, @nx/react, @nx/playwright and @nx/eslint packages via workspace:* links. Wires @nx/vite/plugin inference for examples/react and broadens the @nx/js/typescript exclude to examples/**/* (the vitest test default + plugin scoping come from the preceding commit).
❌ Deploy Preview for nx-docs failed. Why did it fail? →
|
❌ Deploy Preview for nx-dev failed. Why did it fail? →
|
Contributor
|
View your CI Pipeline Execution ↗ for commit 5ff102f
☁️ Nx Cloud last updated this comment at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
There's no React example in the repo that dogfoods the local
@nx/vite/@nx/react/@nx/playwright/@nx/eslintpackages end-to-end.Separately, the global
testtargetDefault applied jest-only options to everytesttarget — including@nx/vitestones:--detectOpenHandles,--forceExit, andNODE_OPTIONS=--experimental-vm-modules. vitest rejects those jest flags (CACError: Unknown option '--detectOpenHandles'), so every vitest project had to carry a per-projecttestoverride to strip them.Expected Behavior
This PR has two commits:
chore(repo): scope test target defaults by plugin (jest vs vitest)@nx/jest/plugintargets, and add a@nx/vitest-scoped default that supplies just--passWithNoTests.testtargets now resolve correct args with no per-project override, so the redundant overrides are removed from@nx/angular-rspackand@nx/angular-rspack-compiler(their tests still pass — 25 and 80 specs respectively; the only real dependency,^build-native, comes from the targetDefault).@nx/vite/pluginand@nx/vitestplugin declarations (drop the deadangular-rspack*vite include).feat(react): add react + vite + vitest + playwright exampleexamples/react/basic— a React app built with Vite, unit-tested with Vitest, e2e-tested with Playwright, and linted with ESLint — all linked to the local workspace packages viaworkspace:*, so it dogfoods the in-repo builds.build,test(2 specs),pw-e2e(chromium, 1 spec),lint,typecheck. Workspacenx sync:checkclean.Related Issue(s)
Tracked in NXC-4540 (linked via branch name).