Skip to content

Freeze the top-level expect - #517

Merged
papandreou merged 2 commits into
v11from
feature/freezeTopLevelExpect
Sep 29, 2018
Merged

Freeze the top-level expect#517
papandreou merged 2 commits into
v11from
feature/freezeTopLevelExpect

Conversation

@papandreou

Copy link
Copy Markdown
Member

As discussed on #476

@alexjeffburke alexjeffburke mentioned this pull request Sep 28, 2018
5 tasks

@alexjeffburke alexjeffburke 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.

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
Comment thread test/unexpected.spec.js
topLevelExpect.addAssertion('<any> to foo', function() {});
},
'to throw',
'Cannot add an assertion to a frozen instance, please run .clone() first'

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.

I think this is clear!

@sunesimonsen sunesimonsen 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.

👍

Did you see any performance penalty?

@papandreou

Copy link
Copy Markdown
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.

3 participants