mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
1.8 KiB
1.8 KiB
E2E tests
- Read the project's
package.jsonand test config. Inspect resolved targets withCI=1 NX_DAEMON=false pnpm nx show project <name> --json:nx.metadata.playwrightModesgenerates modes, variants, and shards. The aggregatetest:e2ecan also run extra package-script suites. For focused Playwright runs, select an executable test target (a mode/shard target when inferred) and append filters after--(e.g.-- tests/navigation.spec.ts --grep "redirect"). - Check Playwright's
webServer.commandto select dev or production coverage. A mode namedssrcan still start a dev server.e2e/eslint-plugin-startuses Vitest instead of Playwright. - For inferred Playwright modes, Nx builds first and supplies
MODE,E2E_TOOLCHAIN,E2E_DIST_DIR, andE2E_PORT_KEY. Preserve these in server/config changes; let Nx own the build whilewebServer.commandonly starts the selected server. Target generation lives inscripts/nx/playwright-plugin.ts. - Use the same
E2E_PORT_KEY-aware key throughout config, app, and dummy-server setup/teardown. Clean only that key's port files, before allocation, whenTEST_WORKER_INDEX === undefined; worker config reloads must not remap a running server's port. - For new browser tests, reuse the local error-checking fixture. The shared
testfrom@tanstack/router-e2e-utilsfails on unexpectedconsole.error, including hydration errors; allow only expected errors withwhitelistErrors. - HMR/watch tests edit real app sources. Reuse existing edit/restore helpers such as
createHmrFileEditor, restore edits in teardown even after failures, and preserve the suites' single-worker and Nxparallelism: falsesettings. @tanstack/router-e2e-utils:test:unitis a placeholder. Validate helper changes through consuming e2e projects.