Skip to content

Add REGEX masking ability #143

Description

@jackmatt2

In order to help make tests more deterministic - add REGEX masking capability

ie. to mask dates in your output, you might supply the following

expect.mask("\\d{2}-\\d{2}-\d{4}", "**-**-****").toMatchSnapshot(obj)

You can supply multiple masks

expect
  .mask("\\d{2}-\\d{2}-\d{4}", "**-**-****") // mask dates
  .mask("(?m)^$", "** empty line ***\n") // mask empty lines
  .toMatchSnapshot(obj)

Masks can be used to make invisible characters more obvious

expect
  .mask("(?m)^\t+$", "TABS_ONLY") // mask invisible character more obvious
  .toMatchSnapshot(obj)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions