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

Fix simulateError() on Memo component #2525

Merged
merged 1 commit into from Jun 16, 2021

Conversation

henryqdineen
Copy link
Contributor

We are seeing TypeError: Cannot read property 'displayNameOfNode' of undefined errors and I believe I tracked it down to a regression introduced in #2482. The displayNameOfNode() method now references this but with simulateError() it ends up being called unbound. My fix is to just always bind adapter.displayNameOfNode so this is always adapter.

Thanks!

@henryqdineen henryqdineen changed the title Fix `simulateError() on Memo component Fix simulateError() on Memo component Jun 15, 2021
@codecov
Copy link

codecov bot commented Jun 15, 2021

Codecov Report

Merging #2525 (8c55734) into master (f046079) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2525   +/-   ##
=======================================
  Coverage   96.31%   96.31%           
=======================================
  Files          49       49           
  Lines        4204     4207    +3     
  Branches     1130     1130           
=======================================
+ Hits         4049     4052    +3     
  Misses        155      155           
Impacted Files Coverage Δ
...enzyme-adapter-react-16/src/ReactSixteenAdapter.js 95.46% <ø> (ø)
...e-adapter-react-16.1/src/ReactSixteenOneAdapter.js 95.03% <0.00%> (-0.02%) ⬇️
...e-adapter-react-16.2/src/ReactSixteenTwoAdapter.js 95.09% <0.00%> (-0.02%) ⬇️
...adapter-react-16.3/src/ReactSixteenThreeAdapter.js 95.45% <0.00%> (-0.02%) ⬇️
packages/enzyme/src/ShallowWrapper.js 99.12% <0.00%> (+<0.01%) ⬆️
packages/enzyme/src/selectors.js 96.46% <0.00%> (+0.01%) ⬆️
...nzyme-adapter-react-13/src/ReactThirteenAdapter.js 94.96% <0.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f046079...8c55734. Read the comment docs.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great; tests fail without your fix, and pass with them. Thanks!

@ljharb ljharb merged commit 8c55734 into enzymejs:master Jun 16, 2021
wojtekmaj added a commit to wojtekmaj/enzyme-adapter-react-17 that referenced this pull request Nov 4, 2022
From enzymejs/enzyme#2525

Co-Authored-By: Henry Q. Dineen <682132+henryqdineen@users.noreply.github.com>
wojtekmaj added a commit to wojtekmaj/enzyme-adapter-react-17 that referenced this pull request Nov 4, 2022
From enzymejs/enzyme#2525

Co-Authored-By: Henry Q. Dineen <682132+henryqdineen@users.noreply.github.com>
ljharb added a commit that referenced this pull request Nov 5, 2022
 - [fix] `isEmptyRender`: properly detect memoized SFCs returning null
 - [fix] avoid a crash with lazy components
 - [fix] fix `simulateError()` on Memo component (#2525)
 - [babel] add `babel-plugin-add-module-exports` and fully use ESM syntax
 - [deps] update `enzyme-shallow-equal`, `enzyme-adapter-utils`, `object.assign`, `object.values`, `prop-types`
 - [meta] use `npmignore` to autogenerate
 - [eslint] switch to `@babel/eslint-parser`, fix lintingan npmignore file
 - [dev deps] update `@babel/cli`, `@babel/core`, `eslint`, `eslint-config-airbnb`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-markdown`, `eslint-plugin-react`, `eslint-plugin-react-hooks`
 - [dev deps] update `safe-publish-latest`; use `prepublishOnly`
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.

None yet

2 participants