avajs/ava

Support running a test function multiple times with different data

Open

#2,980 建立於 2022年2月26日

在 GitHub 查看
 (11 留言) (0 反應) (0 負責人)JavaScript (20,600 star) (1,408 fork)batch import
enhancementhelp wantedscope:test-interface

描述

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'

貢獻者指南