Support running a test function multiple times with different data
Open
enhancement
help wanted
scope:test-interface
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
You can already do this with macros, but it's a bit verbose and complicated. It would be nice to simplify the common case of just running the same test over an array of fixtures.
Possible API:
```js
test('validate email', t => {
console.log(t.data);
t.true(isString(t.data));
})
.data([
'foo',
'bar'
]);
//=> 'foo'
//=> 'bar'
```
Contributor guide
Research direction
Start by reviewing AVA's existing macro support and test-runner API; the issue does not name specific files or tests. Done means a concise data-driven API runs the same test once per array fixture and makes each fixture available as t.data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100