Skip to content

Provide plugins to pretty-format in jest-each #7805

@billyjanitsch

Description

@billyjanitsch

🚀 Feature Proposal

Provide a default set of plugins to jest-each's use of pretty-format.

Motivation

jest-snapshot provides a default set of plugins to pretty-format, which are used during formatting of expect().toMatchSnapshot().

jest-each also uses pretty-format to format programmatic test titles (added in #6357), but does not provide any plugins to pretty-format. So, for example, something like this doesn't work:

test.each([
  <Button />,
  <Button active />,
])('renders %p', element => {
  // ... test goes here
})

Because pretty-format isn't invoked with the ReactElement plugin.

It would be nice if it was invoked with the same set of default plugins as in jest-snapshot.

Example

See above.

Pitch

Why does this feature belong in the Jest core platform?

For consistency between jest-snapshot and jest-each.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions