After upgrading to V3 the new default value for options.lifecycleExperimental causes a few of my tests to fail due to calls I'm making in componentDidMount that assumes I have a DOM.
When I want to make more extensive tests I use mount and expect lifecycle methods like componentDidMount to be called.
It would be great if I could set global options for shallow rendering - in my case I would set options. disableLifecycleMethods = true
I believe you can set that globally in the configure call?
Currently, we can set disableLifecycleMethods option only with calling shallow method.
I think it makes to be able to set disableLifecycleMethods option with calling configure.
Enzyme.configure({
adapter: new Adapter(),
// it should be a explicit name indicating to affect only `shallow`
disableLifecycleMethods: true
});
Ah, thanks for clarifying.
I think we'd want a namespace specifically for both shallow and mount options (and render if applicable)?
@ljharb 馃憤 That's reasonable to me.
Hmm - this already seems like it's implemented, in that all options passed to configure are merged with options passed to the ShallowWrapper and ReactWrapper constructors.
I'm going to close, but will reopen if this isn't sufficient.
Most helpful comment
Currently, we can set
disableLifecycleMethodsoption only with callingshallowmethod.I think it makes to be able to set
disableLifecycleMethodsoption with callingconfigure.