Skip to content

Adding operator attribute to assertion error - #1257

Merged
vieiralucas merged 9 commits into
chaijs:masterfrom
rpgeeganage:feature_add_operator
Jun 25, 2019
Merged

vieiralucas merged 9 commits into
chaijs:masterfrom
rpgeeganage:feature_add_operator

Conversation

@rpgeeganage

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented May 23, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #1257 into master will increase coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1257      +/-   ##
=========================================
+ Coverage   94.51%   94.6%   +0.09%     
=========================================
  Files          32      33       +1     
  Lines        1677    1705      +28     
  Branches      405     415      +10     
=========================================
+ Hits         1585    1613      +28     
  Misses         92      92
Impacted Files Coverage Δ
lib/chai/utils/index.js 100% <100%> (ø) ⬆️
lib/chai/assertion.js 100% <100%> (ø) ⬆️
lib/chai/utils/getOperator.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6441f3d...4dbeef1. Read the comment docs.

@rpgeeganage

Copy link
Copy Markdown
Contributor Author

closing till I add tests.

@rpgeeganage rpgeeganage reopened this May 24, 2019
@rpgeeganage

Copy link
Copy Markdown
Contributor Author

@keithamus ,
Please take a peek when you have time, I have added the requested changes in #1253.
Thanks a lot.

@lucasfcosta lucasfcosta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi, @rpgeeganage, 😊

Thanks for the amazing PR, the code looks really good. I just pointed out some details that I think are worth correcting, but I'd love to get this in. Please let me know if I missed something or if there's anything else I can help you with.

Best,
Lucas

Comment thread lib/chai/assertion.js Resolved
Comment thread lib/chai/assertion.js Resolved
Comment thread lib/chai/utils/getOperator.js Resolved
Comment thread lib/chai/utils/getOperator.js Resolved
Comment thread lib/chai/utils/getOperator.js Resolved
Comment thread test/globalErr.js Resolved
Comment thread test/utilities.js Resolved
Comment thread test/utilities.js Resolved
Comment thread test/utilities.js Resolved
@rpgeeganage

rpgeeganage commented May 30, 2019 •

Copy link
Copy Markdown
Contributor Author

@lucasfcosta,
Thank you for reviewing and your valuable comments. I fixed them all and added test cases for array and function.

lucasfcosta
lucasfcosta previously approved these changes Jun 2, 2019

@lucasfcosta lucasfcosta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This LGTM, thank you very much 😊!

Can someone from @chaijs/core give this a last pass?

Comment thread lib/chai/utils/getOperator.js Resolved
@astorije

astorije commented Jun 3, 2019

Copy link
Copy Markdown
Member

Is there something plugin authors who add assertions to the core library (yes I am biased lol) will need to do to support this? If so, does not updating plugins break something, or does it degrade gracefully?

Cheers! 🙏

@keithamus

Copy link
Copy Markdown
Member

@astorije My hope is that this degrades gracefully, but if you want to support it in your plugin you can set via flag(this, 'operator', MYOPERATOR). Flags are backwards compat (in that its just a set and so it becomes a noop on earlier versions that don't know about the key)

@astorije astorije left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice job!

@astorije

astorije commented Jun 9, 2019

Copy link
Copy Markdown
Member

if you want to support it in your plugin you can set via flag(this, 'operator', MYOPERATOR)

I think it would be valuable to have steps listed in the release notes on 1) how to set this in your plugins if necessary and 2) how to check that it worked. Authors may not be familiar with Jest, so being able to correctly assess if that did it or if that's even required at all would be helpful I think.

Either way, nice addition! 🙏

@rpgeeganage

Copy link
Copy Markdown
Contributor Author

Hi everyone,
Thank you for valuable comments and reviews.
Are there any modifications required in this PR?

@lucasfcosta

Copy link
Copy Markdown
Member

Hello @rpgeeganage, I don't think there's any change to the code which is necessary, but as @astorije maybe worth adding information for plugin developers explaining how to use this flag.

Since that can go in the release notes as @astorije recommended I think it's enough to add a brief explanation in the commit body so that we can include it in the release.

I'm happy to get this in as is and the explanation in the commit's body would be very nice.

@rpgeeganage

Copy link
Copy Markdown
Contributor Author

@lucasfcosta ,
Thanks for approving the PR.
Where will be a good place to add a description regarding the 'operator' flag?

@lucasfcosta

Copy link
Copy Markdown
Member

Hi @rpgeeganage, sorry I think my comment was a bit confusing.

Just add it to the body of the commit and we will add it to the release notes when creating the release.

A git commit --amend will open the editor for you to type a message in the first line, then you can keep the same message and jump a line so that you can start writing the commit body.

@rpgeeganage

Copy link
Copy Markdown
Contributor Author

@lucasfcosta ,
Thank you so much for the information. I'll do this asap.

This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants