mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 23:26:39 +03:00
Five representative project shapes under tests/framework-fixtures/ that stage into fresh tmp git repos and drive the live scripts against each: - vite-react: tracked index.html shell + src/App.jsx - nextjs-app: app/layout.tsx as JSX inject target - astro: src/layouts/Layout.astro - sveltekit: src/app.html shell + src/routes/+page.svelte - multipage-with-generator: src/ tracked, dist/ gitignored (our own repo's shape); exercises the is-generated guard and element_not_in_source fallback Each fixture declares its config, expected source/generated paths, and wrap cases in fixture.json. The harness copies into tmpdir, applies gitignore, commits, then asserts: - inject --port lands the script tag at the correct anchor across all configured files - inject --remove strips it cleanly - is-generated classifies source vs generated paths correctly - wrap routes to the expected source file or emits the expected fallback error Plumbing + bug caught while building out the matrix: - IMPECCABLE_LIVE_CONFIG env var so tests can point live-inject at a fixture-specific config.json without clobbering the harness copy. Backwards-compatible. - live-wrap.mjs no longer hardcodes dist/build in its directory skip list. Only node_modules and .git remain universal skips; the isGeneratedFile check is now the sole guard for generated paths. This lets the includeGenerated second pass find elements in dist/ and report generatedMatch, which is what the multipage-with-generator fixture needs to exercise. Wired into bun run test. 25 tests, 5 suites. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Framework fixtures
Representative project shapes for exercising live mode against different framework conventions. Each fixture is a small directory tree that the test harness copies into a temp git repo, then drives live-inject.mjs, live-wrap.mjs, live-accept.mjs, and is-generated.mjs against.
Layout
<fixture>/
files/ project tree the test copies into tmp
gitignore.txt becomes .gitignore in tmp (so we can commit the real files here)
fixture.json config + expected results the test consumes
fixture.json schema:
{
"name": "human-readable label",
"config": { ...contents for live-inject.mjs config.json ... },
"sourceFiles": ["paths that is-generated should classify as source (false)"],
"generatedFiles": ["paths that is-generated should classify as generated (true)"],
"wrapCases": [
{
"name": "description",
"args": { "classes": "...", "tag": "...", "elementId": "..." },
"expectedFile": "where wrap should land (relative to fixture root)",
"expectsError": "optional error code, e.g. element_not_in_source"
}
]
}
Current fixtures
| Fixture | Shape |
|---|---|
vite-react/ |
Tracked index.html shell + src/App.jsx. Inject into the shell. |
nextjs-app/ |
app/layout.tsx as JSX inject target (commentSyntax jsx). |
astro/ |
src/layouts/Layout.astro as inject target. HTML comments. |
sveltekit/ |
src/app.html shell + src/routes/+page.svelte. |
multipage-with-generator/ |
src/ tracked, dist/ gitignored. Exercises the is-generated guard and element_not_in_source fallback. |
Add new fixtures by cloning a directory, swapping files, and updating fixture.json.