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

Freeze the top-level expect #517

Merged
merged 2 commits into from Sep 29, 2018
Merged

Freeze the top-level expect #517

merged 2 commits into from Sep 29, 2018

Conversation

papandreou
Copy link
Member

As discussed on #476

Copy link
Member

@alexjeffburke alexjeffburke left a comment

Choose a reason for hiding this comment

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

Big 👍 from me - I think this removes a sizeable footgun for those using the library the first time.

I do wonder if we want to add a task to revise the sections talking about adding assertions and using plugins to make this new reality clear.

@sunesimonsen sunesimonsen added this to the v11 milestone Sep 29, 2018
topLevelExpect.addAssertion('<any> to foo', function() {});
},
'to throw',
'Cannot add an assertion to a frozen instance, please run .clone() first'
Copy link
Member

Choose a reason for hiding this comment

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

I think this is clear!

Copy link
Member

@sunesimonsen sunesimonsen left a comment

Choose a reason for hiding this comment

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

👍

Did you see any performance penalty?

@papandreou
Copy link
Member Author

I can't imagine there would be? The only change is that add* will check a boolean _frozen property and throw if it's true.

@papandreou papandreou merged commit 705a820 into v11 Sep 29, 2018
@papandreou papandreou deleted the feature/freezeTopLevelExpect branch September 29, 2018 19:01
@sunesimonsen sunesimonsen mentioned this pull request Jan 3, 2019
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants