The ability to provide data sets which are fed into a single test.
Those test executions are then considered unique independent tests.
This makes it possible to write smaller tests that cover a broader range of cases.
Such a feature is available in Spock, a Groovy-based test framework.
Re-using the examples from Spock above (obviously with a more limited syntax), it could look something like this:
it('maximum of #a and #b is #c', d => {
expect(Math.max(d.a, d.b)).toBe(d.c);
}, [
{a: 3, b: 5, c: 5},
{a: 7, b: 0, c: 7},
{a: 0, b: 0, c: 0}
]);
I believe this is a core feature as it impacts the test execution, how tests are named, etc.
Data-driven tests will be a part of Jest 23, see https://github.com/facebook/jest/pull/6102
@thymikee just beat me to it!
@rraziel In the meantime jest-each offers the same API being released in Jest 23
Hm getting a requested feature the way I wanted it, before I even submitted the request... not going to complain 馃憤
Most helpful comment
Data-driven tests will be a part of Jest 23, see https://github.com/facebook/jest/pull/6102