avajs/ava

Support running a test function multiple times with different data

Open

#2980 aperta il 26 feb 2022

Vedi su GitHub
 (11 commenti) (0 reazioni) (0 assegnatari)JavaScript (1408 fork)batch import
enhancementhelp wantedscope:test-interface

Metriche repository

Star
 (20.600 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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'

Guida contributor