Skip to content

impact, test-impact: a script-style test counts as a test and runs by its own command - #1729

Merged
swapnilpaliwal-sd merged 2 commits into
0.1.7from
loop/to-t2-1
Sep 29, 2026
Merged

swapnilpaliwal-sd merged 2 commits into
0.1.7from
loop/to-t2-1

Conversation

@swapnilpaliwal-sd

@swapnilpaliwal-sd swapnilpaliwal-sd commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

A test-tree file that runs as a plain program with no test framework (a runner calling runCase at top level, a tests/check.py with a main guard) was reached and labelled [test], but still counted tests: 0 of N, and test-impact said no test reaches the change.

  • Impact's exporter and the hooks' fast path now read one rule (graph_sql.script_tests), so both count these scripts and test-impact selects them.
  • Run command: the package script or usage line that runs the file. Failing that, the interpreter, but only for a file with a main guard. An unguarded file nothing runs is reported as run by nothing, as in test-impact: the TypeScript command is npx vitest run on files vitest does not collect #1570. No test framework is guessed.
  • Helpers, setup/config files and test data are not counted as scripts.
  • Impact facts version moves to 40. Also fixes a shadowed G.enclosing that crashed changed <file> on a top-level lambda.
  • Checked: held-out runner goes from 0 of 1 to 1 of 2 with npm run test. This repo's graph_sql.py edit now selects tests/fastpath.py. Control is unchanged on two real Express apps (88/113, 2/113, 0/9, 0/9). Golden suite: 753/761; all 7 failures also fail on 0.1.7, which fails 6 more lambda checks. script_tests, fastpath, test_command and freshness pass. changed_range has the same 4 failures as on 0.1.7.

swapnilpaliwal-sd and others added 2 commits September 28, 2026 18:17
… its own command

A test-tree file run as a program with no framework (a runner calling runCase at
top level, a tests/check.py with a main guard) was walked to and labelled [test],
then counted "0 of 0", and test-impact said no test reaches the change. Its module
is now in test_method, from one rule (graph_sql.script_tests) that the exporter and
the hooks' fast path both read, so impact counts it and test-impact selects it.
The command is the one the project runs it by: its package script, its usage line,
else the interpreter; never a guessed framework. Helpers that export, setup and
config files, and test data (cases/, fixture projects under src/, tools/) are not
scripts. The impact facts version moves to 40 so a cached export is rebuilt.

Also: axiomcode-path declared G.enclosing twice, the second shadowing the first,
so `changed <file>` without git crashed on a top-level lambda. The file:line form
is now G.enclosing_at.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
…ds its own entry

An unguarded script test that no package script or usage line names was handed
to node or npx tsx, which undid #1570 (a file nothing runs is said so). It still
counts and is selected; only a file with require.main === module, import.meta.main
or a __main__ guard gets its interpreter as the command.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
@swapnilpaliwal-sd
swapnilpaliwal-sd merged commit 87a5441 into 0.1.7 Sep 29, 2026
11 checks passed
@swapnilpaliwal-sd
swapnilpaliwal-sd deleted the loop/to-t2-1 branch September 29, 2026 01:18
@swapnilpaliwal-sd swapnilpaliwal-sd mentioned this pull request Sep 29, 2026
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.

1 participant