Enzyme: Update docs to remove `lifecycleExperimental` option

Created on 25 Oct 2017  路  6Comments  路  Source: enzymejs/enzyme

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.

docs help wanted

Most helpful comment

@ljharb I can help with this.

All 6 comments

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

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

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

We may need to update the docs.

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 I can help with this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timhonders picture timhonders  路  3Comments

potapovDim picture potapovDim  路  3Comments

andrewhl picture andrewhl  路  3Comments

SandroMachado picture SandroMachado  路  3Comments

heikkimu picture heikkimu  路  3Comments