Skip to content

Add related test selection - #3459

Open
q36zhd46w17o wants to merge 1 commit into
avajs:mainfrom
q36zhd46w17o:codex/ava-1986-related-tests
Open

Add related test selection#3459
q36zhd46w17o wants to merge 1 commit into
avajs:mainfrom
q36zhd46w17o:codex/ava-1986-related-tests

Conversation

@q36zhd46w17o

@q36zhd46w17o q36zhd46w17o commented Jun 16, 2026

Copy link
Copy Markdown

Fixes #1986.

IssueHunt bounty: https://issuehunt.io/repos/26820798/issues/1986

Summary

  • add --find-related-tests so positional paths can be treated as changed source files for lint-staged / Jest-like workflows
  • reuse AVA's existing watch-mode dependency tracer to select test files that depend on changed source files
  • run changed test files directly and conservatively run all configured tests when AVA cannot determine the dependency relationship
  • document the new command-line mode and cover source, test, absolute-path, multi-file, and error cases with fixtures

Verification

  • npx test-ava test/related-tests/test.js
  • npx test-ava test/watch-mode/scenarios.js
  • npx tap test-tap/integration/assorted.js test-tap/integration/debug.js
  • npx tap test-tap/globs.js
  • npx xo (exits 0; existing TODO/FIXME warnings only)
  • npx tsc --noEmit
  • git diff --check
  • npm test

Bounty criteria

This PR implements the requested ability to pass changed source files and have AVA determine the related test files to run. It is submitted for the IssueHunt-funded issue above.


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


@q514168795

Copy link
Copy Markdown

I'll review how the dependency tracer handles edge cases like dynamic imports during fallback resolution to ensure unmapped test files aren't inadvertently skipped. I'll also verify that the new --find-related-tests CLI option integrates cleanly with existing watch-mode configurations.

/claim

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.

Analyze source & test dependencies to figure out which tests to run (first)

2 participants