avajs/ava

Support running a test function multiple times with different data

Open

#2,980 opened on Feb 26, 2022

View on GitHub
 (11 comments) (0 reactions) (0 assignees)JavaScript (1,408 forks)batch import
enhancementhelp wantedscope:test-interface

Repository metrics

Stars
 (20,600 stars)
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:

test('validate email', t => {
	console.log(t.data);
	t.true(isString(t.data));
})
.data([
	'foo',
	'bar'
]);
//=> 'foo'
//=> 'bar'

Contributor guide