Skip to content

Add a rules to help with the .toMatchNamedSnapshot() matcher usage #1367

@mrazauskas

Description

@mrazauskas

From jestjs/jest#14045 (comment)

The linked PR is about to add .toMatchNamedSnapshot() matcher to Jest. The matcher works similar to .toMatchSnapshot(), but requires setting snapshot name explicitly that allows snapshot testing in concurrent mode (details of the problem jestjs/jest#2180).

After the PR lands, eslint-plugin-jest could be helpful by adding these rules:

  • no-duplicate-snapshot-names: show error if the same snapshot name was used twice in a test file
  • prefer-named-snapshots: require to use .toMatchNamedSnapshot() matcher with test.concurrent (or always)

This is just a note for discussion. No action required at the moment (;

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