Skip to content

[Feature]: Support table syntax for test.each / describe.each #1046

@9aoy

Description

@9aoy

What problem does this feature solve?

Currently, test.each and describe.each only accept an array of test cases. They do not support the table syntax (tagged template literal) that both Jest and Vitest provide:

// This syntax is NOT supported in Rstest yet
it.each`
  email               | name       | expected
  ${'test1@test.com'} | ${'John'}  | ${'test1@test.com'}
  ${'test2@test.com'} | ${'Jane'}  | ${'test2@test.com'}
`('test $expected', ({ email, name, expected }) => {
  // ...
});

This table syntax provides a more readable format for parameterized tests, especially when dealing with multiple parameters. It is widely used in Jest and Vitest test suites, and its absence in Rstest blocks migration from those frameworks.

Referenced from: #85 (comment)

What does the proposed API look like?

Support table syntax for test.each / describe.each.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions