Repository navigation
fix(T13874): minCount reads the JSON report vitest 5 announces - #2360
Open
kryptobaseddev wants to merge 2 commits into
Open
kryptobaseddev wants to merge 2 commits into
kryptobaseddev wants to merge 2 commits into
Conversation
vitest 5 with --reporter=json and no outputFile writes .vitest/json/output.json under its own root (the child's cwd) and prints 'JSON report written to <path>'. Behind pnpm --filter <pkg> exec that is the package, not the project root, so every minCount gate failed with 'emitted no machine-readable test report' (VidaPeps T2018-T2022, T781). The gate now also reads the path the run announces, inside the project only, under the same freshness rules (mtime and startTime postdate the spawn). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ement counts Containment was lexical while stat/readFile follow symlinks, so an in-project symlink to a fresh file outside the project was read. Both the announced path and the project root are now realpathed first. Only the last 'JSON report written to' line counts (vitest prints it at the end), so a test's earlier fabricated line cannot stand in for it. Also fixes the T13874 fake runner, which redeclared p/t and could not run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes T13874, the T13782 regression that blocks VidaPeps T2018 to T2022 and T781 on 10.19.
Root cause
I read vitest 5.0.4's JSON reporter in VidaPeps' installed
lib/db/node_modules/vitest, filedist/chunks/cli-api.*.js. With--reporter=jsonand nooutputFile, vitest 5 no longer writes the report to stdout. It writes.vitest/json/output.jsonunder its own config root and then printsJSON report written to <absolute path>.The gate command is
pnpm --filter @workspace/db exec vitest …, so the root islib/db, not the project root. VidaPeps' report is sitting atlib/db/.vitest/json/output.json: 9 tests, all passed, and it satisfiestestCountReportSchema. CLEO only looked at<projectRoot>/.vitest/json/output.json, so everyminCountgate failed with "emitted no machine-readable test report".I ruled out two other suspects:
execstraight through (escapeArgs), so vitest does receive--reporter=json.execinherits stdio by default, so nothing wraps the output.Fix
runTestGatenow also reads every report path the run announces with vitest'sJSON report written to <path>line. Only paths inside the project are read. These paths have no pre-spawn stamp, so the freshness rule still applies: the file's mtime and the report'sstartTimemust both be at or after the spawn.Tests
Three new cases in
packages/core/src/tasks/__tests__/gate-runner.test.ts. Each uses a fake runner thatchdirs intolib/db, writes.vitest/json/output.jsonthere and prints vitest's announce line:startTimepredates the run is refusedNot run locally: owner directive, no local heavy runs. CI runs them, along with tsc and the build. Locally I ran biome on both changed files, gate 32 (
--base origin/main) and gate 38 (--base origin/main), all OK. The changeset is validated only by CI's Changeset Lint.🤖 Generated with Claude Code