Skip to content

fix(impact): cover a program the test script runs directly - #306

Merged
adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/impact-test-script-programs
Nov 18, 2026
Merged

adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/impact-test-script-programs

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Fixes #305

A changed JavaScript or TypeScript file that the root test closure runs with an interpreter is now covered:

  • Detection. testScriptPrograms in file-references.ts lists the programs the closure runs, with the phases that run them: node, tsx, ts-node and bun, after flags such as --import x, and through npx. node --test, node -e and similar run no program file.
  • Covered files. In impact.ts, coverTestScriptPrograms checks the changed file, and every file that imports it, against that list.
  • Phase. A caller that runs test-script phases (selectTestPhases, as verify and the agent tools do) runs the phase when it can run alone, like the existing data-file phases.
  • Fallback. Otherwise the change falls back with The test script runs …; full validation required or The test script runs …, which imports …; full validation required. Both are added to the fallback table in docs/using-diffci.md.

Scripts the test script does not run, and ordinary source changes, select exactly as before.

Validation:

  • tests/repo/test-script-programs.test.ts (listed in release-files.json):
    • The 5 cases for a program the test script runs fail on main and pass here: before or after the runner, through another script, an imported module, without a tsconfig, and as a phase.
    • The 2 cases for an unrun script and a source change pass on both.
    • A unit case covers testScriptPrograms.
  • The repro from the issue was SELECTIVE on main, with no reason. Here it is FULL with The test script runs scripts/check.mjs; full validation required.
  • npm run typecheck, npm run build, npm run audit:boundary, npm run agent:check and npm test (1175 pass).

Unsupported:

  • Only the root package.json closure is read, as for the data-file phases. A workspace package's own test script is not.
  • A phase after cd, or with arguments after the program, falls back rather than running as a phase.
  • The published CLI picks this up when it next pins a Core commit that includes it.

A changed file that the root test script runs with an interpreter
("node scripts/check.mjs && node --test"), or code it imports, was only
an affected entry point: no test imports it, so the selection skipped it
and verify passed while npm test failed. It now runs that test-script
phase for callers that run phases, and the full suite otherwise.

Signed-off-by: FredApps <[email protected]>
…ffCI#246

The manifest is an unordered set, and the PRs listed above add their entries at the same line. Moving this entry one line away lets them merge in either order without a conflict.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 01:07
@adityankale190895
adityankale190895 merged commit 6c033cd into DiffCI:main Nov 18, 2026
13 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.

Impact: a script the test script runs directly (node scripts/check.mjs && node --test) is skipped, so verify passes while npm test fails

2 participants