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

Change matcher format() to description() #918

Merged
merged 9 commits into from
May 5, 2021
Merged

Conversation

minkimcello
Copy link
Contributor

@minkimcello minkimcello commented Apr 22, 2021

Motivation

Currently if someone wants to construct their own matcher, they have to pass in an object that looks like this:

{
  match(): { /* ... */ },
  format(): { /* ... */ }
}

But with this new refactor, we're renaming format to description:

{
  match(): { /* ... */ },
  description(): { /* ... */ }
}

This will resolve #906.

Approach

  • Instead of changing formatMatcher to descriptionMatcher, I flipped it to say matcherDescription as that seems more descriptive in my opinion.
  • Added changeset for minor bump since we're still on v0.
  • Removed tests for built-in matchers that called matcher().description() as that's not something a user would be invoking themselves.
  • Added test for the matching matcher with the old format API to ensure it still works (but will output a deprecation message in the console).
  • Updated documentation.

TODOs

  • I should probably keep format() in to output a message to say it's deprecated...? Did.

@minkimcello minkimcello added documentation @bigtest/interactor higher order interface manipulation labels Apr 22, 2021
@changeset-bot
Copy link

changeset-bot bot commented Apr 22, 2021

🦋 Changeset detected

Latest commit: 9e4d8b2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@bigtest/interactor Minor
bigtest Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@minkimcello minkimcello added @bigtest/website Issues related to the BigTest website and removed documentation labels Apr 22, 2021
Base automatically changed from mk/docs-reorganized to v0 April 26, 2021 15:55
@minkimcello minkimcello force-pushed the mk/matcher-format-rename branch from e11faf1 to 2bc0425 Compare April 26, 2021 19:42
@minkimcello minkimcello changed the title [WIP] Change matcher format() to description() Change matcher format() to description() Apr 26, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Apr 26, 2021

A preview package of this pull request has been published with the tag mk_matcher-format-rename.
You can try it out by running the following command:

$ npm install @bigtest/interactor@mk_matcher-format-rename

or by updating your package.json to:

{
  "@bigtest/interactor": "mk_matcher-format-rename"
}

Generated by 🚫 dangerJS against 9e4d8b2

@minkimcello minkimcello requested review from jnicklas and cowboyd April 26, 2021 19:48
@minkimcello minkimcello force-pushed the mk/matcher-format-rename branch from 2bc0425 to 9ab6f59 Compare April 26, 2021 19:51
@minkimcello minkimcello marked this pull request as ready for review April 26, 2021 19:53
@minkimcello minkimcello force-pushed the mk/matcher-format-rename branch 2 times, most recently from 4cddaee to 5113db3 Compare April 26, 2021 21:45
@minkimcello minkimcello force-pushed the mk/matcher-format-rename branch from 5113db3 to 9e4d8b2 Compare April 26, 2021 21:48
Copy link
Member

@cowboyd cowboyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@minkimcello minkimcello merged commit f5c117b into v0 May 5, 2021
@minkimcello minkimcello deleted the mk/matcher-format-rename branch May 5, 2021 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@bigtest/interactor higher order interface manipulation @bigtest/website Issues related to the BigTest website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename the format function for matchers
2 participants