avajs / avajs/ava

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

Open
#1,986 12 comments 1 reaction 0 assignees View on GitHub
:dollar: Funded on Issuehunt enhancement help wanted
Dominant language
JavaScript
Stars
20.8k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

[Issuehunt badges](https://oss.issuehunt.io/r/avajs/ava/issues/1986)

Just trying out AVA instead of Jest in a new monorepo project. I am configuring testing to be run as a pre-commit hook using `husky` and `lint-staged`.

I've run into a problem getting the appropriate tests run by `ava` during a commit. Previously, I would use `lint-staged` which would pass the changed files as arguments to `jest` and using the `--findRelatedTests` flag, jest would run only the tests that covered those files.

Trying to do something similar with `ava` has left me at a dead-end. If I try to use `lint-staged` to run `ava`, it passes a list of changed files and `ava` tries to run them as tests which fails. The alternative is simply to run the entire test suite, which will become inefficient as the project grows.

Any thing I'm missing, or thoughts on how to run appropriate `ava` tests as part of a pre-commit process?

---

IssueHunt Summary

### Backers (Total: $80.00)

- [issuehunt issuehunt](https://oss.issuehunt.io/u/issuehunt) ($80.00)

### Submitted pull Requests
- [#3443 Add related test selection](https://oss.issuehunt.io/r/avajs/ava/pull/3443)
- [#3459 Add related test selection](https://oss.issuehunt.io/r/avajs/ava/pull/3459)
---

#### [Become a backer now!](https://oss.issuehunt.io/r/avajs/ava/issues/1986)
#### [Or submit a pull request to get the deposits!](https://oss.issuehunt.io/r/avajs/ava/issues/1986)
### Tips

- Checkout the [Issuehunt explorer](https://oss.issuehunt.io/r/avajs/ava/) to discover more funded issues.
- Need some help from other developers? [Add your repositories](https://oss.issuehunt.io/r/new) on IssueHunt to raise funds.

Contributor guide

Open the contributing guide

Research direction

The issue does not name specific files or tests. Start by reviewing AVA's existing command-line test selection and compare it with Jest's --findRelatedTests behavior, then inspect how husky and lint-staged pass changed files. Done means changed source files trigger only their relevant tests, rather than being treated as test files, with coverage for the dependency-analysis behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.