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

Add update after simulateError #1812

Merged
merged 2 commits into from
Sep 19, 2018

Conversation

jgzuke
Copy link
Collaborator

@jgzuke jgzuke commented Sep 8, 2018

Fixes #1809

Note that

it('rerenders on an error during render', () => {
  const wrapper = mount(<ErrorBoundary spy={sinon.stub()} />);

  expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(0);
  expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(1);

  return new Promise((resolve) => {
    wrapper.setState({ throws: true }, () => {
      expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(1);
      expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(0);
      resolve();
    });
  });
});

Will still fail, I will fix that separately.

@ljharb

@jgzuke jgzuke requested a review from ljharb September 8, 2018 14:34
@ljharb ljharb force-pushed the jgzuke-test-mount-simulate-bug branch from f6787bd to d065042 Compare September 8, 2018 20:53
@ljharb

This comment has been minimized.

@jgzuke

This comment has been minimized.

@jgzuke
Copy link
Collaborator Author

jgzuke commented Sep 12, 2018

@ljharb I reverted the change and just left the tests, resulting in https://travis-ci.org/airbnb/enzyme/builds/427510199 (which is the expected failures). Im not really sure what the problem here might be

@jgzuke jgzuke force-pushed the jgzuke-test-mount-simulate-bug branch from e9ff3eb to 86b77bc Compare September 12, 2018 04:35
@jgzuke
Copy link
Collaborator Author

jgzuke commented Sep 14, 2018

Are there any additional changes to be made here?

@ljharb
Copy link
Member

ljharb commented Sep 17, 2018

@jgzuke this build: https://travis-ci.org/airbnb/enzyme/builds/429796257 still didn't fail (https://travis-ci.org/airbnb/enzyme/builds/429796341 is the one with the fix) :-/

basically, i want to see a failing build, that the fix fixes, to have confidence to merge this.

@jgzuke
Copy link
Collaborator Author

jgzuke commented Sep 19, 2018

Im a bit confused why https://travis-ci.org/airbnb/enzyme/builds/427510199 fails but https://travis-ci.org/airbnb/enzyme/builds/429796257 passes given they contain the same changes, are you sure Jenkins is actually running on the displayed commit and not on the end of that branch

@ljharb
Copy link
Member

ljharb commented Sep 19, 2018

hmm, i'm pretty sure. i'll try pushing just the first commit, and i won't push the second til the test is done.

@ljharb ljharb force-pushed the jgzuke-test-mount-simulate-bug branch 2 times, most recently from f7d51d2 to 85ed936 Compare September 19, 2018 05:35
@ljharb
Copy link
Member

ljharb commented Sep 19, 2018

guess that was it! i'll merge this shortly.

@ljharb ljharb merged commit f281fef into enzymejs:master Sep 19, 2018
ljharb added a commit that referenced this pull request Oct 5, 2018
 - [new] `mount`: `.state()`/`.setState()`: allow calling on children (#1802)
 - [new] `configuration`: add `reset`
 - [fix] `makeOptions`: ensure that config-level `attachTo`/`hydrateIn` are inherited into wrapper options (#1836)
 - [fix] `shallow`/`Utils`: call into adapter’s `isCustomComponentElement` if present (#1832)
 - [fix] `shallow`/`mount`: throw an explicit error when state is null/undefined
 - [fix] freeze ROOT_NODES for child wrappers (#1811)
 - [fix] `shallow`: `.parents`: ensure that one `.find` call does not affect another (#1781)
 - [fix] `mount`: update after `simulateError` (#1812)
 - [refactor] `mount`/`shallow`: `getElement`: use `this.single`
 - [deps] update `babel-preset-airbnb`, `chai`, `eslint`, `mocha`, `enzyme-adapter-utils`, `react-is`, `airbnb-js-shims`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Component is not updated after simulating error
2 participants