Allow ignoring a resolved configuration
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
## Feature Request
AVA should support a way to ignore a resolved configuration, for example a (mono-)repo's `ava.config.js`.
Possible solutions:
- Have configurations in a directory take precedence over a parent configuration (e.g. `"ava"` field in a `package.json` and a root `ava.config.json`)
- Add a `root: boolean` option to configs that specifies not to search for parent configurations
- Add a CLI flag to ignore parent configurations (e.g. `npx ava --ignore-parent-configs`)
- If the resolved configuration contains the current test in its `"ignores"`, skip it
## Rationale
I'm trying to update the examples to AVA 6 (#2993), but they resolve the repo's [`ava.config.js`](https://github.com/avajs/ava/blob/main/ava.config.js) when trying to run them:
```
…/examples/endpoint-testing
$ npx ava
⚠ Using configuration from …/ava.config.js
✘ Couldn’t find any files to test
$ npx ava test.js
⚠ Using configuration from …/ava.config.js
✔ get /user
─
1 tests passed
```
The TypeScript examples have a custom config:
```jsonc
// package.json
"ava": {
"typescript": {
"compile": "tsc",
"rewritePaths": {
"source/": "build/"
}
}
}
```
This results in the tests failing due to conflicting configs:
```
…/examples/typescript-basic
$ npx ava
✘ Conflicting configuration in ../../ava.config.js and package.json
```
Attempting to ignore the examples in `ava.config.js` doesn't work:
```diff
- files: ['test/**', '!test/**/{fixtures,helpers}/**', ...skipWatchMode],
+ files: ['test/**', '!test/**/{fixtures,helpers}/**', '!examples', ...skipWatchMode],
```
Contributor guide
Research direction
Start by reproducing the configuration resolution from the examples/endpoint-testing and examples/typescript-basic directories with `npx ava`; inspect the repository's `ava.config.js` and each example's `package.json`. The work is complete when examples can use their intended configuration without the repository configuration causing missing tests or conflicts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100