From 4536987915023fdaee8f0c289ae02b42704092ea Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Thu, 11 Jun 2026 01:43:26 -0400 Subject: [PATCH] chore(07-01): isolate vitest glob from e2e, add tsconfig.e2e.json typecheck gate - Add exclude: ['e2e/**', 'node_modules/**'] to vitest.config.ts test block to prevent Playwright specs from being picked up by Vitest jsdom runner - Add tsconfig.e2e.json extending main tsconfig with node types for playwright.config.ts and e2e/**/* typecheck coverage - Add @types/node to pwa devDependencies (required by playwright.config.ts) - Update typecheck script to run both src and e2e tsc passes - 191 unit tests still pass; no e2e import errors in vitest run --- apps/pwa/package.json | 3 ++- apps/pwa/tsconfig.e2e.json | 9 +++++++++ apps/pwa/vitest.config.ts | 5 +++++ pnpm-lock.yaml | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 apps/pwa/tsconfig.e2e.json diff --git a/apps/pwa/package.json b/apps/pwa/package.json index 59330c0..ceef5f5 100644 --- a/apps/pwa/package.json +++ b/apps/pwa/package.json @@ -7,7 +7,7 @@ "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", - "typecheck": "tsc --noEmit", + "typecheck": "tsc --noEmit && tsc --project tsconfig.e2e.json --noEmit", "test": "vitest run", "test:e2e": "playwright test", "test:e2e:ui": "playwright test --ui", @@ -37,6 +37,7 @@ "@playwright/test": "1.60.0", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.3.0", + "@types/node": "^22.19.19", "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", "@vitejs/plugin-react": "^4.3.0", diff --git a/apps/pwa/tsconfig.e2e.json b/apps/pwa/tsconfig.e2e.json new file mode 100644 index 0000000..3db8cd2 --- /dev/null +++ b/apps/pwa/tsconfig.e2e.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "types": ["node"], + "lib": ["ES2023"] + }, + "include": ["playwright.config.ts", "e2e/**/*"], + "exclude": ["node_modules"] +} diff --git a/apps/pwa/vitest.config.ts b/apps/pwa/vitest.config.ts index 8522efa..992e6b6 100644 --- a/apps/pwa/vitest.config.ts +++ b/apps/pwa/vitest.config.ts @@ -10,5 +10,10 @@ export default defineConfig({ // With TZ=UTC, new Date('2026-06-10T23:30:00-04:00').getFullYear() etc. return the // UTC wall-clock values, making assertions stable across EDT/PST/UTC environments. env: { TZ: 'UTC' }, + // Prevent Vitest's default **/*.{test,spec}.ts glob from picking up + // apps/pwa/e2e/*.spec.ts files, which import @playwright/test APIs + // (devices, etc.) that are not available in the jsdom environment. + // See Phase 7 RESEARCH.md §Pitfall 1. + exclude: ['e2e/**', 'node_modules/**'], }, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 52db3ee..41eb3f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -132,6 +132,9 @@ importers: '@testing-library/react': specifier: ^16.3.0 version: 16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.16))(@types/react@19.2.16)(react-dom@19.2.7(react@19.2.7))(react@19.2.7) + '@types/node': + specifier: ^22.19.19 + version: 22.19.19 '@types/react': specifier: ^19.0.0 version: 19.2.16