Is componentDidMount supposed to run with shallow rendering in Enzyme?
问题 From my understanding and from what I have read so far in various answers, not all lifecycle methods are supposed to be run with shallow rendering. Especially componentDidMount However, I notice that when I do beforeEach(function () { fakeComponentDidMount = sinon.stub(Component.prototype, 'componentDidMount'); fakeComponentDidMount.callsFake(function () {}); wrapper = shallow(<Component {...props} />); }); afterEach(function () { fakeComponentDidMount.restore(); }); it('calls