Files
Jason Jean 71436fbee8 feat(repo): add react + vite + vitest + playwright example (#35921)
## 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).

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2026-07-17 17:04:29 -04:00

36 lines
1.0 KiB
JSON

{
"name": "examples-react-basic",
"version": "0.0.1",
"private": true,
"scripts": {
"postinstall": "cd ../../.. && pnpm nx run-many -t build -p nx vite react playwright eslint eslint-plugin",
"validate": "nx run-many -t lint,test,build,e2e"
},
"nx": {
"includedScripts": []
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@nx/vite": "link:../../../packages/vite",
"@nx/react": "link:../../../packages/react",
"@nx/playwright": "link:../../../packages/playwright",
"@nx/eslint": "link:../../../packages/eslint",
"@nx/eslint-plugin": "link:../../../packages/eslint-plugin",
"@playwright/test": "^1.36.0",
"@testing-library/react": "16.3.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^6.0.0",
"eslint": "^9.39.4",
"jsdom": "^26.1.0",
"typescript": "~5.9.2",
"typescript-eslint": "^8.58.2",
"vite": "^8.0.0",
"vitest": "^4.0.0",
"nx": "link:../../../packages/nx"
}
}