avajs/ava

Support running a test function multiple times with different data

Open

#2.980 geöffnet am 26. Feb. 2022

Auf GitHub ansehen
 (11 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (20.600 Stars) (1.408 Forks)batch import
enhancementhelp wantedscope:test-interface

Beschreibung

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