-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
this
is undefined in bound functions when shallow rendering
#1756
Comments
this
is undefined in instance functions when shallow renderingthis
is undefined in bound functions when shallow rendering
+1 |
+1 yes happening to us too, due to https://github.com/airbnb/enzyme/blob/a50570d847fac11dc122c43651107e46ba03de73/packages/enzyme/src/ShallowWrapper.js#L177-L180 as |
+1 got this error this morning aswell. |
+1 got this same issue after upgrade to 3.4.2 |
Any ETA on fixing this or backing out the change? I have a bunch of builds that are failing and would hate to have to go through each of them and pin to a version. |
@deedubbu i'm working on it; i hope to have a patch out tonight. |
Sorry for the regression. I’m going to write a patch for this. |
@ljharb Thank you! I'm reviewing it. |
Please upgrade to v3.4.3 🙏 |
I believe this may still be an issue. In my shallow rendered component tests I'm getting:
Resolved by reverting to 3.4.1 for now.... Let me know if I can provide more info :) |
@Tinusw Please open a new issue with a test case that reproduces it. |
Looks like any change will trigger |
Not sure why, but the 3.4.3 release broke my tests. I receive The relevant test is attached. I was able to figure out that it('<MyComponent />', async () => {
fetch.mockResponse(JSON.stringify(jsonData));
const wrapper = shallow(<MyComponent />, { disableLifecycleMethods: true });
await wrapper.instance().componentDidMount();
wrapper.update();
expect(fetch.mock.calls.length).toEqual(1);
expect(wrapper.find(Table).length).toEqual(1);
}); |
It's very helpful to open a new issue with a test case that reproduces it. |
Sorry about that, I'm on it :) |
See enzymejs/enzyme#1756 for more info. Will restore `^` and upgrade to latest once they release a patch to fix this.
Describe the bug
The following test passes in 3.4.1 but fails in 3.4.2.
The error in 3.4.2 is:
To Reproduce
Steps to reproduce the behavior:
[email protected]
Expected behavior
The test should pass.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: