Skip to content

feat(react): add react + vite + vitest + playwright example#35921

Draft
FrozenPandaz wants to merge 2 commits into
masterfrom
feature/nxc-4540-add-react-vite-vitest-playwright-example
Draft

feat(react): add react + vite + vitest + playwright example#35921
FrozenPandaz wants to merge 2 commits into
masterfrom
feature/nxc-4540-add-react-vite-vitest-playwright-example

Conversation

@FrozenPandaz

Copy link
Copy Markdown
Contributor

Current Behavior

There's no React example in the repo that dogfoods the local @nx/vite / @nx/react / @nx/playwright / @nx/eslint packages end-to-end.

Separately, the global test targetDefault applied jest-only options to every test target — including @nx/vitest ones: --detectOpenHandles, --forceExit, and NODE_OPTIONS=--experimental-vm-modules. vitest rejects those jest flags (CACError: Unknown option '--detectOpenHandles'), so every vitest project had to carry a per-project test override to strip them.

Expected Behavior

This PR has two commits:

chore(repo): scope test target defaults by plugin (jest vs vitest)

  • Scope the jest flags to @nx/jest/plugin targets, and add a @nx/vitest-scoped default that supplies just --passWithNoTests.
  • Vitest test targets now resolve correct args with no per-project override, so the redundant overrides are removed from @nx/angular-rspack and @nx/angular-rspack-compiler (their tests still pass — 25 and 80 specs respectively; the only real dependency, ^build-native, comes from the targetDefault).
  • Consolidate the @nx/vite/plugin and @nx/vitest plugin declarations (drop the dead angular-rspack* vite include).

feat(react): add react + vite + vitest + playwright example

  • Add examples/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 via workspace:*, so it dogfoods the in-repo builds.
  • Targets verified: build, test (2 specs), pw-e2e (chromium, 1 spec), lint, typecheck. Workspace nx sync:check clean.

Related Issue(s)

Tracked in NXC-4540 (linked via branch name).

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).
@FrozenPandaz FrozenPandaz requested a review from a team as a code owner June 9, 2026 21:09
@FrozenPandaz FrozenPandaz requested a review from JamesHenry June 9, 2026 21:09
@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs failed. Why did it fail? →

Name Link
🔨 Latest commit 5ff102f
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6a28811b295ae60008fba074

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev failed. Why did it fail? →

Name Link
🔨 Latest commit 5ff102f
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6a28811b0c9aad0008a3bc40

@nx-cloud

nx-cloud Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 5ff102f

Command Status Duration Result
nx-cloud record -- nx sync:check ❌ Failed 8s View ↗
nx-cloud record -- nx format:check ❌ Failed 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-09 21:12:46 UTC

@FrozenPandaz FrozenPandaz marked this pull request as draft June 9, 2026 21:39
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.

1 participant