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

Update docs to remove lifecycleExperimental option #1303

Closed
maurocarrero opened this issue Oct 25, 2017 · 6 comments
Closed

Update docs to remove lifecycleExperimental option #1303

maurocarrero opened this issue Oct 25, 2017 · 6 comments

Comments

@maurocarrero
Copy link
Contributor

When shallow is used with lifecycleExperimental option as false, componentDidMount is called.

From shallow docs:
options.lifecycleExperimental: (Boolean [optional]): If set to true, the entire lifecycle (componentDidMount and componentDidUpdate) of the React component is called. The current default value is false with enzyme v2, but the next major version will flip the default value to true.

You can check the issue in this repo with example

Let me know if additional details are needed.
Thanks.

@blainekasten
Copy link
Contributor

What version are you using? I think we would want to remove that flag more than fix any old compatibility.

@maurocarrero
Copy link
Contributor Author

Hi @blainekasten, is detailed in the repo's README:
"enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.2",

I would expect that shallow's default behavior avoids running those methods that belongs to a mounted component, but per docs, that would be already changed:
but the next major version will flip the default value to true

@ljharb
Copy link
Member

ljharb commented Oct 25, 2017

lifecycleExperimental is gone; the flag you want to set is disableLifecycleMethods: true.

We may need to update the docs.

@maurocarrero
Copy link
Contributor Author

That option is the one I found to fix the unit tests after upgrading. Everything is in the repo I added at the beginning.

Agree, you may need to update the docs. Thanks.

@ljharb ljharb added the docs label Oct 25, 2017
@ljharb ljharb changed the title Shallow with lifecycleExperimental option as false triggers componentDidMount Update docs to remove lifecycleExperimental option Oct 25, 2017
@maurocarrero
Copy link
Contributor Author

@ljharb I can help with this.

@maurocarrero
Copy link
Contributor Author

#1319

@ljharb ljharb closed this as completed in e435194 Nov 4, 2017
ialexryan added a commit to ialexryan/enzyme that referenced this issue Jan 25, 2018
jquense pushed a commit to jquense/enzyme that referenced this issue Feb 23, 2018
jquense pushed a commit to jquense/enzyme that referenced this issue Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants