-
Notifications
You must be signed in to change notification settings - Fork 776
Closed
Labels
Category: APIComponent: CoreFor module, test, hooks, and reporters.For module, test, hooks, and reporters.Type: EnhancementNew idea or feature request.New idea or feature request.Type: MetaSeek input from maintainers and contributors.Seek input from maintainers and contributors.
Milestone
Description
Many test frameworks offer ways to avoid test duplication by allowing parameters to be passed into a test. For example, Jest offers test.each:
test.each([
[1, 1, 2],
[1, 2, 3],
[2, 1, 3],
])('.add(%i, %i)', (a, b, expected) => {
expect(a + b).toBe(expected);
});TestNG (a Java test framework) offers the DataProviders which use decorators to attach data sources to tests.
It makes sense for QUnit to offer the same feature.
Sample implementation
Open questions
- Jest offers the possibility of customizing the test name by providing
printf-like parameters (using Node'sutil.format); - Jest also offers a
describe.each. I personally the benefit of this feature, but we should consider implementing our version ofmodule.each.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Category: APIComponent: CoreFor module, test, hooks, and reporters.For module, test, hooks, and reporters.Type: EnhancementNew idea or feature request.New idea or feature request.Type: MetaSeek input from maintainers and contributors.Seek input from maintainers and contributors.