Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add REGEX masking ability #143

Open
jackmatt2 opened this issue Jan 24, 2023 · 0 comments
Open

Add REGEX masking ability #143

jackmatt2 opened this issue Jan 24, 2023 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@jackmatt2
Copy link
Member

jackmatt2 commented Jan 24, 2023

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)
@jackmatt2 jackmatt2 added the help wanted Extra attention is needed label Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant