diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..f89bb1a --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,16 @@ +import { defineConfig } from '@playwright/test'; + +// Phase 1: Playwright is installed and configured but ships no specs. +// First spec lands in Phase 2 (PIPE-07) — a smoke test that asserts the +// "Tend the garden / Begin" gesture screen mounts and CORE-01 (game loads +// in <5s) holds. This config exists so Plan 01 proves Playwright is wired. +export default defineConfig({ + testDir: 'tests/e2e', + use: { baseURL: 'http://localhost:5173' }, + webServer: { + command: 'npm run dev', + url: 'http://localhost:5173', + reuseExistingServer: true, + timeout: 30_000, + }, +}); diff --git a/src/__sentinel__.test.ts b/src/__sentinel__.test.ts new file mode 100644 index 0000000..235b2e9 --- /dev/null +++ b/src/__sentinel__.test.ts @@ -0,0 +1,18 @@ +import { describe, it, expect } from 'vitest'; + +// Phase 1 sentinel test. +// +// This test exists purely to prove the test infrastructure is wired: +// - vitest can find and run *.test.ts files, +// - the happy-dom environment is active (so Plan 03 can rely on `window` +// for its IndexedDB-via-fake-indexeddb tests). +// +// Delete this file once real tests exist (Plan 03 onward). +describe('phase-1 test infrastructure sentinel', () => { + it('vitest is wired and the happy-dom environment is active', () => { + expect(1 + 1).toBe(2); + // happy-dom provides `window` in the test env, which save tests will rely on + // for IndexedDB. Assert it exists so Plan 03 can trust the env. + expect(typeof globalThis.window).toBe('object'); + }); +}); diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..d0bff50 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from 'vitest/config'; + +// Phase 1 test infrastructure config. +// +// `happy-dom` is the chosen DOM env because Plan 03's IndexedDB tests will +// use happy-dom together with `fake-indexeddb/auto` (happy-dom does not ship +// IndexedDB). RESEARCH § Validation Architecture explicitly calls for this. +// +// `passWithNoTests: false` enforces RESEARCH CI Pitfall B — a green CI run +// must mean tests *ran*, not "no tests existed". +export default defineConfig({ + test: { + environment: 'happy-dom', + include: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'scripts/**/*.test.mjs'], + passWithNoTests: false, + globals: false, + }, +});