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] Ensure recursive calls to displayNameOfNode uses the adapter's version of the method #2482

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

mejackreed
Copy link
Contributor

Fixes #2481

This is my first contribution to enzyme so happy to update/modify this PR as needed.

…eOfNode` uses the adapter's version of the method

Fixes enzymejs#2481
@@ -886,13 +887,13 @@ class ReactSixteenAdapter extends EnzymeAdapter {
case ContextProvider || NaN: return 'ContextProvider';
case Memo || NaN: {
const nodeName = displayNameOfNode(node);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing that wasn't clear to me was when/why we should use the adapter here or not.

Copy link
Member

Choose a reason for hiding this comment

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

i think if we did, it would be an infinite loop.

@codecov
Copy link

codecov bot commented Dec 7, 2020

Codecov Report

Merging #2482 (75e8963) into master (bdb618e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2482   +/-   ##
=======================================
  Coverage   96.04%   96.05%           
=======================================
  Files          49       49           
  Lines        3924     3925    +1     
  Branches     1102     1102           
=======================================
+ Hits         3769     3770    +1     
  Misses        155      155           
Impacted Files Coverage Δ
...enzyme-adapter-react-16/src/ReactSixteenAdapter.js 95.16% <100.00%> (+0.01%) ⬆️

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 bdb618e...75e8963. 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.

Thanks, this seems great.

@@ -886,13 +887,13 @@ class ReactSixteenAdapter extends EnzymeAdapter {
case ContextProvider || NaN: return 'ContextProvider';
case Memo || NaN: {
const nodeName = displayNameOfNode(node);
Copy link
Member

Choose a reason for hiding this comment

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

i think if we did, it would be an infinite loop.

@ljharb ljharb changed the title Ensure recurrsive calls to displayNameOfNode uses this version of the function [Fix] Ensure recursive calls to displayNameOfNode uses the adapter's version of the method Dec 8, 2020
@ljharb ljharb merged commit 75e8963 into enzymejs:master Dec 8, 2020
@mejackreed mejackreed deleted the 2481 branch December 8, 2020 22:57
ljharb added a commit that referenced this pull request Jan 20, 2021
 - [fix] `.setContext()`: calls cWRP (#2476)
 - [fix] Ensure recursive calls to `displayNameOfNode` uses the adapter's version of the method (#2482)
 - [deps] update `object.assign`, `object.values`, `enzyme-adapter-utils`
 - [dev deps] update `eslint`, `eslint-config-airbnb`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `babel-plugin-add-module-exports`, `@babel/cli`, `@babel/core`, `@babel/node`, `@babel/register`, `babel-loader`
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.

When using React.memo(React.forwardRef(Component)) displayName will be inaccurate
2 participants