fix(887): a second config file outranks the pinned one — found by probing vitest itself
Pinning `web/vite.config.ts`'s `test:` block is worthless while a file that takes precedence over it can simply be added. Vitest resolves `vitest.config.*` (and `vitest.workspace.*` / `vitest.projects.*`) BEFORE `vite.config.*`. MEASURED, not read: dropping a `web/vitest.config.ts` carrying `include: ['nope/**'], passWithNoTests: true` beside the pinned file made `npx vitest run` report "No test files found, exiting with code 0". The gating step would be green having run NOTHING — worse than the filtered run ersatztv#887 removed, because a filtered suite at least reports on what it ran. The construct is refused rather than modelled: no such file exists, so the guard asserts none appears. Its population is the git INDEX, which is right and worth stating — an untracked config does not exist in a CI checkout either, so the mutant proving this has to STAGE the file. It failed to redden until it did, which is the correct behaviour demonstrating itself. Route count five -> six -> seven -> eight, wrong at every previous count, so it stays a running total with its history attached. Battery 60 -> 61, 0 missed. Refs: #887 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019T79beF1Ufid3dXju4yqkF
This commit is contained in:
@@ -45,17 +45,22 @@ pin and reddens.
|
||||
WHAT A PIN IS AND IS NOT IMMUNE TO, stated precisely because an earlier version of this paragraph
|
||||
claimed the absolute "a pin cannot have a false green" and cold review refuted it by execution. A
|
||||
pin is immune to the class that defeated the parser: a DIFFERENT SPELLING of the command. It is not
|
||||
immune to the same text MEANING something else. SEVEN such routes have been IDENTIFIED, and that
|
||||
number is a running total, not a proof: it was written as five, then six, and both were wrong when
|
||||
checked. Six are handled — `working-directory` and the gating step's own `shell:`; the workflow
|
||||
immune to the same text MEANING something else. EIGHT such routes have been IDENTIFIED, and that
|
||||
number is a running total, not a proof: it was written as five, then six, then seven, and each was
|
||||
wrong when checked. Six are handled — `working-directory` and the gating step's own `shell:`; the workflow
|
||||
`defaults.run.shell` and the job-level `defaults` that would override it; a stage `SHELL`, refused
|
||||
outright; `web/package.json`'s script map, pinned WHOLE after selecting on the literal `vitest`
|
||||
missed `npm run test`, `npm t`, and the `prebuild`/`preinstall` LIFECYCLE HOOKS npm runs for
|
||||
`npm run build` and `npm ci`; `web/vite.config.ts`'s `test:` block, which decides what the suite
|
||||
COLLECTS and is where a filter would now naturally be written; and the gating job's `container:`
|
||||
image, pinned by `test_ci_image_pin_population.py` and CITED rather than re-asserted, because two
|
||||
guards on one condition mask each other (ersatztv#685). The seventh, an `ENV` rewriting `PATH` so a
|
||||
pinned `RUN` resolves a different `npm`, is not modelled and is stated as a residual.
|
||||
COLLECTS and is where a filter would now naturally be written; the ABSENCE of any
|
||||
`vitest.config.*`/`vitest.workspace.*`/`vitest.projects.*`, which vitest resolves in PREFERENCE to
|
||||
that file — pinning one config is worthless while a second can outrank it, and the measured effect
|
||||
of adding one was a run that collected zero specs and exited 0, which is worse than a filtered one;
|
||||
and the gating job's `container:` image, pinned by `test_ci_image_pin_population.py`
|
||||
and CITED rather than re-asserted, because two guards on one condition mask each other (#685).
|
||||
|
||||
The eighth, an `ENV` rewriting `PATH` so a pinned `RUN` resolves a different `npm`, is not modelled
|
||||
and is stated as a residual.
|
||||
|
||||
So: the pin removes the SPELLING problem outright and reduces the MEANING problem to a list that can
|
||||
be worked through — a much better place than a predicate that was wrong nine times. It is not
|
||||
@@ -201,6 +206,13 @@ PINNED_PACKAGE_SCRIPTS: dict[str, str] = {
|
||||
# `--exclude`s, the FIRST place anyone reaching for one would now look. The `test:` block is pinned
|
||||
# for the same reason the script map is.
|
||||
VITE_CONFIG = "web/vite.config.ts"
|
||||
# Vitest resolves its OWN config in preference to `vite.config.*`, so a `web/vitest.config.ts` beside
|
||||
# the pinned file silently replaces the block below. MEASURED: adding one with
|
||||
# `include: ['nope/**'], passWithNoTests: true` made `npx vitest run` report
|
||||
# "No test files found, exiting with code 0" — the gating step green having run NOTHING, and the
|
||||
# image published. Pinning one file is worthless while a second can outrank it, so the absence of
|
||||
# every higher-precedence spelling is asserted rather than assumed.
|
||||
VITEST_CONFIG_PREFIXES = ("vitest.config.", "vitest.workspace.", "vitest.projects.")
|
||||
PINNED_VITE_TEST_BLOCK = """test: {
|
||||
environment: 'jsdom',
|
||||
environmentOptions: {
|
||||
@@ -686,6 +698,29 @@ def test_the_npm_SCRIPT_MAP_is_exactly_what_was_reviewed() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_NO_OTHER_vitest_CONFIG_outranks_the_pinned_one() -> None:
|
||||
"""A pinned config is worthless if a second file can take precedence over it.
|
||||
|
||||
Vitest prefers `vitest.config.*` (and `vitest.workspace.*`/`vitest.projects.*`) to
|
||||
`vite.config.*`. MEASURED: dropping a `web/vitest.config.ts` with `include: ['nope/**']` and
|
||||
`passWithNoTests: true` beside the pinned file made the suite collect zero specs and exit 0 — the
|
||||
gating step green having run nothing at all, which is worse than the filtered run ersatztv#887
|
||||
removed. The construct is refused rather than modelled: there is no such file today, so the
|
||||
honest move is to assert none appears.
|
||||
"""
|
||||
intruders = sorted(
|
||||
path
|
||||
for path in tracked_files._git_ls_files()
|
||||
if path.startswith("web/") and path.rpartition("/")[2].startswith(VITEST_CONFIG_PREFIXES)
|
||||
)
|
||||
assert not intruders, (
|
||||
f"these files outrank the pinned `{VITE_CONFIG}` in vitest's config resolution: {intruders}. "
|
||||
f"Whatever they say about `include`/`exclude` decides which specs the gating run collects, "
|
||||
f"and the pin on `{VITE_CONFIG}` cannot see it — a suite that collects nothing still exits 0. "
|
||||
f"Either fold the settings into `{VITE_CONFIG}` and its pin, or pin this file too."
|
||||
)
|
||||
|
||||
|
||||
def test_the_VITE_TEST_BLOCK_is_exactly_what_was_reviewed() -> None:
|
||||
"""`npm test -- --run` collects what this config says; "unfiltered" is otherwise unverified.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user