Skip to content

[jest-emotion] snapshots show every style changed when any html attribute or style changes #1847

Closed
@Jimmydalecleveland

Description

@Jimmydalecleveland

Current behavior:

Snapshot errors do not show only the changed styles or attributes of a styled component when using the snapshotSerializer.

To reproduce:
Here is a minimal repo I created with the snapshot failure committed. Simply install (I'm using yarn) and run yarn test to see it.
emotion-snapshot-issue-reproduction

  1. Update snapshots
  2. Change any style or html attribute (such as the id value)
  3. Snapshot will fail as expected but show that every style in the component has changed

Expected behavior:

Snapshots should only show diff lines for the things that changed in a component. This used to be the behavior for all our tests but at some point it changed. I'm sorry I can't figure out when, despite trying.

Environment information:

  • react version: ^16.12.0
  • @emotion/core version: ^10.0.27
  • @emotion/styled version: ^10.0.2
  • jest-emotion version: ^10.0.27

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions