Skip to content

Optionally hide whitespace changes in diff #8626

@yassinecc

Description

@yassinecc

🚀 Feature Proposal

Add a CLI option to ignore whitespace changes when displaying diffs.

Motivation

When using Jest snapshots, Jest reports in case of failure the diff between expected and received outputs. In some cases, the snapshot is so large that adding a top level node in the snapshot results in a huge, unreadable diff (over say 10000 lines), while the change in itself is minimal.

Example

Would be nice to have an option like jest --ignore-whitespace

Pitch

Why does this feature belong in the Jest core platform?

Common feature proposals that do not typically make it to core:

  • New matchers (see jest-extended)
  • Changes to the default reporter (use custom reporters instead)
  • Changes to node/jsdom test environments (use custom environments instead)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions