Skip to content

test(fixtures): fail when a required fixture group is missing - #267

Merged
karagozemin merged 2 commits into
Sub-Rosa-Issue:mainfrom
leocagli:test/required-fixture-groups
Aug 31, 2026
Merged

test(fixtures): fail when a required fixture group is missing#267
karagozemin merged 2 commits into
Sub-Rosa-Issue:mainfrom
leocagli:test/required-fixture-groups

Conversation

@leocagli

Copy link
Copy Markdown

Closes #248

A configured group that resolved to a missing or empty directory took the [SKIP] path and the process still exited 0. Deleting a whole fixture group therefore disabled, in silence, the size budget that was meant to guard it.

The change

Every group configured in GROUPS is now required. The two failure paths are reported separately, on purpose: they are fixed differently, one by restoring the directory and the other by repopulating it, and a single shared message would send you to go look which one it was.

[FAIL] Receipt fixtures — required fixture directory is missing: services/receipt-cli/src/fixtures
[FAIL] Demo trace outputs — required fixture directory has no matching files: apps/web/src/demo (expected files matching /\.(ts|js)$/)

The empty-directory message names the include pattern, because a directory that looks populated can still be empty for this group if nothing matches the extension.

A related bug found on the way

walk() caught every error and treated it as "directory does not exist":

} catch {
  // directory does not exist
}

So a permissions error read as an absent directory, which fed the same silent SKIP. Now only ENOENT and ENOTDIR are swallowed, which are the ones that legitimately occur while walking a tree. Anything else propagates.

Tests

Six tests, all passing. The new ones build a temporary project fixture with the three configured groups and then remove or empty one:

✔ exits 0 when all fixture sizes are within budget
✔ reports all three fixture groups
✔ passes on a temporary project where every required group is present
✔ fails when a required group directory is missing
✔ fails when a required group directory exists but has no matching files
✔ tells the two failure paths apart
ℹ tests 6 · pass 6 · fail 0

The missing-directory test also asserts [SKIP] no longer appears, so the old behavior cannot come back unnoticed. The happy-path test on a temporary project matters too: without it, a change that made every group fail would still pass the two failure tests.

Scope

No fixture contents and no budgets were touched. node scripts/check-fixture-sizes.mjs still exits 0 on this repository.

🤖 Generated with Claude Code

Closes Sub-Rosa-Issue#248

Un grupo configurado en GROUPS que resolvia a un directorio ausente o vacio
salia por [SKIP] y el proceso terminaba en 0. O sea que borrar un grupo
entero desactivaba en silencio el presupuesto de tamaño que lo cuidaba.

Ahora todo grupo configurado es obligatorio, y los dos casos se informan
por separado porque se arreglan distinto: uno se restaura y el otro se
repuebla.

De paso, el catch de walk() se tragaba cualquier error. Un permiso denegado
se veia igual que un directorio ausente. Ahora solo se ignoran ENOENT y
ENOTDIR, que son los normales al recorrer en profundidad.

Sin cambios en contenidos de fixtures ni en presupuestos.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@karagozemin
karagozemin merged commit 37ab212 into Sub-Rosa-Issue:main Aug 31, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(fixtures): fail when a required fixture group is missing

2 participants