da3f55cb69
- scripts/validate-assets.mjs: walks ASSETS_DIR (default 'assets'), requires every non-sidecar non-.gitkeep non-README file to carry a sibling <name>.provenance.json validating against Zod ProvenanceSchema (6 required fields per CLAUDE.md / AEST-08 + optional provenance_schema_version per RESEARCH Open Question #2). Excludes assets/__samples__/refused/ so the proof-of-gate fixture passes the gate. - assets/__samples__/refused/no-provenance.png: 1x1 transparent PNG with no sidecar; the gate-proof artifact per CONTEXT D-03. - scripts/validate-assets.test.ts: Vitest integration test covering both cases. Positive: real /assets/ tree must exit 0. Negative: per-test-run mkdtemp under os.tmpdir() with one orphan PNG; runs validator with ASSETS_DIR pointing at the tmpdir; asserts exit 1 + clear error message + cleanup in afterAll. No risk of polluting the real /assets/ tree (BLOCKER 2 fix). - vitest.config.ts: extend include glob to also pick up scripts/**/*.test.ts (Rule 3 blocking fix — without this the new test file is invisible to vitest). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
19 lines
684 B
TypeScript
19 lines
684 B
TypeScript
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', 'scripts/**/*.test.ts'],
|
|
passWithNoTests: false,
|
|
globals: false,
|
|
},
|
|
});
|